Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java to EXE good or bad idea?

I have been wondering for a long time about converting Java projects to EXE.

The advantages relies in the faster deployment on Windows where the user simply double clicks the EXE and the application is launched where is with Java, he has to run certain commands.

But EXE is really not what the Java was intended for which is portability.

So what do you think, Java to EXE good or bad idea?

I found some interesting article here.

Update

Wow, so may contradicting views so far. I would like you guys to add the pros and cons of the JAVA to EXE.

like image 689
Adel Boutros Avatar asked Jan 09 '12 09:01

Adel Boutros


People also ask

Is .exe harmful?

It's not safe to open any .exe file you encounter.. Just like any other file, it depends on the source of the file as to whether you can trust it or not. If you receive an .exe file from an untrusted source, you should use your anti-malware scanner to scan the file and find out whether it is malicious or not.

Can Java be compiled to exe?

Using GraalVM Java applications can be compiled into native standalone executables (will be demonstrated). Native executables of small Java programs startup blazingly fast, use considerably less resources compared to running on JVM and do not even require the JRE or any other kind of runtime apart from the OS.

What is Java exe used for?

A background process, java.exe includes the Java Runtime Environment as well as the Application Programming Interface that enables web browsers to run Java based plugins. If java.exe crashes or is disabled, your browsers will continue to work but any Java functions or applications online will fail to work.

Can I put exe on github?

You can use an existing tag, or let releases create the tag when it's published. You can also attach binary assets (such as compiled executables, minified scripts, documentation) to a release. Once published, the release details and assets are available to anyone that can view the repository.


1 Answers

Since my expertise is with Java Web Start, which is for launching desktop apps. with a GUI, please consider my advice to be targeted mostly at those types of apps.


Other people have commented on the OS specific nature of an EXE. I always have to wonder why people choose Java to develop Windows specific desktop apps., since the Visual Studio software for Windows would probably make both GUI development (no x-plat Java layouts to bend your head around) and deployment (just guessing it can produce an EXE) easier.

OTOH only you can say what is the best development tool/language for this use-case.


As to the potential disadvantages of creating an EXE, I note at the JavaFAQ on EXEs.

There are a number of good reasons not to package your application in an executable. Daniel Sjöblom notes:

  • It will probably not be any faster. Modern virtual machines don't interpret bytecodes, they actually employ a JIT compiler to produce native, compiled code. Check Sun's site for further information on JIT compilers.
  • Static compilation increases the size of your application multifold, since all of the libraries you are using need to be linked into the application.
  • You lose 'free' upgrades to your program. Anytime your user downloads a new faster virtual machine, your app gets a speed boost. If you are using an exe, you will not get this benefit.

Jon A. Cruz details some of the extra steps in the development process required to create an exe. He points out that developers making native exe's need to:

  • Validate the latest versions of the compilation product from the vendor. If critical bugs are found, it can't be used to build a shipping product until those are addressed. Work that needs to be done each time a revision comes out from the vendor.
  • Submit the software through a QA cycle. Once engineering thinks things are done, they need to be verified. So every shipping version and update of a product needs to go through complete testing cycles.
  • Further, since native compilation is per target platform, the QA cycle needs to be done completely for each target platform, which multiplies effort required.
  • Shelf space. Maybe not a big deal nowadays, but could be.
  • Then one needs to get all customers to upgrade to the proper version. Either have free updates (in which case the business needs to absorb the cost of producing updates) or alternatively needs to handle clients not all updating.

Jon notes futher: When you ship standard Java bytecodes, VM problems are the responsibility of the platform or VM vendor. However, when you ship compiled binaries, they become your responsibility (even if they're actually bugs in the vendor's compilation product).

...


Of course, my first choice for deploying Java rich client apps. is using Java Web Start. Putting some of the benefits/features of web-start in point form:

JWS provides many appealing features including, but not limited to:

  • splash screens
  • desktop integration
  • file associations
  • automatic update (including lazy downloads and programmatic control of updates)
  • partitioning of natives & other resource downloads by platform, architecture or Java version,
  • configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.)
  • easy management of common resources using extensions ..

I decided to highlight auto-update since with the gradual shift from apps. delivered on disk to apps. delivered over a network, auto-update is becoming more common. JWS still provides the best update experience (very configurable, mostly transparent to the user) I've seen.

And of course, JWS works on OS' for desktop PCs for which Java is available.


Update

..does Java web apps require internet connection?

(Note that name is 'Java Web Start'.)

Sure it does. At least for the initial installation. Update checks can be specified to continue to launch the previously installed version of the app. if the user is not currently connected.

But then, (in my estimation) there are more machines (such as Netbooks) with no CD/DVD drive, than there are without internet connections. If you want to sell to the larger market, look to the network to deliver the app.

like image 91
Andrew Thompson Avatar answered Sep 23 '22 18:09

Andrew Thompson