• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CLASSPATH strange behaviour

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have a jar in which is my application and a jar with dom4j;

I try to start my application as bellow:

java -classpath ./lib/dom4j-1.6.1.jar -jar httpclient.jar checkupdate

I get this exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/Branch
at com.httpclient.main.MainHttpClient.checkForUpdates MainHttpClient.java:87)
at com.httpclient.main.MainHttpClient.main(MainHttpClient.java:26)

If I use this line it works

java -classpath ./lib/dom4j-1.6.1.jar;httpclient.jar com.httpclient.main.MainHttpClient checkupdate

In the Manifest of the jar file the main class is correctly specified.
I looked inside dom4j-1.6.1.jar and the reported missing class is there.

I want to use relative paths.

Have anyone encountered this problem?

Thanks
[ June 29, 2006: Message edited by: David O'Meara ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried adding jdom to the classpath entry in the manifest file?

By the way, writing in capitals is considered 'shouting' and some people get upset easily. In any case it reduces you chance of an answer, not increases it.

thanks,
Dave.
 
Ioan Berciu
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Dave!
That solved it.

You are right about the shouting.

Thanks again.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the -jar switch implies that the -classpath switch is ignored.
You'll almost certainly find a bazillion references to this on google, and perhaps one or two in the JAR File Specification
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic