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 ?
-
1What different method are you wanting to use? Shortcut? – Rob Goodwin Sep 14 '22 at 19:56
-
It can be any method but not the methods I mentioned above. – Sep 14 '22 at 19:57
-
ok, then a shortcut? – Rob Goodwin Sep 14 '22 at 20:03
-
Shortcut on a IDE ? – Sep 14 '22 at 20:05
-
And what is your project's build like? Is it maven or gradle? Assuming its maven you can just need to execute `mvn spring-boot:run` – Asif Kamran Malick Sep 14 '22 at 20:22
-
No, the shortcut would be targeting the java executable in the JRE, and your JAR (or wherever your class files are) would be a parameter to the shortcut. Someone did it here: https://superuser.com/questions/975687/how-to-pin-an-executable-jar-to-start-in-windows-10 – Bjørn Vårdal Sep 14 '22 at 20:22
-
@AsifKamranMalick That would violate his command line constraint. – Bjørn Vårdal Sep 14 '22 at 20:23
-
Is the OP completely excluding the option of running from commandline or just not willing to use the old vanilla way of executing the jar as opposed to the Springboot maven plugin way? – Asif Kamran Malick Sep 14 '22 at 20:28
3 Answers
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.

- 174
- 2
- 11
-
-
So you want to be able to run the service in the JAR, but without: - opening a terminal - creating an executable (.exe)? Maybe a .bat script? – Bjørn Vårdal Sep 14 '22 at 20:18
-
I have only project on my hand. So you can't use the methods what as I wrote above. You can open the terminal and you can do something on terminal. – Sep 14 '22 at 20:34
Make sure that the JRE is installed on your machine (which is the case if you're 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.

- 2,676
- 2
- 27
- 47

- 56
- 5
-
-
Do you mean that you want to run the file without the JRE installed ? That's impossible unless you wrap it inside your file using launch4j. – Gaya Touak Sep 14 '22 at 20:11
-
Sounds like the JRE is installed. He can run it using command line. – Bjørn Vårdal Sep 14 '22 at 20:20
-
That's what i said in my answer, i guess he struggles locating the jar file in his build directory. – Gaya Touak Sep 14 '22 at 20:38
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

- 4,366
- 2
- 14
- 37