http://blog.sina.com.cn/s/blog_55fb522f0100ratv.html
安装.tar.Z 格式的
1. 根据你的机器类型,下载正确的版本。 64位的 要下两个包! 2.解压
On SPARC processors:
zcat jdk-7u<version>-solaris-sparc.tar.Z | tar xf - zcat jdk-7u<version>-solaris-sparcv9.tar.Z | tar xf - On x64/EM64T processors:
zcat jdk-7u<version>-solaris-i586.tar.Z | tar xf - zcat jdk-7u<version>-solaris-x64.tar.Z | tar xf -
第一行命令创建对应的文件夹(SUNWj7rt, SUNWj7dev, SUNWj7cfg, SUNWj7man, SUNWj7jmp, SUNWjavadb-client, SUNWjavadb-common, SUNWjavadb-core, SUNWjavadb-demo, SUNWjavadb-docs, SUNWjavadb-javadoc, and SUNWjavadb-service)和一些文件在当前文件夹下
第二行命令为64位机器创建了另外一些目录 The second command creates several directories (SUNWj7rtx, SUNWj7dvx, and SUNWj7dmx) in the current directory, which contain 64-bit support for the JDK.
3. Assume the root role. You can use the roles(1) command to determine whether you are able to assume the root role. 切root用户
4. Uninstall any earlier installation of the JDK packages.
卸载以前的jdk pkginfo | grep SUNWj 查看以前的版本 比如说查看1.6的 就是pkginfo | grep SUNWj6 比如说查看1.5的 就是pkginfo | grep SUNWj5
然后pkgrm 上边pkginfo | grep SUNWj6 的包 可能要多点几次y 呵呵 java -version 看版本 1.6删完了 还可能有1.5的 接着删 直到java -version 提示java找不到
If your machine has an earlier 32-bit or 64-bit version of the JDK installed in the default location (/usr/jdk/jdk1.<major version>.0_<minor version>), you must uninstall it before installing a later version at that location.
You can skip this step if you intend to install the JDK in a non-default location. For more details, see Selecting the Default Java Platform.
5. Run the pkgadd command to install the 32-bit and 64-bit packages.
# pkgadd -d . SUNWj7rt SUNWj7dev SUNWj7cfg SUNWj7man SUNWjavadb-client SUNWjavadb-common SUNWjavadb-core SUNWjavadb-demo SUNWjavadb-docs SUNWjavadb-javadoc SUNWjavadb-service # pkgadd -d . SUNWj7rtx SUNWj7dvx SUNWj7dmx The first command installs the JDK into /usr/jdk/jdk1.7.0_<version>.
The second command installs the files for 64-bit support into the JDK installation at /usr/jdk/jdk1.7.0_<version>.
See the pkgadd(1) and admin(4) man pages for information on installing the JDK in a non-default location. 安装jdk7
pkgadd -d . SUNWj7rt SUNWj7dev SUNWj7cfg SUNWj7man SUNWjavadb-client SUNWjavadb-common SUNWjavadb-core SUNWjavadb-demo SUNWjavadb-docs SUNWjavadb-javadoc SUNWjavadb-service
如果是64位的 加上下边的命令
pkgadd -d . SUNWj7rtx SUNWj7dvx SUNWj7dmx
如果不出意外 应该是安装好了
6. 可以忽略 For Japanese users: Install man pages.
If your machine has an earlier version of the Japanese man pages already installed in usr/jdk/jdk1.7.0_<version>, you must uninstall that package before installing this version of the Japanese man pages at that location. Remove that package by running:
# pkgrm SUNWj7jmp Then run the pkgadd command to install the new Japanese man page package.
# pkgadd -d . SUNWj7jmp 7. To save space, delete the tar files and extracted SUNW* directories.
8. Exit the root role. No need to reboot.
General Installation Notes The following are general notes about the installation.
Selecting the Default Java Platform This section describes how the default Java platform is selected when running the Oracle Solaris SVR4 package installation (via the pkgadd command) of the JDK.
The Default Java Platform - Several versions of the Java platform can be present simultaneously on a Oracle Solaris system (using the default Oracle Solaris package installations), but only one can be the "default" Java platform. The default Java platform is defined by the directory that the /usr/java symbolic link points to. To determine the default version of the java executable, run:
% /usr/java/bin/java -fullversion The /usr/java symbolic link can change the default Java platform because there are symbolic links in /usr/bin (also known as /bin) that use it. (For example, the /usr/bin/java link refers to /usr/java/bin/java, which is the Java Runtime Environment). Many Java applications are compatible with later versions of the Java platform, but some applications might be less compatible.
PATH Setting - The default Java is linked through /usr/bin, such as /usr/bin/java. If this is in the path before another version of Java is in the path, then that will be the version of Java run from the command line or from any other tool that uses the PATH environment variable to locate Java.
9.添加环境变量
在/etc/profile文件最后添加export PATH=/usr/java/bin/amd64:$PATH,重启或者运行source /etc/profile, 64位jdk就安装好了。运行 java –version后,显示:
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
2 JDK1.7安装
下载文件:jdk-7u4-solaris-i586.tar.Z
jdk-7u4-solaris-x64.tar.Z
安装步骤:
(1)拷贝到usr下java文件夹
解压:zcat jdk-7u4-solaris-i586.tar.Z | tar xf -
zcat jdk-7u4-solaris-x64.tar.Z| tar xf -
解压jdk-7u4-solaris-i586.tar.Z得到文件夹(SUNWj7rt, SUNWj7dev, SUNWj7cfg,SUNWj7man,SUNWj7jmp,SUNWjavadb-client, SUNWjavadb-common,SUNWjavadb-core,SUNWjavadb-demo,SUNWjavadb-docs,SUNWjavadb-javadocSUNWjavadb-service)和一些文件在当前文件夹下。
解压jdk-7u4-solaris-x64.tar.Z为64位机器创建了另外一些目录:SUNWj7rtx, and SUNWj7dmx
(2)卸载solaris自带或者以后安装的jdk版本
用pkginfo | grep SUNWj 查看以前的jdk版本
比如说查看1.6的 就是pkginfo
| grep SUNWj6
比如说查看1.5的 就是pkginfo
| grep SUNWj5
然后用pkgrm 卸载上边pkginfo | grep SUNWj查看到的包,可能要多点几次y
java -version 看版本 1.6删完了 还可能有1.5的 接着删,直到java -version 显示java没有安装为止
(3)安装jdk1.7
#pkgadd -d . SUNWj7rt SUNWj7dev SUNWj7cfg SUNWj7man SUNWjavadb-client SUNWjavadb-common SUNWjavadb-core SUNWjavadb-demoSUNWjavadb-docs SUNWjavadb-javadoc SUNWjavadb-service
#pkgadd -d . SUNWj7rtx SUNWj7dmx
(4)配置环境变量:修改/etc/profile文件最后行加上
export PATH=/usr/jdk/jdk1.7.0_04/bin/amd64:$PATH
export JAVA_HOME=/usr/jdk/jdk1.7.0_04
(5)source /etc/profile 使环境变量生效
3 ant安装
(1)下载apache-ant-1.8.2-bin.tar.gz
(2)解压到/usr/java下,依次执行下列命令
cd /usr/java
gzip -d apache-ant-1.8.2-bin.tar.gz
tar xvf filename.tar
(3)配置ant环境变量
vi /etc/profile
在文件最后加上:
ANT_HOME=/usr/java/apache-ant-1.8.2
PATH=$ANT_HOME/bin:$PATH
export ANT_HOME PATH
(4)设置环境变量立即生效
source /etc/profile
4 配置gcc环境变量
使用solaris自带的gcc3.4.3
(1)vi /etc/profile
文件最后加上
PATH="$PATH":/usr/sfw/bin:/usr/ccs/bin
export PATH
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/usr/sfw/lib
export LD_LIBRARY_PATH
(2)设置环境变量立即生效:source /etc/profile