Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

make java class files into exe

Posted on 2003-11-11
6
Medium Priority
?
547 Views
Last Modified: 2013-11-23
hi,
       i want to run my java application to run when i clicked it. i want to make the java class files in to exe file.i want  to know the procedure for creating the jar and manfiest file.
tell me what should be in the manfiest file
thank u
0
Comment
Question by:deeppradeep
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9724763
You don't want an exe file

Just an executable jar file

manifest should read:

Main-Class: MainClass
Classpath: whatever

Replacing MainClass, and whatever with your class and classpath
0
 
LVL 2

Accepted Solution

by:
SuperKarateMonkey earned 60 total points
ID: 9725050
TimYates is right, you don't really want to to compile to an .exe file.  It loses you all platform independence, and in most cases will also lose you alot of the cool things java can do, such as dynamic class loading.  The vastly superior option is to create an executable jar file the way Tim just described, and then go through the control panel:

Folder Options --> File Types --> Executable Jar File --> Advanced --> Select, (or create,) the 'open' command -->

and then under the field "Application used to perform action," put in this:

"C:\Program Files\Java\j2re1.4.1_01\bin\java.exe" -jar "%1" %*

Although the exact location of your java.exe file might change depending on where you installed java, and which version you're using.  You'll have to locate the JRE directory on your own.
0
 
LVL 15

Expert Comment

by:Javatm
ID: 9726047
This steps will help create a good jar file :
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20774096.html

Hope this helps . . .
JAVATM
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:illucid
ID: 9727588
or you could download this..

http://www.javaapis.com/execjava/

..if you want an exe that runs a java app
0
 

Author Comment

by:deeppradeep
ID: 9755019
i had created the manifest file test.tmp
Main-Class : test

where test is my simple program not in a GUI.
it will only print the message "my first program" in the command window
i had created test.jar file also
and when i run the jar file in the command promt
java -jar test.jar
then it give error message "main class name not loaded"

what is this and how can i run this???
0
 
LVL 15

Expert Comment

by:Javatm
ID: 9783994
How did you do it :

Make sure that you are in your base directory then try this
c:\jdk1.4.2\javac\bin\jar Filename.jar manifest.tmp *.class

Also make sure that when you use this :
java -jar test.jar

Your are at your base directory & make sure that
test is your main class.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question