Need to install Java 6 for Mac to compile Android source code -
i trying setup android build environment mac 10.8.3
i dont understand, apple provide instructions on how revert mac java 1.6 here :
http://support.apple.com/kb/ht5559?viewlocale=en_us&locale=en_us
they clear instructions followed.
yet when still following :
unknown-98:fe:94:3f:92:ce:~ newuser$ java -version java version "1.7.0_13" java(tm) se runtime environment (build 1.7.0_13-b20) java hotspot(tm) 64-bit server vm (build 23.7-b01, mixed mode)
please please me solve problem.
the mac comes with, , updates, jdks 1.4 through 1.6. can see versions have installed in directory:
- /system/library/frameworks/javavm.framework/versions
this how change jdk
1. command line java
my java coming /usr/bin/java, points off 1 of versions in 'versions' dir described above. change version of jdk you're getting here, use java preferences application under applications -> utilities -> java:
you can drag jdk you'd top , should reflected command line: hostname% java -version java version "1.5.0_16" java(tm) 2 runtime environment, standard edition (build 1.5.0_16-b06-284) java hotspot(tm) 64-bit server vm (build 1.5.0_16-133, mixed mode) hostname% java -version java version "1.6.0_07" java(tm) se runtime environment (build 1.6.0_07-b06-153) java hotspot(tm) 64-bit server vm (build 1.6.0_07-b06-57, mixed mode)
2. scripts , applications use java
generally, other built-in applications or 1 install use java_home environment variable pick jdk. default, won't have set, , mac-specific versions of startup scripts create 1 using currentjdk link in java 'versions' directory. steps add environment variables documented in article, can save little time. create directory .macosx in home directory , add file called environment.plist. here entire contents of ~/.macosx/environment.plist file:
<!-- when changing this, run java preferences , change there. --> <key>java_home</key> <string>/system/library/frameworks/javavm.framework/versions/1.6/home</string>
value set, processes started have java_home available them. since file read when log in, you'll have log out/in once after create or edit file.
special case: netbeans
the ide use netbeans, following idea applies other large applications well. when netbeans installed, pick jdk use , hard code in properties file. if want rely on java_home you're setting in environment.plist, need edit 1 file. edit file:
- /applications/netbeans/netbeans\ 6.5.app/contents/resources/netbeans/etc/netbeans.conf
..and can set jdk changing line:
netbeans_jdkhome=$java_home
note that, netbeans.conf file points out, can force different jdk used specifying on command line when starting ide. copying , pasting pleasure, here command use start terminal (i'm giving 'help' option in case). if you're using different version, autocomplete ought version part of path:
- /applications/netbeans/netbeans\ 6.5.app/contents/macos/netbeans --help
recap
to recap, can switch jdks whole system using java preferences application along changing value in environment.plist file. switch on fly, use preferences app , set new value java_home in whatever terminal you're using, though apps netbeans still pick system value , should specify desired jdk on command line.
resources found solution: https://blogs.oracle.com/bobby/entry/switching_jdks_on_mac
Comments
Post a Comment