0

Is it possible to create a executable jar file coded in java12 while java8 is still installed? We use java8 in university but privatly im coding in 12 and so i need to find a way to run a private coded program through a jar file (created with artifacts through intellij) but still keep the java8 installment for university.

i tried this command

start javaw -jar jogurtLaunch.jar

and i tried rightclick and 'open with' and using the java12 exe (both java.exe and javaw.exe), but nothing happens except for the windows cmd prompt popping up for a few milliseconds in case of the exe and a jvm error ('Error: A JNI error has occurred, please check your installation and try again') popping up in case of the command.

Also i'd prefer a solution that is usable on all computers and not just for java12 development pcs. Is there a way or do i have to code it in java8?

mr.jogurt
  • 43
  • 8
  • 1
    What is the result when you use the absolute path to the `java`/`javaw` file and start it from the `cmd`? – Progman Jun 20 '20 at 18:27
  • it can't find the name '-jar' if i remove the '-jar' from the command it starts the cmd and closes it instantly again – mr.jogurt Jun 20 '20 at 18:32
  • 1
    Use `"C:\path\to\jdk12\bin\javaw.exe" -jar jogurtLaunch.jar` to run the jar file using Java 12. Create a Windows Shortcut with that command, if you want to be able to click an icon to start the program. – Andreas Jun 20 '20 at 18:44
  • as i already said that doesn't work. it only opens the console for a brief moment and then closes it again – mr.jogurt Jun 20 '20 at 20:43

0 Answers0