Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of Forte for Java development?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Most people do not understand the knowledge points of this article "what is the method of Forte for Java development?", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what is the method of Forte for Java development" article.

Introduction to Forte for Java

The Forte for Java,Community version is an Java integrated development environment (ide) written in the Java language. It is a cross-platform development tool with the ability to develop client-side and server-side applications. Forte makes full use of the powerful functions of the Java language and provides you with a dynamic, responsive development environment. It can be obtained from: java.sun.com.

Characteristics of Forte for Java:

Modularity: Forte for Java is a structured system, and the functions of IDE, such as editing, debugging, GUI generation, EJB (Enterprise Java Bean) support, are independent modules. Forte for Java's Update Center can help you download the latest modules from SUN's official website.

Customizable: Forte for Java is well configurable, and users can easily change the graphical user interface. By configuring menus, toolbars, workspaces, etc., users can generate a graphical user interface with their own development style.

Extensibility: Forte for Java provides a complete and open set of api (Forte itself was developed by this set of API), so no matter what version of Forte, you can take advantage of this mature development platform.

Brief introduction of Integrated Development Environment (IDE)

In this section, we will briefly introduce some of the main components of the IDE user interface and their features. So that readers who are using Forte for Java for application development for the first time will know how to browse and find commands and how to get basic knowledge such as help documentation.

User interface (User Interface): the user interface consists of several core parts: Main Window (main form), Explorer (resource manager), Editor (editor), Project Settings Window (project setting form) and Global options windows (global selection form). Let's introduce them one by one.

1 Main Window (main form)

Once the Forte for Java starts running, the main form is opened and held until the end of the Forte. The main form can be regarded as the control center of the entire integrated development environment, with most important operations and commands related to it. It can be divided into four separate control groups: menu bar, toolbar, workspace and status bar.

The menu bar consists of nine menus, which are consistent with the Windows98 operation style, namely File (file), Edit (edit), View (view), Project (project), Build (creation), Debug (debugging), Tools (tools), Windows (window), and Help (help).

The toolbar is located in the middle of the main form and is composed of some action buttons corresponding to some menu options or command functions. You can click these buttons directly with the mouse to complete the specified function. Toolbar buttons greatly simplify the user's operation process and make the operation process visual. One of the more special toolbar buttons is Component Palette (widget palette), which is located in the right half of the toolbar. Mainly combined with FoRM Editor (form editor) for visual development. It consists of some standard widgets and page layouts.

Menus and tools are context-sensitive and are sometimes unavailable (grayed out) because the form or object associated with them is not active.

Workspaces (workspace): Forte for Java introduces the concept of a workspace to manage forms and tools. The workspace is located at the bottom of the main form and has five tabs: Editing (editing), GUI Editing (graphical interface editing), Browsing (browsing), Running (running), and Debugging (debugging). Each tab has a set of forms that correspond to a specific step in the application development process. By default, IDE automatically opens the GUI Editing workspace when the user opens a visual form, and when the user runs an application, IDE automatically switches to the Running workspace.

1.2 Explorer (Resource Manager):

Forte for Java's explorer provides users with an interface to manage all objects and files, as well as an entrance to various programming functions. Through it, users can edit classes, manage projects, change object properties, and connect to various data sources.

1.3 Form Editor (form Editor):

The form editor provides users with the ability to visually develop a user interface. Users can select all kinds of standard widgets from Component Palette, such as menus, scroll bars, buttons, etc., and then place them directly on the form editor. Forte for Java will automatically generate the corresponding Java code to complete the design and property settings of the widget (Java code can be seen from Editor Window). The form editor can also change the appearance of individual widgets on the form by calling Java Layout Explorer to generate a user-defined interface.

1.4 Project Settings Window (Project setup form) and Global options Windows (Global selection form):

These two forms are responsible for configuring IDE. Project Settings Window manages settings related to individual projects, such as compiler type, Java resources, and so on. Global options Windows is the configuration of the entire IDE integrated development environment.

User manuals, contextual help, and Tool tips:Forte for Java provide three ways to get help information

2.1 user's Manual:

Select Help | Document | User's Guide from the main menu to enter the user's manual. The Java Help reader is divided into two parts, listing the contents and titles on the left and displaying the contents of the selected titles on the right. Users can also search the content they need from the entire user manual through the search engine.

2.2 Context Help (context help):

Users can get online help in a more convenient way, select a form, dialog box, icon, etc., with the mouse, and then press the "F1" key to obtain the attribute characteristics of the component. For menu options, you can hold the mouse pointer over the option and press the "F1" key.

2.3 Tool tips (tooltip):

