We upgraded java package to 1.8.0_211. After upgrading, I was restarting my java services, which were running before , to reflect the upgraded changes.
But while running the .jar
file, I am getting following error
javac: invalid flag: -jar
Usage: javac <options> <source files>
use -help for a list of possible options
Below is the command I am using to run it.
nohup java -jar master-f41ba7c-true_26-04-2019_17.55.08.jar --spring.config.location=file:properties/application.properties &
Edit 1 when I checked the version of java on my newly upgraded java server it shows with javac
$ java -version
javac version 1.8.0_211
But when I use the same command to check the version of java on my old java server. It shows like this :
$ java -version
java version "1.8.0_151"
In the new it prints javac
instead of java
How can I make my jar run as before.
Something probably messed the Java alternatives. Try:
sudo update-alternative --config java
and check the version you're using is not pointing at javac
command. It can be a copy-paste error from the installation script where java
and javac
were mixed.
See this other question for more details about the command.