java-include-jar-file
CREATE the folder "lib" in your project's folder (already has src , build , WebContent )
COPY any .jar files you will need imported/included into Eclipse\workspace\projectname\lib
ECLIPSE right click and refresh the project, you'll see the lib appear...
Left pane in the Java perspective with the tree with the name of your project (and classes)
Right-click the name of the project -> properties
Java Build Path -> Libraries (tab) -> Add JARs (button) -> Browse (tree view of project dirs)
OR ( Java Build Path -> Libraries (tab) -> Add External JARs (button) -> Browse )
NOTE: You can also add a class folder, a directory with Java class files that are not in a JAR
NOTE: Class path not available for export you can right click on the warning and Quick Fix
(it will publish the classpath for export...)
NOTE: public class CLASSNAME should match the FILENAME.java
NOTE: run as normal Java application will allow "System.out.println" for debugging
Right click on the gray margin to Toggle a BreakPoint - the next Run will give you the
debug window below where you can step through the program to see results at each breakpoint
Caused by: java.lang.ClassNotFoundException: org.jdom.JDOMException
*Means you most likely are referencing objects that you do not have the .jar files...
e.g. "jdom.jar"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Not entirely successful attempt with .class files...
You can add a folder containing compiled classes to your project by right clicking the project, then select Properties > Java build path, then "Add External Class Folder"
Or choose "Add Class Folder" if you have copied the class files into a sub directory of your project.
This will add the class files to the projects classpath and you can then import the class into your java file using an import statement:
import my.package.MyClass;
Note: The package structure should be maintained under the folder that you add as a class folder. So if you add folder "myclasses" as a class folder, the directory structure should be as follows for the example above:
myclasses/my/package/MyClass.class
servlets require the manual method
copying the jar file into
\workspace\AppProperties\WebContent\WEB-INF\lib
refresh