• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

convert java application to exe file

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can any body tell how to create java application to exe file?


thanks in advance
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create the setup.exe file for a java application using some tools like installshield, installJammer, installanywhere. But these softwares are not freeware.

And one more problem is like, the user who installs your java application should have the JRE. So its not applicable in small applications.

Example, I have created one Calculation application. Only one class is there that extends JFrame and has implementation for basic calculation process. The whole application size will be less than 500 KB. But to run this, one needs a JRE. So you have to keep this JRE file along with your application for installation.

So if you will see logically, why an user will agree to install a JRE of more than 70 MB for an application of size 500 KB.


Regards,

Sanjay Kumar
 
Sheriff
Posts: 22781
131
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

Sanjay KumarB wrote:You can create the setup.exe file for a java application using some tools like installshield, installJammer, installanywhere. But these softwares are not freeware.


Inno Setup and NSIS are, and can do the same.

But you are right, Java code can (as far as I know) not be compiled into real native code on Windows*, and so it will always require a JVM installed on the system.


* For Linux you have GCJ which has ported a subset of the core API to native code. It lacks a lot of user interface code (from Swing mostly) though.
 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why do you want to convert it into an exe file ??? by converting it you are just making it unportable in my opinion.
compress the byte code of your application in a jar file and it can be executed just by clicking over it twice (if you have installed the jre ).

otherwise you can use one of above mentioned jar to exe converters.
avi sinha

 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we created jar file it will like winzip format if we double click can any body tell how to create jar file if we click the jar file our application will run?



thanks in advance
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vijayakumar durai wrote:we created jar file it will like winzip format if we double click can any body tell how to create jar file if we click the jar file our application will run?
thanks in advance



there is no any difference in the command which is used to create a jar file. it depends upon the application being used to open it.
many compressing tools like winRar , winZip etc consider a jar file as a compressed file .( its correct) but it can be executed by executing it using java runtime file .

How to run a Jar file

avi sinha
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have created jar file Myjar.jar if i run in dos prompt java -jar Myjar.jar it execute application when i double click jar file it will open in notepad. i need if i double click the jar file application will run is there any software need what i have to do ?









thanks in advance
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

when i double click jar file it will open in notepad. i need if i double click the jar file application will run is there any software need what i have to do ?


You need to associate one of the JVM executables with jar files, probably java.exe or javaw.exe. This normally happens during JVM installation; maybe the setting got changed up later.
 
Greenhorn
Posts: 3
Firefox Browser Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the Fat Jar Eclipse Plug-In (avaliable on this page) to generate an executable jar file and run your program with double click
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Road Bike, please check your private messages.
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have changed jar file to open applcation in java setting mycomputer->tools->folderoptions->filetypes->jar file in this path i click the change and set the jdk->javaw.exe .if i double click the jar file .i got error couldnot find main class program will exit . i am not able to run in dos prompt also

can any body tell how to associate jvm with jar file?
 
Rob Spoor
Sheriff
Posts: 22781
131
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
What's in your manifest file? Also, unfortunately, javaw shows this message for any exception thrown by the JVM. The problem may be something completely different. Try running the JAR file from the command line: That will show you exactly what is going wrong.
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i will explain full details of what i done


i have created Manifest.txt


MyClass.java


then i create jar file

jar cvfm myjar.jar Manifest.txt *.class

now i can able run in dos prompt

if i am double click jar file. i got error couldnot find main class program will exit can any body tell how to associate jre with jar file
















 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this Java™ Tutorials page help? Did you enter new line after the main class name?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i checked ftype in dos prompt

D:>assoc .jar
.jar_auto_file

D:>ftype jar_auto_file

jar_auto_file=%SystemRoot%\32\NotePad.exe %1

i got notepad but i need javaw.exe


can anybody tell how to change association for jar file?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i am setting jar open file path like"C:/sun/jdk/bin/javaw" like i dont have advance option anybody tell what i have to do?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anybody tell what i have to set at the installation of jdk?
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vijayakumar durai wrote:can anybody tell what i have to set at the installation of jdk?

As far as I know, nothing unusual.
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks friends i got
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use native compilers but produced applications are native and there are a lot of problems with debugging.
(http://www.geocities.com/SiliconValley/Lakes/6686/jcomp.html#native)

My advise is to use exe that launches java virtual machine. These are tools similar to javaw application, which contain information about classpath, java and app parameters internaly. They load jvm.dll (java.dll) and invoke main method of main class.

You can visit http://www.geocities.com/j2exe
There is a free tool for non-comercial use.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic