0

What the title says really. I've tried exporting it to a Runnable Jar File, checked the Manifest.MF, and tried running it with Java multiple times but with no luck. However, it does work when I navigate to the file using the command prompt and launch is using java -jar Name.jar. This shows it works but I just can't get it to launch by double clicking.

3
  • Have you checked the environment settings in your OS? Commented Jan 23, 2016 at 19:51
  • If you're using Windows, just create a batch file executing java -jar Name.jar command. Commented Jan 23, 2016 at 19:52
  • I did, yes Stultuske. And thanks AndrewMcCoist, I'll just do that instead. Commented Jan 23, 2016 at 19:55

2 Answers 2

5

I guess you're trying to launch a commandline-app. This kind of application can be launched by double-clicking aswell. There's only one problem: Java doesn't create a commandline-window by default and instead uses the commandline of the parent-process of the JVM, which in case of double-clicking doesn't own a console-window. In other words: the output to the console gets lost somewhere in the depths of your OS and the JVM and the program hangs as soon as any input is expected.

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

Comments

0

(Assuming your on Windows OS), if you right-click on it, do you see the option 'Open with' and then 'Java (TM) Platform SE binary', or something like that? And if you opt to open with that, does it execute?

If so, then you've probably set .jar files to open with a different application by default. For example, I have my computer set up to open .jar files with jd gui as the default application.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.