File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Creating a JAR file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Creating a JAR file" Watch "Creating a JAR file" New topic

Creating a JAR file

Ted Jaskot

Joined: Apr 26, 2002
Posts: 1
Hi Guys;
I am a Java "Greenhorn", I am trying to create a JAR file for the first time and I am having some problems. I was successful in creating a package. I had to use the SET CLASSPATH so that my package could be found. I then tried the next step to create a JAR file. I compressed the directory structure and the .class files with no problem. I then moved the .JAR file into the jre/lib/ext directory. I can compile with no problem, it's when I run the application and try to instantiate a class from my JAR file that I get a "NoClassDefFoundError". The book I have said that you can take out any reference to the JAR file in your class path and that putting the JAR file in the jre/lib/ext directory will make it visible. My question is where or what am I doing wrong???
[ April 26, 2002: Message edited by: Ted Jaskot ]
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
do you have multiple versions of the JDK installed, If so, when you run "java" you may not be running the version you think you are, or the version where you've copied your jar.
First make sure your jar actually works by including it manually in the classpath. Then check the version of java you are running by typing
java -version
at the command prompt. Make sure it's the same version in which you copied your .jar file to the ext directory.
Also, please change your name to comply with the naming policy which you agreed to when you registered here..

For your publicly displayed name,
use a first name, a space, and a last name.

You can change your name here:

You can also find the naming policy here:
Thank You!

SCJP 1.4
I agree. Here's the link:
subject: Creating a JAR file
It's not a secret anymore!