Hello friends
I have a jar file named umar.jar in /root/umar/bin directory. I have a shell script file run.sh in same directory. Following is the content of run.sh
#!/bin/bash
"$JAVA_HOME"/bin/java -jar /root/umar/bin/umar.jar
Now when I run the shell script, I get the following error
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
After some googling, I found (as a folk from stackoverflow mentioned) that such errors occur when the Jar was compiled with a later version of the JDK than your JRE.
Now strange thing is, if I run this command directly on shell
java -jar umar.jar
it works perfectly fine. If the jar was compiled with a later version of JDK than my JRE, it shouldn't have had run at all even from the shell.
What do you suggest?