7

I have developed a Java application with Eclipse. I have also exported in the .jar format. It works great, but there are some issues;

  1. The icon is the one of the JVM and can't be modified
  2. If the PC where the application runs, it will not have the Java SDK, the application can't start.
  3. In some case, for example Linux, the application will not start if the user select the box authorize.

So at the end, I want to transform the .jar file, into the native format for the other OS, such as .exe, .app and .deb with a specific icon. How Can I do this ?

Alex
  • 781
  • 10
  • 23
I love coding
  • 1,183
  • 3
  • 18
  • 47
  • Note that converting the program to exe/deb/etc will not solve these problems. It will make you able to choose an icon, but you'll still need your program to have permissions to run on linux, and you'll need the JDK/JRE in order for the program to start. If you write a program in java, java must be installed in order to run it. Making an exe or a deb **does not** convert the program to a native program. It just wraps the jar inside the exe/deb, which is extracted at runtime and run by the JVM. – BackSlash May 08 '15 at 08:55
  • Check this http://launch4j.sourceforge.net/ Note: You can't "transform" the file into the native format. You just wrap them. The exe file will run JRE. – omerfarukdogan May 08 '15 at 08:57
  • Don't. all you'll accomplish is that your application is no longer platform independent. – Stultuske May 08 '15 at 08:59
  • [jsmooth](http://jsmooth.sourceforge.net/) – Zion May 08 '15 at 09:08
  • @Stultuske You can always distribute both jar and (customized) native builds, whats the problem? – Praeterii May 08 '15 at 09:18
  • @Praeterii: sure, you can, but in my experience, most don't. – Stultuske May 08 '15 at 09:50
  • Thank you ! Of course if the JVM isn't present, the application will not start. I want that the .exe will check if the JVM is present or not. – I love coding May 08 '15 at 16:12

1 Answers1

6

1) The icon is the one of the JVM and can't modify
2) If the PC where the application runs, it will not have the Java SDK, the application can't start.

There is a way to Embed a JRE in a executable. This way you can create native build for target systems which will 1) allow you to change the icon 2) make app run on PC where JavaVM is not installed.

I recommend using Avian which is free: http://oss.readytalk.com/avian/

Also you might be interested in this thread: Embed a JRE in a Windows executable?

Community
  • 1
  • 1
Praeterii
  • 340
  • 6
  • 16
  • Thank you ! It seems not so easy to work with Avian. Are there any other solution ? – I love coding May 08 '15 at 16:16
  • There are few, but all have some pros and cons. Some tools I know are: GNU gcj (already dead), Excelsior JET (really expensive). There are also wrapers for jars, afaik they still need JVM to be installed. Google for: launch4j and/or JSmooth. What are you doing to do IS hard and probably will be hard no matter what tool will you decide to use. – Praeterii May 09 '15 at 22:49