Ubuntu上的Java安装问题 [英] Java installation issues on Ubuntu

查看:160
本文介绍了Ubuntu上的Java安装问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在我的新Ubuntu系统上安装Java(JDK 6)并获得一些奇怪的错误。这是我第一次使用任何 Linux的风格,所以我确定这是用户问题(权限或其他方式)。

Trying to install Java (JDK 6) on my new Ubuntu system and getting some bizarro errors. This is my first time ever using any flavor of Linux and so I'm sure it's a user issue (permissions or otherwise).

I直接从Oracle的站点下载BIN文件(64位Linux的Java SE 6u23)。这默认为下载到/ home / myUserName / Downloads。

I downloaded the BIN file directly off Oracle's site (Java SE 6u23 for 64-bit Linux). This defaulted to downloading to /home/myUserName/Downloads.

从那里我将文件移动到/ opt / java,这是我创建的目录,因为(作为Linux新手)有意义成为Java应该去的目录。

From there I moved the file to /opt/java, which was a directory I created, because (as a Linux novice) that made sense to be the directory where Java should go.

然后我按照我在网上找到的运行BIN的指令运行以下2个命令:

I then ran the following 2 commands, per instruction I found online for running BINs:

chmod +x jdk-6u23-linux-x64.bin
sudo ./jdk-6u23-linux-x64.bin

现在,在我的/ opt / java目录中,我看到了BIN文件和 jdk1。 6.0_23 目录在检查时似乎完好无损。

Now, in my /opt/java directory I see both the BIN file and the jdk1.6.0_23 directory that seems to be intact upon inspection.

,当我打开一个新终端并运行 java -version ,我得到:

But, when I open a new terminal and run java -version, I get:

程序'java'可以在以下包中找到:

- gcj- 4.4-jre-headless

- gcj-4.5-jre-headless

- openjdk-6-jre-headless

尝试:sudo apt-安装

The program 'java' can be found in the following packages:
- gcj-4.4-jre-headless
- gcj-4.5-jre-headless
- openjdk-6-jre-headless
Try: sudo apt-get install

这里发生了什么?!?

(1)尝试将/ opt / java设为我的Java目录是错误的吗?
$
(2)我是否运行了错误的命令?

(3) Java 1.6.0_23是否安装在我的机器上?
$
(4)那些gcj-xxx无头目标是什么?!?!

(1) Was I wrong to try and make /opt/java my Java directory?
(2) Did I run the wrong commands?
(3) Is Java 1.6.0_23 even installed on my machine?
(4) What are all those gcj-xxx-headless targets?!?!

感谢您的任何输入!

推荐答案

尝试将/ opt / java作为我的Java目录是错误的吗? / strong>

Was I wrong to try and make /opt/java my Java directory?

不是。许多Java开发人员安装多个JDK安装,并始终使用 /opt/jdk1.6.0_23 或类似路径。您下载的 bin 文件不是安装程序,而只是一个提取器。它不会将 java 二进制文件安装到系统文件夹中,如 / bin

Not really. Many Java developers install multiple JDK installations and always use /opt/jdk1.6.0_23 or similar paths. The bin file you downloaded is not an installer, but merely an extractor. It does not install the java binaries into system folders like /bin.

我通常下载JDK并从我的主文件夹中执行它,然后将其移至/ opt并执行chown。

I usually download the JDK and execute it from within my home folder and afterwards move it to /opt and performing an chown.

我有没有运行错误的命令?

不是真的。如果您想安装单独的JDK,则可以正确完成。如果您需要系统集成,最好使用特定于发行版的软件包,例如通过 aptitude install sun-java6-jdk 或类似软件安装的软件包。

Not really. In case you wanted to install a separate JDK, you did it correctly. In case you wanted system integration, you would be better off to use the distribution-specific packages, such as the one installed via aptitude install sun-java6-jdk or alike.

您下载的 bin 非常灵活,因为我可以使用它来安装多个Java的版本系统。我知道这是你在Linux机器上经常做的事情。

The bin you downloaded is imho more flexible, since I can use it to install multiple verisons of Java on the same system. I know this is something you don't often do on Linux machines.

如果你想使用 java 在命令行上使用二进制文件,您必须手动设置 PATH JAVA_HOME 环境变量。我认为在Ubuntu上是/ etc / environment或/ etc / profile之类的东西。

If you want to use the java binary on command line, you'd have to manually set up the PATH and JAVA_HOME environment variables. I think on Ubuntu that's /etc/environment or /etc/profile or something like that.

Java 1.6.0_23是否安装在我的机器上?

不是。见上面的答案。

那些gcj-xxx无头目标是什么?!

GCJ是Java的Gnu编译器。显然,它包括Java Development Kit和Java Runtime Environment。

The GCJ is the Gnu Compiler for Java. Obviously, it includes a Java Development Kit and a Java Runtime Environment.

这篇关于Ubuntu上的Java安装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