简体   繁体   中英

Mac OS ElCapitan: java -version command not working

I'm trying to make Standford NER package to work on my mac. Using anaconda and python 2.7 (iPython notebook). I was following the steps given here: http://www.nltk.org/api/nltk.tag.html#module-nltk.tag.stanford . While executing the last step, it gave me UnsupportedClassVersionError.."xy.z" is "52.0" which means I need to upgrade to java 8. I upgraded to Java 8, but my java -version command still showing java 7. So I tried to fix it using the solution given here: After upgrading to Java8, javac still shows 1.7 . Instead of removing, I renamed the directory. These are the following commands I exec:

cd /System/Library/Frameworks/JavaVM.framework/Versions/
mv Current Current_Old
ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/ Current

Then after that java -version command is not working. I realized the directory name is incorrect and tried to replace it back using mv Current_Old Current , still the command is not working.

how can I restore my java?

Able to get it working again! All I did was restored legacy Java 6 from this link: https://support.apple.com/kb/DL1572?locale=en_US

Then java -version was even showing me the latest version which is Java 1.8. Able to start Java IDE now.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM