Home arrow static arrow Java Programming [Archive] - window xp classpath can't find jar issue
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - window xp classpath can't find jar issue
This topic has 18 replies on 2 pages.    1 | 2 | Next »

Posts:110
Registered: 12/31/03
window xp classpath can't find jar issue  
Jun 17, 2004 10:39 AM



 

command prompt:
java -jar ironeyesql.jar

I am trying to get IronEye working on my comp but when I try and run the client, the following error occurs:

Exception in thread "main" java.lang.NoClassDefFoundError: com/incors/plaf/kunststoff/KunststoffLookAndFeel

ok, that means java can't find my knunststoff.jar. I added the lib directory (this contains knunststoff.jar as well as all the other jars that I will need to run this exe jar) to my classpath "C:\...\lib;". I still got the same error so for an experiment I add the knunststoff.jar to my "C:\...\java\jre\lib\ext" directory. When I did this it was able to find the class file needed, but then gave me another NoClassDefFoundError while trying to look for another class in a different jar located in my lib directory.

I do not want to add all the jars to my magic dir (...\java\jre\lib\ext) because thats dumb. You can set your classpath to include a dir and it should pick up all the jars within that dir....right???

Any suggestions? Thanks in advance
 

Posts:1,183
Registered: 1/23/02
Re: window xp classpath can't find jar issue  
Jun 17, 2004 10:51 AM (reply 1 of 18)



 
You need to add each JAR file explicitly to the CLASSPATH, not just the directory it's in.

All JARs unser $JAVA_HOME/lib/ext are automatically accessible, but putting everything there is not a good solution.
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 10:51 AM (reply 2 of 18)



 
java -jar option ignores the classpath. The classpath for -jar option is expected to be specified by the jar's manifest.mf file. Why you're trying to get some 3rd-party jar's main class to run and magically reference YOUR classes is beyond me - seems like YOU should create a main class and have YOUR manifest file point to the 3rd-party's.
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 10:58 AM (reply 3 of 18)



 
Why you're trying to get some 3rd-party jar's main class to run and magically reference YOUR classes is >beyond me - seems like YOU should create a main class and have YOUR manifest file point to the 3rd->party's.

I am not trying to get some 3rd parties jar's main class to reference my classes. I am trying to get some 3rd parties jar's main class to see other 3rd party jars

should I unjar their jar and make sure the manifest file is correct?
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:02 AM (reply 4 of 18)



 
Why you're trying to get some 3rd-party jar's main
class to run and magically reference YOUR classes is
beyond me - seems like YOU should create a main class
and have YOUR manifest file point to the 3rd->party's.

I am not trying to get some 3rd parties jar's main
class to reference my classes. I am trying to get some
3rd parties jar's main class to see other 3rd party
jars

should I unjar their jar and make sure the manifest
file is correct?

Oh, the KunststoffLookAndFeel class is another 3rd-party dependent class?
Don't unjar it, just open it up in WinZip (or equivalent) and inspect the manifest file. If it is referencing knunststoff.jar it is likely expecting it to be in the same folder as ironeyesql.jar
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:03 AM (reply 5 of 18)



 
You need to add each JAR file explicitly to the CLASSPATH, not just the directory it's in

I added the jar to my classpath but I still get the same error???
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:04 AM (reply 6 of 18)



 
Oh, the KunststoffLookAndFeel class is another
3rd-party dependent class?
Don't unjar it, just open it up in WinZip (or
equivalent) and inspect the manifest file. If it is
referencing knunststoff.jar it is likely expecting it
to be in the same folder as ironeyesql.jar

And if it's not referencing it, then maybe you're not supposed to be running it "as a jar" (with the -jar option) but rather are just supposed to stick both jars in your classpath and create an app which uses it/them.
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:04 AM (reply 7 of 18)



 
You need to add each JAR file explicitly to the
CLASSPATH, not just the directory it's in

I added the jar to my classpath but I still get the
same error???

Right, because like I said, the -jar option ignores the CLASSPATH environment variable or explicit -classpath command-line option.
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:05 AM (reply 8 of 18)



 
Oh, the KunststoffLookAndFeel class is another 3rd-party dependent class?

Yes. I'll look in the manifest and tell you what I find,
Thanks
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:08 AM (reply 9 of 18)



 
Manifest-Version: 1.0
Class-Path: lib/commons-pool.jar lib/jakarta-regexp-1.2.jar lib/janino .jar lib/jce-jdk13-112.jar lib/jcommon-0.7.1.jar lib/jdom.jar lib/jfreechart-0.9.4.jar lib/kunststoff.jar lib/layout.jar lib/log4j-1.2.8.jar lib/nanoxml-ax.jar lib/nanoxml.jar lib/p6spy.jar lib/sax2-ext.jar lib/sax2.jar log4j-1.2.8.jar
Created-By: 1.4.1_02-b06 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.5.3
Main-Class: com.irongrid.monitor.ui.swing.Console

It looks correct to me...but I am definatley not an expert!
 

Posts:31,095
Registered: 4/30/99
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:17 AM (reply 10 of 18)



 
(this contains knunststoff.jar...)

But the manifest is looking for kunststoff.jar.
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:19 AM (reply 11 of 18)



 
Manifest-Version: 1.0
Class-Path: lib/commons-pool.jar
lib/jakarta-regexp-1.2.jar lib/janino .jar
lib/jce-jdk13-112.jar lib/jcommon-0.7.1.jar
lib/jdom.jar lib/jfreechart-0.9.4.jar
lib/kunststoff.jar lib/layout.jar
lib/log4j-1.2.8.jar lib/nanoxml-ax.jar lib/nanoxml.jar
lib/p6spy.jar lib/sax2-ext.jar lib/sax2.jar
log4j-1.2.8.jar
Created-By: 1.4.1_02-b06 (Sun Microsystems Inc.)
Ant-Version: Apache Ant 1.5.3
Main-Class: com.irongrid.monitor.ui.swing.Console

It looks correct to me...but I am definatley not an
expert!

Ok, so then the kunststoff.jar simply needs to be in a subfolder named 'lib' (hence lib/kunststoff.jar)
relative to where your ironeyesql.jar is.
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:20 AM (reply 12 of 18)



 
That was a typo the jar is actually named: "kunststoff.jar", sorry
 

Posts:19,725
Registered: 9/26/01
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:20 AM (reply 13 of 18)



 
(this contains knunststoff.jar...)

But the manifest is looking for kunststoff.jar.

Yeah, that too if it wasn't a typo.
 

Posts:110
Registered: 12/31/03
Re: window xp classpath can't find jar issue  
Jun 17, 2004 11:32 AM (reply 14 of 18)



 
alright I unjar it made sure the manifest file contained all the jars (with the right spelling...once again sorry about that). Then I jar'ed it up and still get the same error...I am at a loss as to what to try, any suggestions?
 
This topic has 18 replies on 2 pages.    1 | 2 | Next »