This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello, Could you please tell me how to create an executable file for a java appliction. step by step instruction are much appriciated. thanks
SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Paul Zill
Greenhorn
Joined: Jun 12, 2003
Posts: 28
posted
0
can you be a bit more specific? if you just want to run a java app instead of typing it from the command line just create a shortcut and for target put in "<path to java>java <path to class file>TestApplication"
Ransika deSilva
Ranch Hand
Joined: Feb 18, 2003
Posts: 524
posted
0
Heloo, I mean if I want to give this the program to a person who doesn't know java. I should give him with an executable file. so that he can double click the icon and get the program to run hope this is more specific
Paul Zill
Greenhorn
Joined: Jun 12, 2003
Posts: 28
posted
0
well then . . . in windows you can create a batch file (.bat) which does the same thing as the shortcut. The only problem would be is if the person has java installed and their environment variables set (like a JAVA_HOME, or the jdks' bin\ directory in the path). You could circumvent this by also including the jdk with your application (it's about 46 mb for 1.4) and calling that one explicitly in your batch file.
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
Another possibility (more common) is the executable .jar file. An executable .jar file is simply a .jar file with an extra line in the manifest: Main-Class: my.main.ClassName When you double click on this .jar file, the applciation should launch(*) However, an executable .jar file IGNORES the system CLASSPATH variable. You can specify a Class path in the manifest: Class-Path: anotherJarFile.jar .. Note the capitalization and hyphenation of "Class-Path" Also note that the elements listed are relative to the location of the .jar file and not relative to the current directory or anything else. Also note that the different elements are separated by spaces, not : or ; --------------- (*) This is, of course, assuming that the JRE is correctly installed. Just include the distribution .exe with the application, and tell the client that if they don't have java already installed on the target machine, they will have to install it before running their program. I usually have the client open up a DOS prompt (or the equivelent) and type java -version. This double checks that java is installed and enables you/the user to verify that the required version is installed. There are ways to automate this for "dumb" users, but I gave my mother these instructions and she could follow them.... One other note--an executable jar file is defaulted to run with the javaw command, not the java command. This means that you won't get a DOS prompt/whatever upon double clicking, and any System.out.prinln() messages (or the equivelent) will not show up.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.