This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello I am on linux and trying to compile some code which imports packages which are available in a jar file.
Using the jar tool I have checked the the appropriate class files are actually in the jar and that the folder structure
corresponds correctly to the the structure implied by the import statement.
I have placed the jar file in /home/me/.jars and added /home/me/.jars/externalTool.jar to the class path in my .bashrc.
(Yes, I did rememeber to still have "." included in the class path)
The javac compiler can still not find the packages imported in the java file. I have tried compiling usisng the -cp option specifying
the path to jar before the .java file, but still no luck.
From what you posted, everything seems correct. You can try to rename .jars to simply "jars". Maybe that's causing the trouble. Also, double-check that in your tool.jar there is a directory structure like this: /pckg/name/ClassToImport.class
Joined: Jun 02, 2010
Thanks worked it out. After first checking the directory structure inside the jar, I had downloaded a newer version of the tool.jar and the structure now had an extra parent folder.