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

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




Java executable

2 Pages V  1 2 >  
Reply to this topicStart new topic

Java executable

reCoded
12 Jun, 2008 - 07:01 AM
Post #1

D.I.C Head
**

Joined: 25 Feb, 2008
Posts: 166

Hey guys,

I am trying to make my application that I created in Java to be an exe. I want to be able to run the application outside of Eclipse. Can someone help me out?


Thanks, reCoded
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Java Executable
12 Jun, 2008 - 07:06 AM
Post #2

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
its possible.. but I've read somewhere that its hard..

well you can make it as an executable jar file.. blink.gif and you could distribute the jar file instead..
User is offlineProfile CardPM
+Quote Post

reCoded
RE: Java Executable
12 Jun, 2008 - 07:39 AM
Post #3

D.I.C Head
**

Joined: 25 Feb, 2008
Posts: 166

Yeah that is what I am doing and it gives me the error "Can not find main class". I need some help..I add the main class at the end I dont understand this error.
User is offlineProfile CardPM
+Quote Post

mensahero
RE: Java Executable
12 Jun, 2008 - 07:40 AM
Post #4

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(reCoded @ 12 Jun, 2008 - 08:39 AM) *

Yeah that is what I am doing and it gives me the error "Can not find main class". I need some help..I add the main class at the end I dont understand this error.


where did you get that error? when double clicking the executive jar file? or when compiling? blink.gif

User is offlineProfile CardPM
+Quote Post

1lacca
RE: Java Executable
12 Jun, 2008 - 09:07 AM
Post #5

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 12 times
My Contributions
We had several threads on this, here is one, but feel free to use our search box on the top right (as you are kindly asked when opening a new topic).
Also, google for "jar to exe" should yield nice results as well.
User is offlineProfile CardPM
+Quote Post

Tom9729
RE: Java Executable
12 Jun, 2008 - 09:48 AM
Post #6

Debian guru
Group Icon

Joined: 30 Dec, 2007
Posts: 1,592



Thanked: 12 times
Dream Kudos: 325
My Contributions
http://www.dreamincode.net/forums/showtopic40425.htm

Might be helpful, there are easier ways. smile.gif
User is online!Profile CardPM
+Quote Post

mensahero
RE: Java Executable
12 Jun, 2008 - 10:02 AM
Post #7

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(Tom9729 @ 12 Jun, 2008 - 10:48 AM) *

http://www.dreamincode.net/forums/showtopic40425.htm

Might be helpful, there are easier ways. smile.gif


really nice bro.. but isn't that kind of leading java n00b.. into the wrong path.. I mean JAVA is made for a reason.. shouldn't n00bs stick with that reason.. and if we indeed want exe files.. then we should learn c++ or something.. blink.gif

That's pretty good.. but IMO It's a bad practice for n00b.. learning JAVA like me.. biggrin.gif

This post has been edited by mensahero: 12 Jun, 2008 - 10:03 AM
User is offlineProfile CardPM
+Quote Post

reCoded
RE: Java Executable
12 Jun, 2008 - 12:21 PM
Post #8

D.I.C Head
**

Joined: 25 Feb, 2008
Posts: 166

I would love to do this in C# or C++ but when you work for someone you have to do it their way or the high way. I am not the greatest in Java but I have done my fair share of time with it. I wouldnt consider myself a noob, but not a pro either.

I figured out why I couldnt get it to work when I tried to create it as a jar file.

To reply to mensahero, Yes the application compiles fine in eclipse. It just didnt work when I double clicked the jar file. I recieved that error. But all is good now. Thanks for all the help and to those that responded.

reCoded
User is offlineProfile CardPM
+Quote Post

pbl
RE: Java Executable
12 Jun, 2008 - 03:03 PM
Post #9

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(reCoded @ 12 Jun, 2008 - 01:21 PM) *

I would love to do this in C# or C++ but when you work for someone you have to do it their way or the high way. I am not the greatest in Java but I have done my fair share of time with it. I wouldnt consider myself a noob, but not a pro either.

I figured out why I couldnt get it to work when I tried to create it as a jar file.

To reply to mensahero, Yes the application compiles fine in eclipse. It just didnt work when I double clicked the jar file. I recieved that error. But all is good now. Thanks for all the help and to those that responded.

reCoded

To have a .jar executable file to work you need a manifest.mf file in your .jar that says which class containing public static void main(String[] arg)

File manifestEuroStyle.mf:
CODE

Main-Class: ca/pblinc/eurostyle/EuroStyle


and your jar command should specifies that manifest file

jar -cmf0 manifestEuroStyle.mf EuroStyle.jar ca org common jxl

note the "m" that specifies that the first parameter is the name of the manifest file

This post has been edited by pbl: 12 Jun, 2008 - 06:15 PM
User is online!Profile CardPM
+Quote Post

mensahero
RE: Java Executable
12 Jun, 2008 - 06:11 PM
Post #10

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE(reCoded @ 12 Jun, 2008 - 01:21 PM) *

I wouldnt consider myself a noob, but not a pro either.


blink.gif .. lmao.. Am I the only n00b left in JAVA.. :sigh: .. :lmao: ..

well good thing you got it sorted out.. goodluck bro.. biggrin.gif

User is offlineProfile CardPM
+Quote Post

pbl
RE: Java Executable
12 Jun, 2008 - 06:14 PM
Post #11

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(mensahero @ 12 Jun, 2008 - 07:11 PM) *

QUOTE(reCoded @ 12 Jun, 2008 - 01:21 PM) *

I wouldnt consider myself a noob, but not a pro either.


blink.gif .. lmao.. Am I the only n00b left in JAVA.. :sigh: .. :lmao: ..

well good thing you got it sorted out.. goodluck bro.. biggrin.gif


Mensahero

English is not my mother tongue, neither is Malaysian
so what does "Imao" means ?
User is online!Profile CardPM
+Quote Post

mensahero
RE: Java Executable
12 Jun, 2008 - 06:18 PM
Post #12

c0mput3rz Are Only Human
Group Icon

Joined: 26 May, 2008
Posts: 664



Thanked: 17 times
Dream Kudos: 75
My Contributions
QUOTE


Mensahero

English is not my mother tongue, neither is Malaysian
so what does "Imao" means ?


Same here.. English is also not my mother tongue.. LMAO.. is like LOL..

"Laughing My Ass Out"... I've just developed a bad habit of using it rather than LOL.. IDK why.. blink.gif

This post has been edited by mensahero: 12 Jun, 2008 - 06:20 PM
User is offlineProfile CardPM
+Quote Post

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:09PM

Be Social

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

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month