When the user places the mouse pointer over a part of the IDE integration environment, such as a button in the toolbar, a text appears that provides a brief introduction to the widget. This feature is useful for understanding a node in a tree structure or a single attribute in the property sheet.

Finally, users can browse the user manual in HTML format using an external browser (IE or NC). The specific path is as follows: doccom.NETbeansdevelopermodulesuserguideusergdto.htm

* *

This paper briefly introduces how to develop and execute Java applications with Forte for Java.

1. Create a new class

In Forte for Java, users can create classes and other objects through templates, which constitute the basic framework of the class and provide some basic code of the class. Of course, if the user is willing to write all the code, he can create an empty template. There are three basic ways to create objects:

Create an object from Main Window:

Select File | New From Template from the main menu (create new from template)

Expand the node in the template wizard, and then select a template, and the corresponding description of the template appears on the right panel of the dialog box; press the "Next" button to enter the Target Location page of the template

Enter the name of the object you want to create in the "Name" field, and be careful not to enter a file suffix, as the system will automatically add the suffix to the name.

On the same page, select a Package for your class. You can enter the name of the package in the "Package" field or select a package from the tree structure below.

Press "Finish" to exit the wizard and generate a class.

Note: when you create an object from a template for the first time, you will be prompted whether you want to add the file to the current project. If you select Yes, the new file will be displayed in both the Filesystems (file system) and Project (project) tabs. If you select NO, the new file will not appear in the project tab. If you select "Always", the newly created class and its subclasses will be automatically added to the current project. If you select Never, all of these classes will not be added to the current project.

Create an object from Explorer:

If Explorer is not open, choose File | Open Explorer from the main menu, or select Open Explorer from the toolbar.

Click the "Filesystems" tab in Explorer, select the package in which you want to place the class (in the form of a folder), and then right-click to pop up a floating menu.

Select "New From Template" from the floating menu, and then the other steps are the same as above.

Create an object from object Browser:

Click the "Browsing" tab of the main form to open Object Browser (object browser), or select File | Object Browser from the main menu.

On the Projects panel of Object Browser, select the package (package) where you want to place the class, right-click and pop up a floating menu.

Select "New From Template" from the floating menu, and then the other steps are the same as above.

Once you have created a class, Editor window (Edit form) opens and displays the skeleton code of the generated class. If you generate a visual form from the template, Form window (form form) and Component Inspector (component browser) will also open. The newly created class will be automatically added to the Explorer tree structure and Object Browser.

Now you can edit the newly created class directly in Editor window, or generate elements of the class, such as methods, structures, and variables, through custom dialogs.

Note: unlike other IDE development environments, Forte for Java does not develop applications around projects. All objects developed by the IDE integrated environment, as well as other file systems connected to IDE, can be managed and processed through Object Browser (object browser) or Explorer (Resource Manager). Of course, you can also organize all files in the form of a project to make compilation and execution easier, and you can save your own project settings for each project.

two。 Compile the Java source program:

Forte For Java offers a wide range of compilation options, from activating Compile commands in different ways to providing a different compiler for each class.

Note: when you select the Compile (including Compile All, Compile Project, Build, Build All, or Build Project) command for a class, IDE will automatically compile the first file and package it finds with the same name as the file it wants to compile. Therefore, if you have two files with the same name and packages in Explorer at the same level, the files in the first package will be automatically compiled even if you select the Compile command in the second package.

Compile a single class:

You can compile an object in the active Editor window (edit form), or you can select an object from Explorer (explorer) to compile. This can be achieved in all four ways:

Select Build from the main menu | Compile

Click the Compile icon in the toolbar

Press "F9" key

Select the object you want to compile in Explorer, right-click, and select "Compile" from the pop-up menu.

Compile package (package):

There are a variety of options for compiling packages, all from the "Build" menu in the menu bar, the toolbar, and the pop-up menu in Explorer.

Select the "Compile" option and all source programs in the file will be compiled when they are compiled for the first time, otherwise only files that have been modified since the last compilation will be compiled

Select the "Compile All" option, and the source programs in the folder and all its subfolders will be compiled

Selecting the "Build" option forces all source programs to be recompiled, regardless of whether they have been modified or not. This method allows you to make sure that all files have been compiled

Select the "Build All" option: the entire folder and all its subfolders will be Build.

Delete files with the .class suffix:

The Build menu contains Clean and Clean All options to delete compiled classes.

The Clean option deletes all files with the .class suffix for the selected package

The Clean All option deletes all files with the .class suffix for the package and its subpackages.

The built-in compiler supports:

The IDE integrated environment supports both JavaC and Fast JavaC, and IDE uses Fast JavaC as the default compiler.

