When you plan to write regular Java classes that will be used in multiple projects, you can package Java class files in a Java project. A Java project is a special kind of project that produces a JAR file which can be used across projects.
Note. If you are planning to reuse Java controls, you can create a control project. For more information, see How Do I: Create and Use a Java Control Within a Control Project?
To Create a Java Class Within a Java project
It may be good idea to create separate subfolders within your Java project and group classes with related functionality in the same folder. Keep in mind that a folder beneath the Java project's top level becomes part of the control's Java package name. With this in mind, you should create a folder structure that reflects what the various Java classes are designed to do. Note that you cannot create the control in the root of a project — it must be in a subfolder.
To Build and Package the Java Project
WebLogic Workshop compiles the Java classes, packages it into a JAR file with the same name as the control project's folder, and adds the control as a library available in the application. You'll find the resulting JAR file in the Libraries folder of your application.
To Add a JAR File from Another Application
To Use the Java Class
To use the class, you must handle it like any regular Java class in a package. That is, you can add an import statement at the beginning of the source file or you can refer to the class by its long name. For more information, see Introduction To Java.