issue seting java home

chalie001
chalie001 used Ask the Experts™
on
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
Comment
Watch Question

Do more with

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

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

Commented:
For example on Ubuntu...

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

# which java
/usr/bin/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
Commented:
Just do java -version. If it's an especially stable version, you don't necessarily want to upgrade
Top Expert 2016

Commented:
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