There are several ways to run your files. You can run an individual file, such as an applet HTML file or an application file, by right-clicking the file in the project pane and choosing the Run command. You can also run a project by selecting the Run Project button on the main toolbar. The Run Project button can also be configured with preset runtime parameters and saved as drop-down menu selections in JBuilder Professional and Enterprise.
.java
file or applet HTML file within a project,
.java
file in the project pane. The application .java
file must contain a main method.
The application compiles and runs if there are no errors. The build progress is displayed in the status bar and the message pane displays any compiler errors. Before compiling, error messages are displayed in the Errors
folder of the structure pane. If the program compiles successfully, the classpath is displayed in the message pane and the program runs.
.java
file in the project pane.
APPLET
tag. The HTML file calls the class found in the CODE
attribute of the APPLET
tag. This applet class must contain an init()
method. You can generate an HTML file for your applet in Step 3 of the Applet wizard.
.java
file: select the applet .java
file if it has a main method. You can create an applet with a main()
method by selecting the Can Run Standalone option in Step 1 of the Applet wizard.
The applet compiles and runs if there are no errors. The build progress is displayed in the status bar and the message pane displays any compiler errors. Before compiling, error messages are displayed in the Errors
folder of the structure pane. If the program compiles successfully, the classpath is displayed in the message pane and the program runs.
This is a feature of JBuilder Professional and Enterprise.JBuilder also supports running web files, such as JSPs, servlets, SHTML, and HTML, through a web server for a live view of your web application. To run JSP, SHTML, and HTML files, right-click the file in the project pane and select Web Run.
For servlets, you must first set the Enable Web Run/Debug From Context Menu option. If you create your servlets with JBuilder's Servlet wizard, this option is set automatically. To enable this option, right-click the servlet file in the project pane and select Properties. Check the Enable Web Run/Debug From Context Menu option on the Web Run page. Then right-click the servlet file and select Web Run.
"Compiling and debugging the JSP"
"Compiling the servlet."
With JBuilder Professional and Enterprise, you can also set runtime and debug configurations for the Run Project and Debug Project buttons. These configurations are added to the drop-down menus that are accessible from the Down arrows to the right of each buttons.
To run your project without debugging,
main()
method.
init()
method. This option runs the applet in JBuilder's applet viewer, AppletTestbed.
APPLET
tag. The HTML option runs the applet in Sun's appletviewer.
JBuilder compiles and runs your program. Any errors during compile are displayed in the message pane at the bottom of the AppBrowser. If there are errors, compiling stops so you can fix the errors and try again. Select an error in the message pane or in the Errors
folder in the structure pane to highlight the code in the source pane. For help on an error message, select the error in the message pane and press F1 Help.
This is a feature of JBuilder Professional and Enterprise.Runtime configurations (Run|Configurations) are preset runtime parameters. Using preset parameters saves you time when running and debugging, because you need to set the parameters only once. With preset configurations, each time you run or debug your application you simply select the desired configuration.
To set the runtime configurations, use the Runtime Configurations dialog box.
You can set the following run and debug options:
Runtime configurations are displayed in the Runtime Configurations dialog box. You cannot delete the <Default> configuration, although you can edit it. To choose a configuration once you've created it, select the Down arrow next to the Run and Debug icons on the main toolbar to access the drop-down menu of configurations.
If you get errors, runtime exceptions, or other program misbehavior, you may want to debug your program as you run it to find the problems. You do that by running the program in JBuilder's integrated debugger.
java
command. For example,
java -classpath /user/jdk/lib/rt.jar /user/jbuilder/lib/dbswing3.0.jar /user/local/jbproject/mypackage/project1 mypackage.project1
java -classpath /user/[username]/jbproject/hello/classes/HelloWorld.jar hello.HelloWorldClass
jdk/bin
directory must be on your path.
The command must have the following form:
java -classpathpackage-name
.main-class-name
You can also use the -jar option:
java -jar HelloWorld.jar
Note: You must first change to the directory that contains the .jar file before running this command with the -jar option.
Compiling Java programs
Deploying Java programs
The JAR tutorial at http://java.sun.com/docs/books/tutorial/jar/index.html
Using the command-line tools
JDK/bin
directory. See the JDK documentation at http://java.sun.com/j2se/1.3/docs/tooldocs/tools.html for more information on this tool.
Using the command-line tools
Debugging Java programs
Deploying Java programs