Unless the jar-file includes some sort of implementation of Runtime
that runs the system's terminal or command prompt, it won't open a terminal/prompt window when double clicking it (if some sort of GUI-implementation have been made with e.g. Swing, it will however launch the GUI). However, you can create a separate file, which will launch the jar-file.
As it seems you're on Mac, you can just create a .command
-file. If you just need to execute your .jar
-file, create a file with the following content:
#! /bin/bash
java -jar /path/to/file.jar
Name it something you remember, but don't forget to add .command
at the end.
For Linux, use .sh
extension, with the same content.
For Mac and Linux, you might have issues with executing the files because of lacking the permissions, see here for changing permissions on files.
For windows, use .bat
extension. Exchange the slashes with backslashes when defining the path, and omit the #! /bin/bash
-line. You'll also have to add Java to your environment variables, see here.