• 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

Problem with executable jar file

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all,
I have a jar file named result.jar and it
has a manifest file which has the following entry:
Main-Class: package.className
Class-Path: dependent1.jar dependent2.jar dependent3.jar
As long as all the jar files are in the current directory, the executable jar works fine.
java -jar result.jar
Say all these jars are in the directory
d:\DIRECTORY_1

Now if i move over to say
c:\
and then do
java -jar d:\DIRECTORY_1\result.jar
it works fine.
This is bcos it picked up the dependent jars from d:\DIRECTORY_1.
1. Now I tried moving result.jar (only) to c:\
2. Set the classpath to point to the dependent jars residing in
d:\DIRECTORY_1 folder,
did a
c:\ java -jar result.jar
i got class not found exceptions from result.jar!
It was expecting to find the dependent jars in c:\!
the classpath setting was ignored.
This has left me pretty confused.
Any inputs??
Can i conclude that the classpath does'nt work in case of jars referring to other jars from within?? :-(.
All the depenedent jars have to be in the same folder as the first guy? PLease correct me.
thanks,
karthik.

thanks
karthik.
reply
    Bookmark Topic Watch Topic
  • New Topic