I have a libGDX project that I want to be able to run from a .exe file on my desktop.
So far I can only run it over DesktopLauncher inside my Android Studio.
Whats the simplest way to build a .exe file out of my project?
I can build .jar file but it won't run on double-click. Does that mean I need to make a wrapper for display or something?
I'm new to libgdx and android studio, and I just need to deploy my first simple app as a standalone file on desktop.
Two choices:
1- Packr, which packages your jar files along with the java jre and creates an executable on Windows, Linux or MAC (https://github.com/libgdx/packr)
2- Excelsior JET, which recompiles the entire java code to native executable. This option cost money, though (http://www.excelsiorjet.com/)
Related
I need to create a .exe file for my project. I have a launcher and 5 applications. Applications are launched using the launcher applications. How can I collect the entire project into 1 executing file and run it using it? My project built on Gradle.
What are the ways to solve my problem?
The recommended way to do this for modern JavaFX applications is to use jpackage which comes with JDK 14. Don't try executable jars. They won't work in general.
If you have to, you can use JDK 14+ just for jpackage but bundle your app with any JDK 11+. Just have a look here for a tutorial: https://github.com/dlemmermann/JPackageScriptFX
Try using Launch4J (http://launch4j.sourceforge.net/) or Advanced Installer (https://www.advancedinstaller.com/) to package your .jar files into a single (or multiple) .exe file(s). Note that these are third-party programs which will enable you to package your .jar files and deploy most probably on your client's computer.
For more info read,
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
https://www.genuinecoder.com/convert-java-jar-to-exe/
I have a large Java app, with many required .jar files.
I'd like to build a native launcher and installer for it, to run it on both Mac and Win machines.
It looks like I can use Launch4J to create a .exe file launcher on Windows. (though it only wraps a single .jar, the others have to be available in the path.) Then use IzPack to create a runnable .jar file that will install the .exe and relevant .jar files into a directory.
How do I do the same for OS/X?
After more digging, and avoiding all the dead URL's I found, I've come up with:
A) Use Launch4J to build a .exe for Windows systems.
B) Use AppBundler (from java.com) to build a App Bundle for OS/X.
IzPack can be used to make an installer for either platform.
I created a tic-tac-toe game in Java. It runs fine on Eclipse.
How do I compile this file (which is currently a .java file) to the standard file format of Java applications, so it can be run from the desktop like a normal program?
What is the standard file type for the final executable Java application? What should be the file type if I want people to easily and without any computer knowledge run my program on their computers?
with eclipse right click on your project. then export it as a runnable .jar file.
Project Right Click > Export > Runnable .jar File.
First choose your project under "Launch configuration", then choose your destination.
After that click finish. Your program should be in your destination folder. Double click to start (just like an .exe file)
For example: If you export it to your desktop, and you name it "TicTacToe", the file on your desktop is "TicTacToe.jar" - ".jar" is your executable file
Done
You have to compile your java class first
javac TicTac.java
and then execute it
java TicTac
Note: that here you provide the name of the class with the main method!
As the other answers indicated, you can create an executable jar using eclipse (or a number of other tools). What these tools are doing under the hood is defining the Main-Class: attribute in the jar's manifest.
In Windows, your users can double click on an executable .jar to launch it, as long as the file associations are configured correctly. However this may not be obvious to windows users who are trained to expect some sort of .exe extension.
To solve this, you could use launch4j to wrap your executable jar in a windows executable. Note: this doesn't change your java application into a native application (it still requires the JVM, etc), it simply makes it launch more like a native application.
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & *nix.
Note that JWS is more effort for us to deploy (it involves not only Jarring and signing the code, but creating a JNLP launch file and a page on the net or network to check that Java is installed & serve the files to the user), but is super easy for the end user.
If there is a JWS deployment, the Jar does not have to be an 'executable Jar' as described in the other answers.
The command should be javac yourFile.java from you command prompt and then after compilation, class file is created. You can run it using java MailClassName
You can find a good tutorial on using javac and java commands here.
I have the following jar files for my app:
DesktopApplication1.jar
Plus , i have used the some extra API's for my app , like jsoup, jexcelapi etc. There are about 7 api's in the lib folder.
How to make a EXE file & RPM file out of all these jar files?
P.S. I am a first timer. So take that into consideration.also, I have used Netbeans 6.8. So the main API is in \dist folder. And the API used is in \dist\lib folder.
thanks in Advance
use jsmooth to make exe from jar
Build your JAR with fatJar to include all the dependencies in it, and then make it executable with your favorite tool (I use Launch4j)
RPM is little bit different, since it is not executable, but package format. There are lots of tutorials, how you build it up.
You could make a BAT file a file with .bat(For windows) extension
Just open notepad and write the following text
java -jar DesktopApplication1.jar
Save the file as filename.bat(the .bat extension is important)
Place the .jar and .bat files together and just double click the .bat file every time you need to run the jar...
If you don't want to keep both together then give the absolute path of the jar in the .bat file
java -jar AbsolutePath/DesktopApplication1.jar
For a linux machine make a file with (.sh) extension rest of the procedure is same...
Try InstallJammer. It provides what you want.
Deploy the app. with Java Web Start. JWS Can make it easy to add other Jars to the apps. run-time class-path, avoiding the common problem with fat jar of violating the API's distribution license (when it says WTE 'you are allowed to distribute this in unaltered form..') and can provide the further benefit of only downloading the parts that the user requires (when the user requires them).
JWS has many other cool features like desktop integration (menu bars, start menu item), splash screens, automatic updates, support by the owners of Java, and compatibility with any platform for which Java is available.
For creating .exe to run on Windows:
Download launch4j from http://launch4j.sourceforge.net.
build wrapper .exe through launch4j.
Download innoSetup from http://www.jrsoftware.org/isdl.php.
Build .exe as installer, the setup file, for user to download and install.
Install rpm for linux:
If your application used other native libraries, you need to download and install Linux native libraries. This is how we build rpm for our app.
I need to make an answering questions game and I chose to make it using netbeans. I wonder if I can create an executable so that somebody could "play" the game even if he does not have installed netbeans!
Any ideas please?
In NetBeans set your application as the active project and press F11, which builds the project. This means that your application will be packaged into an executable jar file that you friend can click to run your application.
Once you have clicked F11 you can locate the executable jar file at e.g. ../Documents/NetBeansProjects/ProjectName/Dist
There is a misconception: Netbeans is not a runtime platform. Netbeans is just a tool to build Java applications. You can perfectly create the same Java application with just notepad.exe and the JDK, you only need to have a bit more knowledge and experience to do it rapidly enough.
To run a Java application, all the enduser needs to have installed is a JRE. To create a runnable Java application, all you need to do is to export the Netbeans project as an executable JAR file.
Developed program has nothing to do with IDE. It doesn't need IDE to be executed...
When you build it, a JAR (Java archive) will be created (look in your dist/ directory or your project properties). If you've set up your project correctly, launching that JAR will start your application. See http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html