• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems running jar file

 
D Slevin
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't when you move the jar file away from where the manifest says the jar files are...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic