I had one script which has java class being called in this script.. but this script is giving two different outputs while executing in two different ways in linux machine
1st way is if i execute the script manually./test.ksh the java class is successfully executed and giving correct output
2nd way i am executing the script through cron job then it is giving java error UnsupportedClassVersionError
for java class file
I had not made any changes to that java class but it is responding in two different ways
Most probably you have two different Java Runtimes installed in this machine.
A newer one is found in the PATH that the shell uses for your manual script.
An older one is found from cron's environment.
Your java class has been compiled with a compiler newer than the cron-found Java version, but not newer than the shell-found Java.
A Java class compiled with eg Java 11 can not be executed by eg a Java 8, but by a Java 11 and later.
Check the versions by executing java -version
from the shell and from the cron job.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.