Solved

make java class files into exe

Posted on 2003-11-11
6
515 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 20 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now