Fast JavaC is a natural compiler, that is, it has a different version for each development platform, and the final compilation result is the same Java binaries. It provides a relatively fast compilation scheme for developers who develop applications on only one platform. Fast Javac currently supports Solaris, Linux and Windows platforms.

JavaC is a cross-platform compiler written in Java.

Change the default compiler type:

IDE provides the default compiler method, and once you change the default compiler, it will affect all classes and templates that have not yet specified a compiler type. The specific implementation steps are as follows:

Select Project from the main menu | Settings..., to open the Project Settings (Project Settings) form

Select the Java sources node in the left panel of the form

Select the Default compiler type (default compiler type) property and select the new compiler type from the drop-down menu.

Change the compiler type of the class:

Each class has a default compiler. If you want to compile a class with a different compiler or a different configuration of the same compiler, you can customize the property sheet of the class.

Select an object from the Filesystems tab of Explorer (Explorer)

Select View | Properties from the main menu

Click the Execution tab of the Properties form

Double-click the Compiler button to scroll to find the compiler type, or click the Compiler property field and select the compiler type from the drop-down menu.

Tip: if you want to change the compiler type of a series of classes at the same time, you can hold down the CTRL key while selecting the class, and then change the compiler type in the property sheet.

3. Run the Java class:

Java applications can be executed in a variety of ways.

