issue seting java home

chalie001 used Ask the Experts™
hi am having issue checking java home in linux
 java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

i have this in my profile
export JAVA_HOME=/usr1/Oracle/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Not two hyphens in the command - just one
David FavorFractional CTO
Distinguished Expert 2018

For example on Ubuntu...

# apt-get install -yqq openjdk-11-jre-headless

# which java

# java --version
openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)

Open in new window

The version of Java you're running seems very old with a potentially corrupt install.

Likely good to purge all of Java + reinstall, to ensure you have a working install.
Software Developer
Just do java -version. If it's an especially stable version, you don't necessarily want to upgrade
Top Expert 2016

Isn't that what i said above?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial