This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Problems running jar file

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

I've created a jar file and when I double-click it within the folder in which it is created, it works fine. I added my own manifest file so that I could specify the main class to be run and the class path
for the various jars I've needed to include. When I copy the jar file to the Desktop and run it there, it runs but the images are missing and I cant use the other jar files that I need. Has anyone encountered this problem before?

Any help would be appreciated.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you define the classpath in the jar?
 
D Slevin
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I defined it within the Manifest file (Manifest.txt) as follows:

Main-Class: Gui
Class-Path: extra-jar-files/PDFBox-0.7.3.jar extra-jar-files/some_other_jar.jar

I had to include a number of jar files and I defined them on separate lines preceded by a space. The extra-jar-files folder is located in the same folder as the class files.
It works if the jar is run in that folder, but if I try to run it on another folder it cant find the jar files or the images needed by the GUI.
 
D Slevin
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that the GUI is looking for the extra jar files in the path relative to the one that the jar is run in. Is there a way to create a jar file
so that it checks the folder extra-jar-files for those extra jars?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure--use a path that resolves to where the jars are.
 
D Slevin
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do, but I need to be able to run the jar file on another computer and that's
what Im having trouble with.

Anyways, thanks for the help.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't when you move the jar file away from where the manifest says the jar files are...
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic