How to Run Jar on java 7 compiled in java 8 or higher version

adesh singh :

I have created a windows application using java 8 . But my client is using java 7 on his machine and not able to upgrade java on the machine.

So when i run jar on java7 compiled in java 8 it gives error so can i convert jar compatible to lower version java

Amit Bera :

You can't change a compiled jar's Java version. You have 2 option in hand.

  1. Compile the Source code using Java-7.

  2. Compile source code using Java-8 but using the following command when target vm version is java-7.

javac "Your java classes" -source 1.8 -target 1.7

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=86276&siteId=1