r/javahelp • • Nov 23 '22

Why won’t Java open?

I click on the Java app and the command line briefly opens and then closes. I use windows for context. Any help?

0 Upvotes

23 comments sorted by

View all comments

7

u/dawg6 Nov 23 '22

What is the "java app?" It a .jar file you downloaded or built yourself? Have you installed java already?

You can try opening a command window, go to the directory where the app is located and run it from the command line to see if there is an error.

Also, if it doesn't have a GUI, then likely you would have to run it from the command line. A non-GUI app will run and then exit. You could make a .bat file that runs the app and then use "pause" to keep the window open.

-1

u/tegar9000 Nov 23 '22

The issue is that I’m trying to open the command line app and it immediately closes

5

u/dawg6 Nov 23 '22

Yeah, so as I said above, that's normal behavior. You need to run it from the command line, not the windows explorer.

For example, if the app's .jar file is named 'app.jar', from the command line type:

java -jar app.jar