First, you must make sure that the Java object is executable (if there is a main () method, or a subclass of Applet or Japplet. Then, right-click in Explorer and select the Execute option from the pop-up menu.

You can also select an object from the Editor form, and then:

Select Build from the main menu | Execute

Select the Execute icon from the toolbar

Use the shortcut key CTRL+F9.

Once running, the Java class will be compiled first (by default). After the compilation is successful, IDE will switch to the Running (running) workspace.

Types of execution and executors:

You can run a typical Java application internally or externally, both of which have their own advantages and disadvantages. Java Applets can be run as Applet Execution, and other execution types can be installed through extension modules.

External execution:

The vast majority of applications use external execution, which is set by IDE as the default execution of most templates.

During the external execution of the application, a new VM (virtual machine) is activated, which enables you to run applications that require a special VM and to do operations that cannot be achieved by internal execution (described below). You can specify an executable VM, such as java.exe, and add command-line arguments and class path settings after the command. External execution provides protection against application crashes and delays.

Internal (linear) execution:

An application that runs within the Forte for Java IDE integrated environment is called internal execution. This allows the application to modify the IDE itself directly and to improve the loading speed of the application. However, the disadvantage of this is that the application cannot install its own URLStreamHandlerFactory or SecurityManager object (if the Rmi application cannot be run). When executing internally, if the application crashes, so does the IDE environment.

Note: there are some applications such as startup routines (in the Startup folder, you can select Tools from the main menu | Global Options... Internal execution is required because the purpose of these programs is to modify the IDE environment itself.

Other execution types:

There are also execution types that are customized for specific application types, such as RMI and JSP applications.

4. Debug Java classes

The debugger can be seen as a "snapshot" of the system while it is in execution. By setting breakpoints in key locations of the source code, the debugger can abort execution at these places, showing the details of the environment at the breakpoint; you can go inside the code and monitor execution; you can even connect the debugger to a running process.

Debugger (Debugger) form:

The Debugger form contains three tabs, Breakpoints (breakpoint), Threads (thread), and Watches (observation window).

Breakpoints (breakpoint):

The Breakpoints tab lists all currently set breakpoints, showing the name of the class and the line in which the breakpoint is located.

Add a breakpoint to the code:

Position the cursor over the line where you want to add the breakpoint

Select the Add/Remove Breakpoint option from the Debug menu, or right-click on the line and select Add/Remove Breakpoint; from the pop-up menu or use the shortcut CTRL+F8.

When the breakpoint is set, the current line is highlighted in blue.

Optional settings for Breakpoint:

If you chose the "New Breakpoint" command when setting the breakpoint, in the pop-up Add Breakpoint (add breakpoint) dialog box, you have the following further choices:

If you want a prompt to appear in the Output (output) form when the program reaches the breakpoint, you can select the "Print text" option; you can also use your own text with the system-provided self-explanatory code {lineNumber} (number of lines), {className} (class name), {threadName} (thread name) to further set the contents of the prompt. You can also set these configurations in the breakpoint property sheet of the Debugger form.

Eliminate breakpoints:

On the Editor form, position the cursor on the line where you want to eliminate the breakpoint

Select the Debug | Add/Remove Breakpoint option from the main menu, or use the shortcut CTRL+F8.

*********************

Develop Java Server Page (JSP)

Forte for Java, Community version provides a series of functions for developing Java Server Page (JSP): create, edit, compile, run.

1. Create and edit Java Server Pages

Create a new JSP file:

Select File File | New from template (New from template) from the main menu.

In the create template wizard, expand the JSP_servlet folder, select JSP and press "Next".

Select the name and folder (package) for your JSP file in the next wizard, and then press "Finish" to end.

Edit an JSP file:

Double-click the file you want to edit in Explorer and object browser, and the editor form will appear, and you can enter your own JSP code in the editor.

two。 Compile JSP

When you have finished editing your JSP file, you can compile it into a class file. The compilation process is divided into two steps: first convert the JSP page into a servlet, and then compile the servlet into a class file.

Compile a JSP:

Select the JSP file you want to compile in Explorer or object browser, right-click, and select "Compile" from the floating menu.

Compilation error handling:

Any errors that occur during compilation are displayed in the compiler output form. If the first step of the conversion of servlet is successful, users can better analyze the errors in the second step by looking at the servlet source code. At this point, the user can select a JSP file, right-click, select "View servlet" from the floating menu, and the servlet code is displayed in the editing form. Once you have found the error, you can modify it in the JSP page.

Select the compiler:

Users can choose different compilers according to their needs, such as selecting the Servlet compiler in the "Execution" column to compile servlet into a class in the file property sheet.

Java Beans, other JSP pages, and error handling pages are included in the compilation process:

If the user calls the JavaBeans widget (by markup) on the compiled JSP page, the called Beans will be compiled along with the current JSP page.

Similarly, if the user's JSP page references another JSP page (through markup or), the referenced JSP page will also be compiled.

If the user uses an error handling page (by specifying), the error handling page will also be compiled together.

Note: this version of Forte for Java supports JSP specification 1. 0. The built-in server for debugging and running JSP pages is SUN's Sun JavaServer web Development Kit 1.0.1.

3. Execute JSP

After successfully compiling your JSP page, you can run your JSP page through Forte for Java's built-in JSP engine.

Execute the JSP page:

Select the JSP file to run from Explorer or the object browser, right-click, and select "Execute" (execute). The servlet and JSP engines start running, and the JSP page will be displayed in the web browser.

Specify the parameter queue:

The user can specify a series of parameters to be passed to the server by the browser along with the submitted form. In the execution column of the page property sheet, edit the request parameter (Request Parameters) property. Note that please use the standard request string symbol (? Parameter 1 = value 1 & parameter 2 = value 2).

Restart the server:

When you execute a JSP page multiple times, the server does not restart. Instead, each time the server loads a new page, the startup time of the JSP page is saved. However, all classes called on the JSP page are not reloaded. Therefore, if you modify the Java Bean in the JSP page, you must restart the server.

Select the JSP node in Explorer or object browser, right-click, and select "Execute (restart server)" from the pop-up menu.

Configure the JSP execution type:

Sometimes users want to change the configuration of the server to get a better execution environment, and all the properties in Forte for Java's JSP Execute property sheet are accessible.

Get the JSP property sheet:

Select the JSP file node in Explorer and select View | Properties from the main menu to open the properties form. In the properties form, select the execute "Execute" column, click the "Executeor" property, and select "…" Button. At this point, the "Executeor" attribute editor appears, and all attributes in the JSP Execute property sheet are displayed in the editor.

Users can display JSP pages without Forte's built-in browser. Select e from the main menu (New from template).

In the create template wizard, expand the JSP_Servlet folder, select JSP and press "Next".

Select the name and folder (package) for your JSP file in the next wizard, and then press "Finish" to end.

Edit an JSP file:

Double-click the file you want to edit in Explorer and object browser, and the editor form will appear, and you can enter your own JSP code in the editor.

two。 Compile JSP

When you have finished editing your JSP file, you can compile it into a class file. The compilation process is divided into two steps: first convert the JSP page into a servlet, and then compile the servlet into a class file.

Compile a JSP:

Select the JSP file you want to compile in Explorer or object browser, right-click, and select "Compile" from the floating menu.

Compilation error handling:

Any errors that occur during compilation are displayed in the compiler output form. If the first step of the conversion of servlet is successful, users can better analyze the errors in the second step by looking at the servlet source code. At this point, the user can select a JSP file, right-click, select "View servlet" from the floating menu, and the servlet code is displayed in the editing form. Once you have found the error, you can modify it in the JSP page.

Select the compiler:

Users can choose different compilers according to their needs, such as selecting the Servlet compiler in the "Execution" column to compile servlet into a class in the file property sheet.

Java Beans, other JSP pages, and error handling pages are included in the compilation process:

If the user calls the JavaBeans widget (through markup) on the compiled JSP page, the called B#eeeeee ">

The above is the content of this article on "what is the method of Forte for Java development". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report