Archive for the ‘Adding a Jar file to an EGL project’s Classpath’ Category
This post describes how to export Java classes to create a .jar-file so that the exported classes can be reused by other projects. This is presented in an EGL project context, but the same steps are involved for any Java project as well.
Export the Java Class
The screen show shown below starts the process by ight-clicking on the Java class to expose the popup menu from which the Export option is selected.
Fig.1 – Begin by right-clicking the class to show the pop-up menu.
To continue with the export process follow the options as shown by the following screen shots.
Fig.2 – Select the option shown and select “Next”
Fig.3 – “Finish”
Importing the Jar File into Your Project
When completed you will see the .jar-file under the lib directory as before however, because it is now part of the project’s build path, it has been included among the other .jar-files under the project.
This post illustrated how to export a Java class into a .jar-file and then import it into an EGL project for reuse. Placing the .jar-file in the “WebContent/lib” directory gives the project access to those resources when the project is deployed onto Tomcat however, the IDE is not aware of them. By adding the .jar-file to the project’s class path or build path it gives the IDE access to the classes during development (content assist) and when it builds the project for running inside the IDE.