aspose file tools*
The moose likes Java in General and the fly likes Java installer file (.EXE) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java installer file (.EXE)" Watch "Java installer file (.EXE)" New topic
Author

Java installer file (.EXE)

gong pex
Ranch Hand

Joined: Oct 27, 2011
Posts: 41
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

Joined: Jul 14, 2010
Posts: 754

You can create an executable jar that will run when you double click it.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

Or you can distribute your application over the network using Java Web Start.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rumesh Eranga
Ranch Hand

Joined: Jan 26, 2011
Posts: 33
Use "Exe4j" software.. Hope it helps
gong pex
Ranch Hand

Joined: Oct 27, 2011
Posts: 41
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

Joined: Oct 27, 2005
Posts: 19541
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
No longer a “beginning” question. Moving.
gong pex
Ranch Hand

Joined: Oct 27, 2011
Posts: 41
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

Joined: Oct 01, 2011
Posts: 41

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
Bartender

Joined: May 31, 2011
Posts: 1776
@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

Joined: Oct 27, 2011
Posts: 41
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
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

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

Joined: Oct 27, 2011
Posts: 41
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Oct 27, 2011
Posts: 41
I understand what Paul meant,

Thanks for answer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java installer file (.EXE)
 
Similar Threads
JAR to EXE
how to refer a jar outside executable in desktop application?
tomcat disappearing
Question about Installer exe
How to convert java file to .exe file.