Java School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a Java Expert!

Join 306,824 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,759 people online right now. Registration is fast and FREE... Join Now!




how to convert a java program into an exe

 

how to convert a java program into an exe

mdew_47

3 Nov, 2008 - 07:06 AM
Post #1

New D.I.C Head
*

Joined: 2 Aug, 2008
Posts: 42

i have done my project in java and C bridgeing through JNI, now it is asked that i give my project a complete software look, so that i could start it "just by clicking the icon with a mouse". is that possible?

i have many sites but everywhere i got it is not possible. If it is possible can any body show me the way please.

User is offlineProfile CardPM
+Quote Post


mdew_47

RE: How To Convert A Java Program Into An Exe

3 Nov, 2008 - 07:16 AM
Post #2

New D.I.C Head
*

Joined: 2 Aug, 2008
Posts: 42

to have a glance at my project you could go to the compiler topic in both java and c forum.
User is offlineProfile CardPM
+Quote Post

mdew_47

RE: How To Convert A Java Program Into An Exe

3 Nov, 2008 - 07:31 AM
Post #3

New D.I.C Head
*

Joined: 2 Aug, 2008
Posts: 42

i have done all this:

create manifest file

in that manifest file you have to mention your main class name like below.

Manifest-Version: 1.0
Specification-Title: Java Utility Classes
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: mainclassname(project)

and save it as manifest.mf and keep this file in project location.

and then you have to run the following command in DOS prompt

(go to projetlocation via command prompt)
jar cmf manifest.mf filename.jar *.*



but it is giving file not found exception and also the native method that i am using not found.
User is offlineProfile CardPM
+Quote Post

mdew_47

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 03:16 AM
Post #4

New D.I.C Head
*

Joined: 2 Aug, 2008
Posts: 42

no help yet?
User is offlineProfile CardPM
+Quote Post

mdew_47

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 04:09 AM
Post #5

New D.I.C Head
*

Joined: 2 Aug, 2008
Posts: 42

i have solved my problem, i have been able to create an executable jar file.
User is offlineProfile CardPM
+Quote Post

lordms12

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 07:10 AM
Post #6

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 335



Thanked: 26 times
Dream Kudos: 250
My Contributions
If you are using IDE you will sure find something like "export to jar" just by simple clicks you will create the jar, then you could use programs like jar2exe or lanuch4j to convert this jar to exe

This post has been edited by lordms12: 4 Nov, 2008 - 07:12 AM
User is offlineProfile CardPM
+Quote Post

BigAnt

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 08:10 AM
Post #7

May Your Swords Stay Sharp
Group Icon

Joined: 16 Aug, 2008
Posts: 2,391



Thanked: 100 times
Dream Kudos: 75
My Contributions
Also in the manifest file if your program needs to reference any external jar files you to add the Class-Path header.
Also if you want to create a desktop shortcut you can do this by right clicking on the desktop and in the new menu click shortcut. Specify the jar file in the field provided, and click next and enter the name ten click finish. Then you need to right click on the shortcut and click properties. In the target box is the name of the jar file. You must specify the command to run the file here. The command would be something like:
"<dir-Path>/javaw.exe" –jar "<jar-File>"

where <dir-Path> is the path to the java bin directory and <jar-File> is the jar file to run.
User is offlineProfile CardPM
+Quote Post

bbq

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 10:52 AM
Post #8

omgwtfbbq
Group Icon

Joined: 15 May, 2008
Posts: 768



Thanked: 71 times
Dream Kudos: 125
My Contributions
you could always have a batch file in the same directory....

say your file is not a .jar but a .class and you have Main.java ( Main.class after compliling) well you could create a batch file
CODE

java Main


and save it as anything.bat then once u can just double click on the file and it will open cmd and execute the command.
User is offlineProfile CardPM
+Quote Post

pbl

RE: How To Convert A Java Program Into An Exe

4 Nov, 2008 - 05:11 PM
Post #9

Java Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 9,962



Thanked: 1187 times
Dream Kudos: 450
My Contributions
QUOTE(mdew_47 @ 4 Nov, 2008 - 04:09 AM) *

i have solved my problem, i have been able to create an executable jar file.

Wouldn't call a .jar as an executable.... your topic title is misleading
as Lordms mentionned their are a few programs in the web. I personnaly use Exe4J since years without problem (more than 2 thousand deployments)
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/20/09 10:36PM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month