简体   繁体   English

在Ubuntu上设置SUN Java环境

[英]Setting SUN Java environment on Ubuntu

I just installed Ubuntu 10.04 on my personal laptop and wanted to set up my development environment on this. 我只是在个人笔记本电脑上安装了Ubuntu 10.04,并想在此基础上设置开发环境。

I see that when i run the command 我看到当我运行命令

Installed SUN JDK through synaptic package manager and executed this command: 通过突触软件包管理器安装SUN JDK并执行以下命令:

sudo update-java-alternatives -s java-6-sun 须藤更新Java替代品-s Java-6 Sun

But when i run the command which java 但是当我运行which java命令

the output displayed is 显示的输出是

/usr/bin/java / usr / bin / java

How do i make sure that it is Sun JDK and not OpenJDK (which was installed in ubuntu by default) 如何确定它是Sun JDK而不是OpenJDK(默认情况下已安装在ubuntu中)

My only concern is : 我唯一关心的是:

I want only SUN JDK to be used for all purposes. 我只想将SUN JDK用于所有目的。 I do not want OpenJDK.. 我不要OpenJDK。

Thanks in Advance.. 提前致谢..

You can config the used JavaVM with: 您可以使用以下配置JavaVM:

sudo update-alternatives --config java

Or you just remove all open-jdk packages. 或者,您只需删除所有open-jdk软件包。

您可以通过查看Java版本

java -version

Correct me if I'm wrong... 如果我错了纠正我...

I think you can run echo $PATH and it'd give you the list of directories in exact order they're supposed to be scanned when the system trying to run the command. 我认为您可以运行echo $PATH ,它会以系统尝试运行命令时应扫描的确切顺序为您提供目录列表。

So, I can see several options to resolve: 因此,我可以看到几个解决方案:

  1. If your default java version is wrong, just remove it and install the correct one. 如果您的默认Java版本错误,则将其删除并安装正确的版本。
  2. If you need several versions of java by any reason, you can: 如果出于任何原因需要多个版本的Java,则可以:

    1. modify your PATH environment making your new java path with higher priority. 修改PATH环境,使新的Java路径具有更高的优先级。 Ig: Ig:

       export PATH=/usr/java_xyz/bin:$PATH 
    2. Set your JAVA_HOME environment pointing to new java and make your calls with something like: 将您的JAVA_HOME环境设置为指向新的Java并使用以下命令进行调用:

       $JAVA_HOME/bin/java blablabla.class 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM