1

While watching a tutorial on YouTube, the creator exports a Java JAR file and opens it which runs his created app. When I attempt to repeat the process, it just opens the content of the JAR.

my attempt

What the creator did.

3
  • And get rid of Win-Rar, 7-zip is so way more better as I see you're using the eval version and it has the annoying - buy me! Commented Jan 26, 2018 at 16:45
  • 1
    jar files are zip files with optional extra rules. Therefore it makes sense for an over-eager archive viewer to "grab" the jar file type for it self. Commented Jan 26, 2018 at 16:58
  • Prospeed-orginal - if any of the two answers helped you and I am sure they did - please be sure to select one of them as "the answer" Commented Jan 26, 2018 at 18:33

2 Answers 2

3

Looks like your computer is configured to open JAR files with WinRAR.

You can change this by going to Control Panel > Default Programs

Set java as the program to open JAR files.

Alternatively you can open a cmd window or PowerShell window and type the command

java -jar <path to your JAR file> 

Good Luck!

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, but how do I select "Java"?
Nevermind that it works, however when I try to open the files with Java a black screen appears and disappears and nothing happens. How do I solve that?
@Propseed if you use the alternative method I suggested, i.e. open a window and enter the command, then you may get some error message displayed which may help to understand what the problem is.
1

This is because your jar file is being opened in winrar by default. right click on your jar and from open with... choose java to run the jar

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.