This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello, I have a very strange problem. I have an application that I have packaged into an executable jar file. The installation of the application is very easy, just copy the executable jar along with a couple of jar reources into a directory and then run the app by double clicking the executable jar. Now this is the problem I have run into. On one machine, the application behaves differently. First off, the sorting of items in a JComboBox differs from that of an installation of the same code on another machine. Furthermore a method that is called is not found, I get a NoSuchMethod exception. The OS is the same (win2000), the jre is the same (1.3.1, installed from the same install file on all machines) and my classes and the resources are all the same on all the machines I have installed on. How on earth can the application behave differently on one of the machines?
You could have something in the classpath of the machine on which it works that is not on the other machine. When a jar file executes, it still uses thet system classpath to load classes that are not contained in the jar file. If the machine on which it works is your development machine, it would be very easy to have forgotten to include a couple important things in the jar file. Also, on a side note, it is usually better to include resources inside the jar file rather than requiring that they be copied along with it. Programs can accesses resources such as images, propery files, help documents, and web pages that are stored in a jar file along with the program. http://java.sun.com/j2se/1.3/docs/guide/resources/
Joined: Nov 22, 2008
Thank you for your reply. The resources I need to use along with my own classes are other jar files used for IIOP communication. The classpath for my app is included in the manifest file I used when putting together my jar. The app installs just fine on other machines than my development machine, it's just this one machine where it won't run properly. I have installed the application successfully on five other machines by first installing a jre and then copying my files to the machine. I don't use an external classpath or the jre/lib/ext directory.