background preloader

Java

Facebook Twitter

Excelsior JET - Java Virtual Machine (JVM) and Native Code Compiler. Convert Java to EXE - Why, When, When Not and How. Last update: 26-Dec-2013 By Dmitry LESKOV If you are sure you need a real EXE, go straight to AOT Compilers. "How do I make an .EXE file from my Java application? ", "Need help converting jar to exe", "Is it possible to create a Windows executable using Java? " --- these and similar questions are among the most popular topics on Java developer forums. "You cannot""You should not, because that would kill the very purpose of Java""You can do that with third party software X and Y" The truth is that there exist two completely different approaches to the creation of native executables from Java applications, addressing different sets of problems.

Java compiles to platform-independent bytecode (.class files), which is not directly supported by PC hardware. In a general case you may not expect that your end users will know what a JRE is, how to check its version, and how to download and install it. Java -Xmx200m -cp whatever.jar -Dsome.property MyApp Main-Class: MyAppMain Class-Path: mylib.jar Tools. Making executable desktop application in NetBeans. UPDATE (26 Aug 2009): NetBeans IDE can create executable JAR for any Java project. The steps described in this post are just one way of creating the executable JAR and not the only way. Following the steps described in this post any Java project can be bundled as a JAR executable project. Topics covered in this post: How to create a desktop application in NetBeans? Where is the JAR file after building the application in NetBeans?

Can a Java Desktop application started by double clicking? We will start with creating a New Project in NetBeans. In the New Project dialog box choose Java in categories and Java Desktop Application in the projects List box. Choose all the default values offered by NetBeans IDE in the New Desktop Application dialog as we want to see what is offered as defaults by NetBeans. After we click finish we get a desktop application with some boilerplate code and windows. The build successful messages tells us the exact location where the application JAR file is kept.

Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment) The Java™ Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file contains the class files and auxiliary resources associated with applets and applications. The JAR file format provides many benefits: Security: You can digitally sign the contents of a JAR file.

Users who recognize your signature can then optionally grant your software security privileges it wouldn't otherwise have.Decreased download time: If your applet is bundled in a JAR file, the applet's class files and associated resources can be downloaded to a browser in a single HTTP transaction without the need for opening a new connection for each file.Compression: The JAR format allows you to compress your files for efficient storage.Packaging for extensions: The extensions framework provides a means by which you can add functionality to the Java core platform, and the JAR file format defines the packaging for extensions.

This lesson has four sections: Launch4j - Cross-platform Java executable wrapper. JexePack -- Java application to Windows EXE Packager. What JexePack is: JexePack is a command line tool (great for automated scripting) that allows you to package your Java application (class files), optionally along with its resources (like GIF/JPG/TXT/etc), into a single compressed 32-bit Windows EXE, which runs using Sun's Java Runtime Environment. Both console and windowed applications are supported. JexePack embraces Java technology: Your Java program is still 'all Java' and is still being run under Sun's Java VM. You are just deploying your Java program as a native EXE. It just makes a lot of sense to deploy your application in a format that is native to the Windows OS.

And if your Java program is a tool that might be integrated into other programs, having an EXE to "exec" is crucial. Example: Here is an example of how we at Duckware use JexePack for all of our applications: Instead of specifying options on the command line itself, options are instead moved into an INI file. Which turns on 'reduce use of OS signals by Java/VM'.

Java2EE