Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java installer file (.EXE)

 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

Can I create installer or .EXE file using java pogram?

for example if I had create "Hello world file" in java,

when I clicked on computer it will display "hello world.." on window

please tell me

Thank you
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create an executable jar that will run when you double click it.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can distribute your application over the network using Java Web Start.
 
Maneesh Godbole
Saloon Keeper
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gong pex wrote:Can I create installer or .EXE file using java pogram?

If you go the exe route your application will be limited only to the windoze OS. The correct way is to have a self executable jar or JWS as suggested.
 
Rumesh Eranga
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use "Exe4j" software.. Hope it helps
 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:You can create an executable jar that will run when you double click it.


I had create .jar file, but when I double click it, windows alert appear and it written: "A Java Exception has occurred"

so, what's wrong?

(about .EXE thank's for reply I'll try it later)

please answer me

Thank you
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open a command line window, go to the directory where your JAR file is located at, and execute java -jar XXX.jar. This will show you the exception stack trace that's being suppressed when you double click the JAR file.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50258
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No longer a “beginning” question. Moving.
 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:No longer a “beginning” question. Moving.


I had tried it, but it still cannot,

here the results :

D:\javacourse>java -jar HelloWorldSwing.jar
Exception in thread "main" java.lang.NullPointer.Exception
at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


please tell me the mistake.

Thank you
 
Adam Cripps
Ranch Hand
Posts: 41
Eclipse IDE Linux Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?

You do this by including a manifest.txt file which holds an entry like this



Source [0]

This is one way of setting the entry class. You can also do it when you create the jar file. When you pass e when creating the jar file, it points to the entry point in your application:



Hope that helps.

[0]: http://download.oracle.com/javase/tutorial/deployment/jar/appman.html
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Gong - Did you copy the Exception the same way. I see a "." between the NullPointer and Exception strings. Was the line of code that created listed in the trace?
Exception in thread "main" java.lang.NullPointer.Exception
 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?

You do this by including a manifest.txt file which holds an entry like this



Source [0]

This is one way of setting the entry class. You can also do it when you create the jar file. When you pass e when creating the jar file, it points to the entry point in your application:



Hope that helps.

[0]: http://download.oracle.com/javase/tutorial/deployment/jar/appman.html




I had create it on notepad like this:



later I save it using name "JHomeView.txt" file and

I put it into "jar file" using command:



That's all that I have do

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gong pex wrote:
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?

You do this by including a manifest.txt file which holds an entry like this


I had create it on notepad like this:




I think it may be important that Adam suggested your manifest should contain a "Main-Class" entry, but your manifest doesn't. It contains a "Main-class" entry, which might well be considered as different. Unless perhaps case isn't significant -- the tutorial would certainly say so, if that's the case. Does it?
 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
gong pex wrote:
Adam Cripps wrote:I am also working on jar files with my application. As far as I understand it, the JVM needs to know which class holds the main method. Have you done this?

You do this by including a manifest.txt file which holds an entry like this


I had create it on notepad like this:




I think it may be important that Adam suggested your manifest should contain a "Main-Class" entry, but your manifest doesn't. It contains a "Main-class" entry, which might well be considered as different. Unless perhaps case isn't significant -- the tutorial would certainly say so, if that's the case. Does it?


I had tried to repair based on Adam's advice but the results still same, I don't know what I must do
___________________________________________________________________________________

Today I had tried to convert .java file to .exe file using iexpress

because I had despair to tried using .jar (because always failed)

but the results it's same too, even my computer is stuck,

can someone tell me how to convert it?(I hope I can use free software)

Thanks
 
Tim Moores
Bartender
Posts: 2954
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that mean you tried to fix it along the lines of what Paul suggested, or does that mean you determined that that would not make a difference?
 
gong pex
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand what Paul meant,

Thanks for answer
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic