• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Imbedded jar file

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application packaged as a jar file, and it uses two other jar files when it runs.
I get it to work with no problem when I add the "Class-Path" header into
the manifest file as follows:
Class-Path: firstFile.jar secondFile.jar
In this scenario, the jar files are located in the same directory as the
jar that I am envoking.
Is there a way for me to place these jars inside of the jar that I am envoking and get it to run?
When I put them inside of my executable jar, the files cannot be found, and I get infamous "java.lang.NoClassDefFoundError" error.
How can I get the classpath to reach into the executable jar?
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Terrence,
If the classpath is set to smthg like blahblah;.; then it will check the current directory also for the classes. Do let me know if ur classpath includes "."
Regards,
Vinod.

Originally posted by Terrence White:
I have an application packaged as a jar file, and it uses two other jar files when it runs.
I get it to work with no problem when I add the "Class-Path" header into
the manifest file as follows:
Class-Path: firstFile.jar secondFile.jar
In this scenario, the jar files are located in the same directory as the
jar that I am envoking.
Is there a way for me to place these jars inside of the jar that I am envoking and get it to run?
When I put them inside of my executable jar, the files cannot be found, and I get infamous "java.lang.NoClassDefFoundError" error.
How can I get the classpath to reach into the executable jar?

 
Terrence White
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to package all of the jar files that the program needs into one jar.
As it stands now (I do have the dot in the CLASSPATH), it is searching the current direcory, but I need it to look into the executable jar file, not the current directory.
Thanks,
Terrence
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Terrence, see if something towards the end of the Creating an Executable JAR thread doesn't help you out.
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic