NoClassDefFoundError when creating instance of Server

This is a JDOM issue but I am new to using java on the command line.

I was able to compile all classes using

I have all files in one dir, along with my jdom.jar

javac -classpath "./jdom.jar" *.java

I then ran rmic -v1.2 ServerName

And the stubs are created.

But when I try to run my Regester class

java RegesterIt[or]java -classpath "./jdom.jar" RegesterIt

I get the following error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/jdom/JDOMException

at RegesterIt.main(RegesterIt.java :7)

Line 7 is where I create the instance of my Server class.

I think I have issues with classpath or something but could just use some help at this point.

Everything worked fine before I brought JDOM into the mix.

[802 byte] By [mreddinga] at [2007-11-26 18:03:00]
# 1

I was able to solve this one myself with more and more searching.

While its working now Im still somewhat confused.

I added

%JAVA_HOME%\lib

to my PATH env variable in windows. Everyone tells you to add %JAVA_HOME%\bin, but without the lib dir you miss out on many of those jars. I put jdom.jar in that folder and it all works now sorta.

The really wierd part though, is I have 3 cmd windows open currently, and 1 of them runs the RegesterIt without the exception, and the other two do not. I brought all three of them up after I updated the variable.

Is that wierd? How could the cmd windows be working differently?

mreddinga at 2007-7-9 5:33:02 > top of Java-index,Core,Core APIs...
# 2

> to my PATH env variable in windows. Everyone tells

> you to add %JAVA_HOME%\bin, but without the lib dir

> you miss out on many of those jars.

Untrue. The JVM automatically loads all JARs in the lib directory, and naming a directory that contains JAR files in the PATH or CLASSPATH has no effect. You might miss out on some DLLs that those JARs depend on if they're in 'lib', but are they?

> I put jdom.jar in that folder and it all works now sorta.

The JDK or JRE lib directory is not the place to be adding external JARs to.

ejpa at 2007-7-9 5:33:02 > top of Java-index,Core,Core APIs...