码迷,mamicode.com
首页 > 编程语言 > 详细

Install and set JAVA home on MAC OS with commandline

时间:2014-07-03 06:04:04      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:java   strong   os   art   cti   io   

最近需要在MAC上做一些测试,由于测试机没有安装Java,只能自己安装,由于不能通过图形化界面访问测试机,只能通过命令行的形式来安装JAVA。

1. Download the jre/jdk install package from Oracle website,use hdiutil to mount the dmg file
  sh-3.2# hdiutil mount  jre-7u55-macosx-x64.dmg
Checksumming Protective Master Boot Record (MBR : 0)?
Protective Master Boot Record (MBR :: verified   CRC32 $A63E199D
Checksumming GPT Header (Primary GPT Header : 1)?
GPT Header (Primary GPT Header : 1): verified   CRC32 $12939AC9
Checksumming GPT Partition Data (Primary GPT Table : 2)?
GPT Partition Data (Primary GPT Tabl: verified   CRC32 $7832AB48
Checksumming  (Apple_Free : 3)?
                    (Apple_Free : 3): verified   CRC32 $00000000
Checksumming disk image (Apple_HFS : 4)?
.................................................................................................................................................................................
          disk image (Apple_HFS : 4): verified   CRC32 $7C0741DD
Checksumming  (Apple_Free : 5)?
                    (Apple_Free : 5): verified   CRC32 $00000000
Checksumming GPT Partition Data (Backup GPT Table : 6)?
GPT Partition Data (Backup GPT Table: verified   CRC32 $7832AB48
Checksumming GPT Header (Backup GPT Header : 7)?
  GPT Header (Backup GPT Header : 7): verified   CRC32 $8D5EC567
verified   CRC32 $6A86DC11
/dev/disk2          GUID_partition_scheme         
/dev/disk2s1        Apple_HFS                      /Volumes/Java 7 Update 55

2. Install the jre package
sh-3.2# installer -pkg ‘/Volumes/Java 7 Update 55/Java 7 Update 55.pkg‘ -target /
installer: Package name is Java 7 Update 55
installer: Installing at base path /
installer: The install was successful.

3. Use the following command to check java home
/usr/libexec/java_home 

4. Set java home if necessary
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home 
export PATH=$JAVA_HOME/bin:$PATH

Install and set JAVA home on MAC OS with commandline,布布扣,bubuko.com

Install and set JAVA home on MAC OS with commandline

标签:java   strong   os   art   cti   io   

原文地址:http://www.cnblogs.com/spandon/p/3818587.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!