• 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

Java application does not run on other computers

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the extract option first; it is easier to handle a single .jar file if possible.
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry not to be able to help any more
 
reply
    Bookmark Topic Watch Topic
  • New Topic