Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Java installer file (.EXE)

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create an executable jar that will run when you double click it.
 
Sheriff
Posts: 26958
84
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you can distribute your application over the network using Java Web Start.
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use "Exe4j" software.. Hope it helps
 
gong tji
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22573
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 74696
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No longer a “beginning” question. Moving.
 
gong tji
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 41
Eclipse IDE Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 tji
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 26958
84
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 tji
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 7231
169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 tji
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand what Paul meant,

Thanks for answer
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic