This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Issue with adding Jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Issue with adding Jar files" Watch "Issue with adding Jar files" New topic
Author

Issue with adding Jar files

Benoy John
Greenhorn

Joined: Feb 16, 2013
Posts: 2
Hi,

I have been trying to add the 'org.apache.poi' jar files to run a program to convert excel files to csv files. I read up on some articles and downloaded 'poi-bin-3.9-20121203.zip' and extracted it to C:\. I added the individual jar files to my ClassPath and tried running the program. I keep getting the error 'org.apache.poi.hssf.usermodel' does not exist. Could anyone please help me in understanding how to extract and add the jar files porperly? I am not using any IDEs and am running javac from my Windows command prompt.

Thanks in advance,
Benoy
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1977
    
    7

You should the classpath flag in javac

javac -cp c:\poi.jar YourJava.java

Then try running it also need to specify classpath

java -cp c:\poi.jar YourClass

Then for jar creation

jar cfm YourJarName.jar YourClass.class poi.jar manifest.txt

In the manifest text specify the main class.



K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
Benoy John
Greenhorn

Joined: Feb 16, 2013
Posts: 2
Thanks Tsang. Worked perfectly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue with adding Jar files
 
Similar Threads
JAR file runs when double-clicked, but not via Task Scheduler?
Works through Jdeveloper not through Console
Adding external JARs
Help resolving my NoClassDefFoundError
Problem with the use of external library from a jar archive