Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

make java class files into exe

Posted on 2003-11-11
6
529 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javap bin 2 40
jsp login check 12 42
how to debug htl and js pages 8 38
Bot application - advice 3 38
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

839 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