I've installed JDK 7u7 downloaded from oracle's website. But after installation, the terminal is still showing java version 6 $java -version java version '1.6.0_35' Java(TM) SE Runtime Environment (build 1.6.0_35-b10-4) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode) any idea why java 7 is not showing up? Ans: OK, the problem has been resolved. Here is the answer: I found that my Terminal has a.bash_profile and the java home variable is set to 1.6 export JAVA_HOME='/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home' So this is the line causing the problem every time I opened a new terminal window. Simply remove this line will solve the problem. You still need to follow what @aleroot said, but if that doesn't work for you, check the.bash_profile (or.bashrc) setting file to see if you've previously exported any java version. Oracle's installer puts java inside the /Library/Internet Plug-Ins/JavaAppletPlugin.plugin. And it doesn't overwrite /usr/bin/java. So, if you issue a whereis java in the terminal, it'll return /usr/bin/java. Java Tutorial: My First Java Program In this video we will be using NetBean IDE and Cmd Terminal. Java Tutorial: My First Java Program جافا البرنامج التعليمي. Office for mac download. (which in turn points to /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java, which is Apple's 1.6 version). So, if you want to use the new java version, replace the /usr/bin/java symlink so that it points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java instead: sudo rm /usr/bin/java sudo ln -s /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin. Vi ~/.bash_profile add export JAVA_HOME=`/usr/libexec/java_home -v 1.7` This tells your /usr/bin/java link target to use the latest Java 7 Package installed in /Library/Java/JavaVirtualMachines/ So for JDK 1.7.0_17 JAVA_HOME would be: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home Note: There were a lot of change in this area recently to move Mac OS X from Appels own System integrated Java packages to Oracle based Java Packages. The above solution is working fine as of Mac OS X 10.8.2. +1 for this answer which is imo the correct one because it works on versions of Mac OS before and after 'Java Preferences' was removed, and by showing the '-v' option it demonstrates how you can use java 6 even if java 7 is installed (which is what I want). ![]() Hence on my Mac running Lion (10.7.5) I use the same command with '-v 1.6'. This is crucial because I need Java 6 and Oracle doesnt provide one for Mac OS - only Java 7, and this allows me to use the installed JAva 6 even though Java 7 is installed. – May 20 '13 at 11:43 •. In my case, the issue was that Oracle was installing it to a different location than I was used to. Download from Oracle: • Verify that it's installed properly by looking in System Prefs: • Command-Space to open Spotlight, type 'System Preferences', hit enter. • Click Java icon in bottom row. After the Java Control Panel opens, click 'Java' tab, 'View.' , and verify that your install worked. You can see a 'Path' there also, which you can sub into the commands below in case they are different than mine. • Verify that the version is as you expect (sub in your path as needed): /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version • Create link from /usr/bin/java to your new install sudo ln -fs /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java • Sanity check your version: java -version. I had run into a similar issue with terminal not updating the java version to match the version installed on the mac. There was no issue with the JAVA_HOME environmental variable being set I have come up with a temporary and somewhat painful but working solution.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |