solaris下安装jdk7

 
    % /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

相关文章:

  • 2021-07-13
  • 2021-05-10
  • 2021-08-02
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
猜你喜欢
  • 2022-03-09
  • 2021-09-26
  • 2022-01-03
  • 2021-08-23
  • 2021-09-30
  • 2022-12-23
相关资源
相似解决方案