I have a spring boot project. How can I make the java spring boot project run on my local machine without using any application (Intellij IDEA, Eclipse, Heroku, Docker etc.)? I can do this using jar file on command line, but I want to use a different method. How can I do that on windows ?
CodePudding user response:
A couple of options, depending on how advanced you want to make it.
Here's a related answer on how to use Launch4J: How do I bundle a JRE in my JAR, so that it can run on systems without Java?
You can also look into using https://www.advancedinstaller.com, which allows helps you create installation wizards for different operating systems, including setting registry values, etc.
CodePudding user response:
Make sur that the JRE is installed on your machine (which is the case if you'r running .jar
files from cmd
) then open the jar file as any windows program, if you want to generate an executable .exe
from your file then use launch4j.
CodePudding user response:
GraalVM
Another more modern and efficient approach than launch4j would be to use GraalVM.
- Install GraalVM
- Install some C developer environment like Visual Studio
- Run:
gu install native-image
After compiling your Java code with javac
compile as a native image
javac YourClass.java
native-image YourClass
Now you have an efficient executable that can run on its own anywhere.
At least this is how you do it manually.
You have a library for Spring, spring-native
, to help you. Or you can develop your project using Quarkus instead, which can build a native image out of the box