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 Java web application and would like the option of being able to launch RSSOwl within it by button click for example. I'm using Netbeans and wondered if there was a NetBeans plugin or and executable jar file available for it. It has been developed in Eclipse and has a .exe file for windows use. Any advice would be welcome. Thanks
I am aiming to create an EPoS-esque system and was wondering if there was anyway that I could export the code and be able to run it outside of a program like NetBeans (the IDE i will be using to code the program), and on its own separate software?
For example having its own desktop icon that would automatically run the interface i have designed outside of NetBeans.
You can create a JAR file and run it from outside Netbeans. You need to install JRE/JDK in the machine you are willing to run the application on.
For instructions check here: How to create a Jar file in Netbeans
I've created a JavaSE app in Netbeans and am using Inno Setup 5 to generate what I thought was a complete Windows installation, including JRE. As instructed, I have checked the NetBeans property boxbox for Native, and have Inno Setup 5 in the Path. The EXE is generated and installs nicely PROVIDED the target machine has Java installed. If it doesn't, there's no file association with .jre and no javac.exe so the .jar file won't run.
3/4/2017: After lots of poking around and trying things today I now understand more fully what NetBeans Native packaging is really doing. It creates an Installer exe that, when transferred to and executed on a target machine with or without JRE, creates the actual myApp.exe and puts it on the Start menu. My problem has been thinking the myApp.jar file had the JRE in it, so I was just trying to double-click the myApp.jar. If I use the myApp.exe it works.
However, I now see I still have a problem. myApp requires a number of supporting data files and reading from an .ini file. Consequently, I'm going to have to create an Inno setup to do that stuff separately, and my users will have to download and run TWO installers, so to speak. Had the person who did the NetBeans Native installer thing made the Inno setup file accessible for editing, that would be neat.
Ed
NetBeans has a Packaging option for creating a "Native" application, i.e., a MyApp.exe file for Windows. The importance of this is you get a Windows executable the INCLUDES JRE, meaning that the ultimate user doesn't need to install Java or JRE on his/her machine to run the application.
This sounds wonderful, but the documentation is not at all clear about how to make it work, at least not to me. Here's what I've learned.
First, for this to work you have to have Inno Setup 5 or higher installed on you development computer. Apparently, NetBeans creates an Inno .iss file and runs it.
To understand it better I made a NetBeans projects for the Inno AnagramGame example. To enable the Native packaging option, first select the Project in NetBeans , right-click and select Properties|Deployment. Check the Native packaging box. This causes the EXE option to be placed on the NetBeans Packaging menu. I.e., Select the Project, right-click and click on Package As. Clicking EXE Installer launches the process of building the "package."
Building the installer takes a LONG time because it has to accumulate all the necessary pieces of the JRE and incorporate into the package. This also makes the installer BIG. Even for the smallest Java program it will be about 35 Mb.
After the Native packaging of some app, for example AnagramGame2, you will find the following in the NetBeans project folder:
C:\Users\Ed Sowell\Documents\NetBeansProjects\AnagramGame2\dist\anagrams.jar
and
C:\Users\Ed Sowell\Documents\NetBeansProjects\AnagramGame2\dist\bundles\AnagramGame2-1.0.exe
Anagrams.jar is the Java archive file for the AnagramGame2 app. IF YOU HAVE JAVA INSTALLED, this will actually run the project by double clicking. However, if you move it to another computer WITHOUT Java or JRE installed, it will not be executable. The reason is the jar file does NOT incorporate the JRE. It took me long time to recognize this.
Now, you might be thinking AnagramGame2-1.0.exe is the Native executable for the app but, nay, it is not. It is in fact the installer, another thing that took me a long time to recognize.
So, where is the fabled Windows Native app file? The answer is it is nowhere, yet. In order to get it YOU MUST RUN THE INSTALLER! After running it you will find the much wanted EXE in, of all places, C:\Users\Ed Sowell\AppData\Local\AnagramGame2:
C:\Users\Ed Sowell\AppData\Local\AnagramGame2\AnagramGame2.exe
Also, with the appropriate options selected, the app name will appear on the Windows Start menu and desktop.
So, to distribute the Windows Native application you have to:
Create a NetBeans project.
Do a Clean build of the project
To enable the Native packaging option for the project
Do a Package as|Native installer
Distribute the installer, in this example it is AnagramGame2-1.0.exe
Your user then runs the installer. Afterwards, he/she runs the app from the Start menu or double clicking the desktop icon.
There's still a lot I don't understand about the proper use of this NetBeans/Inno Setup process. There are some small mysteries, such as why it hides the location of the end product in User AppData Local. Who would have thought to look there? And why does it call the Installer AnagramGame2-1.0.exe instead of something like setupAnagramGame2.exe? But here's the biggest problem I've yet to solve: How does one install ancillary files needed by the app? Or get needed data out of an INI file? If the .iss that is built and used in the NetBeans process were made available it could be edited, but so far I've not been able to find it. My guess is it gets deleted. Short of that, the only thing I can think of is to write another .iss file to do that work. Unfortunately than means the user has to download and run two installers!
The problem with the NetBeans packaging mechanism using Inno Setup is that - AFAIK - you can't give your own .iss file to the build mechanism. NetBeans creates an own installation script file with little to no external influence.
The biggest problem I too have is that the package is installed (at least for Windows) in C:\Users\<user>\AppData\Local. Who on earth is going to look over there in the first place to find back an application??? Don't know why they've taken that decision.
Whenever you click the executable generated by NetBeans, you don't have any control whatsoever over location, shortcuts,... And that's too bad...
To overcome this, I did the following:
Allow NetBeans to do its job and create an executable installer
Once the installer is created, run the installer and let it install the app in the weirdest of all places on a Windows installation
Open Inno Setup Compiler and create your own installation script, using all the files and subdirectories that were created by the original NetBeans generated installation executable.
Generate my own installation executable using the above
Run the self-created installer: you now have all the options you want since you yourself created the installation executable (option to change installation directory, default installation directory, default installation directory name, use desktop shortcut or not, allow for all users or current user only, ...)
I know this is a workaround and a 2-way process but that was at the time I needed it the only(?) / best(?) way I could find.
In the mean time, I found an alternative way to create an installer executable on this page where you can create your own .iss file and as such, have much more control over what is going to happen.
I didn't try it out myself yet, but I think it has quite some opportunities.
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