WebLogic Workshop is a full-featured Java development environment, and you
can use it to build and debug Java classes. If you are building an application
comprised of Java classes, you can create a Java project.
To Create a New Java Class
- If you are starting from an existing Workshop application, add a new Java
project. Select the application name in the Application pane, right-click,
and choose New-->Project. In the New Project
dialog, select Java Project, enter a name for your new
project, and click Create. If you do not already have a
Workshop application, create a new empty application by choosing File-->New-->Application.
In the New Application dialog, select Empty Application
and enter a name for the new application. Once you've created it, add a
new Java project.
- Create the package structure for your Java class or classes by creating
folders within the Java project. You can create a Java class at the root
level of the project or under a single folder, but if you intend to package
the class you may want to adhere to a naming standard so that others can
reference your class without namespace conflicts. For example, to fully
qualify your class com.mycompany.myproject.myclass,
you would create a hierarchy of folders com,
mycompany, and myproject
to contain myclass.
- To debug your class, it needs to have a main()
method. Add the main() method to your class
so that it looks like the following example:
package com.mycompany.myproject;
public class myclass
{
public static void main (String[] args)
{
System.out.println("Hello world");
}
}
- Before you can run and debug your class, you need to set some debugging
properties. In the Application pane, select your Java project. Right-click
and choose Properties. In the Project Properties
dialog, select the Debugger tab.
- Under Debugger Options, select the Build before
debugging option if it's not already selected.
- Under Create new process settings, set the Main
class field to point to the class containing the main()
method. Following the above example, you would set the Main class
field to com.mycompany.myproject.myclass.
- If you want to pass parameters to the main()
method at runtime, you can set the Parameters field to
a list of quote-delimited string arguments, separated by spaces.
- After you close the Project Properties dialog, you can
set breakpoints within your class, and click the Start
button to execute and step through your code.