3

Possible Duplicate:
How can I convert my java program to an .exe file ?

Hello,

I coded a java project using Eclipse software. Now i need to convert that project to .exe file. I export that project and hence converted to jar file.

when i double click on it, it shows "failed to load Main-class attribute from 'path'". So unzipped it and looked into the MANIFEST. mf, there it has only version.

I also used JartoExe software and converted to exe file. It shows a cmd prompt like file but when i click it, i am just getting a flash of that window. Its not opening.

Please help me to convert the jar to exe file!!

Thanks in advance!

Community
  • 1
  • 1
Anu
  • 161
  • 2
  • 3
  • 11
  • 1
    No, all the answers really helped me a lot. But sorry I wasnt aware of the rate points. – Anu May 06 '11 at 03:04
  • It's not about the points, please if you found a good answer to any of your questions, mark it as 'accepted' by clicking the tick below the number of votes. – Pablo Fernandez May 06 '11 at 03:05
  • Yes, i have done that before. But I think i said something like you need to have 15 points or something. So, my tick mark was not accepted. – Anu May 06 '11 at 03:12

6 Answers6

1

Take a look at this article: http://introcs.cs.princeton.edu/85application/jar/jar.html

You basically have to define what gets executed in the manifest and then if you want to your program under windows, you can either associate the jar type to java.exe or create a .bat file that starts the jar appropriately.

TK Gospodinov
  • 8,302
  • 6
  • 24
  • 25
1

While exporting to jar file you need to provide the main class name, which is the entry point to your program.Once you do this, manifest file in jar will have entry for it and that will allow you to run it by double clicking on the jar.

sudmong
  • 2,036
  • 13
  • 12
  • Thanks for your reply. But would you please tell me how to provide the main class name while exporting? How to check the classpath of my project in Eclipse? – Anu May 06 '11 at 03:17
  • see it here on eclipse help http://help.eclipse.org/helios/index.jsp under the "JAR manifest specification ' you should see "Select the class of the application entry point " while working from UI you should the same options. ' – sudmong May 06 '11 at 03:25
1

When you choose Export from eclipse, one of the dialogs asks you what the main class is. If you specify it then when you double click on the jar it will launch the app.

MeBigFatGuy
  • 28,272
  • 7
  • 61
  • 66
0

Use JEXECreator 1.9.3, it is very good. It gives you two options to run your program: either using the console or the GUI

Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417
0

The easiest way to do so is to have a eclipse plugin "fat.jar" and add it to your eclipse next you will get an option to build fat jar when you right click on your project.

Do restart of your eclipse after installing fat jar..

wow... very easy...

  • Included as Export->Runnable Jar in Eclispse 3.5+ – Thorbjørn Ravn Andersen May 06 '11 at 03:36
  • @Thorbjorn- Thanks! I did as you specified here: export->Runnable jar. Now i checked Manifest file:Manifest-Version: 1.0 Class-Path: . Main-Class: example.fileLists Name: common Implementation-Vendor: Oracle Implementation-Title: MySQL Connector/J Implementation-Version: 5.1.15 Implementation-Vendor-Id: com.mysql Specification-Vendor: Sun Microsystems Inc. Specification-Title: JDBC Specification-Version: 4.0. But when I doble click on the jar file nothing happens. What should I do now? Please help! – Anu May 06 '11 at 03:45
0

http://www.ej-technologies.com/products/exe4j/overview.html

I once use this, it's good. But the free version has some kind of ads flash screen, if I'm not wrong.