• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java application does not run on other computers  RSS feed

 
Antonio Costa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wrote two classes: one for the GUI and another for the handler.

The application starts within the eclipse IDE (Ganymed) and packed as runnable jar-file on my own machine (Windows Vista, jre 1.6.0_14) without problem. Even starting the application from a shared device it works fine - for me!

I asked some collegues to give it a try, they all can start the application, but not execute the main method.

Since there are some necessary third party libraries, I packed them into the jar fiile. I wonder why it works for me and not for others. Who can give me hints where to search within code or project configuration in eclipse?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't package jar files within jar files. You either need to distribute them separately (and then use appropriate entries in the manifest to point to them), or repackage *all* required classes and libraries into a single jar file. There are tools out there that can do that for you.
 
Antonio Costa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

within eclipse I have three options:
- Extract required libraries into generated JAR
- Package required libraries into generated JAR
- Copy required libraries into a sub-folder next to the generated JAR

If I understand you right, the second option is to avoid. The first and third options are to prefer, right?
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the extract option first; it is easier to handle a single .jar file if possible.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use eclipse
But following simple way also works

copy all your dependecy libaries to a folder lib
compile all your classes and copy to a folder say XYZ ( you can paste all of eclipse build directory)

add MANIFEST.MF in META-INF folder, at root structure of your jar ( right inside XYZ)

add following contesnt MANIFEST.MF

Main-Class: com.abc.xyz.MAINCLASS
Class-Path: lib/adv-display-common.jar lib/xyz.jar ---- (it is space separated)

now zip the contents of xyz ( not xyz folder,its content) using win-rar or zip, but give extention JAR


use following java -jar JARFILENAME to run it.

It works on eclipse because all the dependencies are in classpath...



 
Antonio Costa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell, hi Pratap,

I've tried each possible combination without success.

Thanks for your help.

So long.
Antonio
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry not to be able to help any more
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!