Now I have multiple jdk installed on OSX as shown below:
└─[1] <> /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
14.0.1, x86_64: "Java SE 14.0.1" /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
1.8.0_241, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home
Then I want to double click to run a jar file directly, for instance this:
However, it warns me that this jar file is launched with JDK 14 but I want to launch it with JDK 1.8.
A solution is that run it in terminal with "java -jar" in specified jdk path,but clearly it is not elegant.
The best way is to let "Jar Launcher" use specified jdk version ,but I don't know how.