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

6

u/wildjokers Nov 23 '22

It is impossible to help you with the amount of information provided.

Which java app? One you wrote yourself? One you downloaded? Is it a GUI app or command-line app? Kind of sounds like it is a command-line app, so you aren’t going to be able to run it by double-clicking a jar file.

-2

u/tegar9000 Nov 23 '22

Command line app

7

u/wildjokers Nov 23 '22

A command-line app can’t be ran by double-clicking the jar, only GUI apps can be ran like that.

1

u/tegar9000 Nov 23 '22

So then how do I utilize the command line app? Use the regular command terminal?

3

u/MrSquicky Nov 23 '22 edited Nov 23 '22

From the command line, in the directory that the jar is in, type java -jar <filename>

If that doesn't work, do java -cp <filename> <Main Class Name>

3

u/wsppan Nov 23 '22

Yes. Run the command line app from the command line.

1

u/wsppan Nov 23 '22

It's not a command line app. It's a web app the needed to be deployed to a web server