0

I would like to start my java code by double-click.Therefore I have exported my java project in Eclipse as "Runnable .jar". The file has the java icon, but when I try to start it, an error appears:

"The Java JAR file "test.jar" could not be launched. Check the Console for possible error messages."

But there is nothing in the console. I am running OSX 10.14.5, Java 12 in Eclipse as JDR, and on my Mac there is Java 8 installed. Running java -jar /Users/Bob/Desktop/test.jar does start the program.

package testMAC;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("It works!");
    }

}

The program should start the console and print "It works!".

Airn5475
  • 2,116
  • 25
  • 43
  • https://apple.stackexchange.com/questions/65128/how-do-i-run-a-jar-when-i-double-click-it – Kenneth Clark Jul 22 '19 at 12:09
  • Take a look here: http://www.owsiak.org/how-do-i-work-with-development-build-on-macos-netbeans-11-0/ and here http://www.owsiak.org/netbeans-make-macos-installer-beautiful-again/ to get an idea how to prepare nice looking wrapper for Java based code. – Oo.oO Jul 22 '19 at 13:12
  • But why do some .jar files work just fine? – Alex Shtyrlin Jul 22 '19 at 15:50

0 Answers0