Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating a JAR file

 
Ted Jaskot
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom,
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:
here

You can also find the naming policy here:
http://www.javaranch.com/name.jsp
Thank You!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic