为什么我无法在 Ubuntu 上安装 Java 的 bin 文件?

为什么我无法在 Ubuntu 上安装 Java 的 bin 文件?

我已经下载了一个版本JDK从 Oracle 的站点来看,该文件名为jdk-6u37-linux-i586.bin

为了在 Ubuntu 上安装它,我将其制作成可执行文件并运行它:

$ chmod +x jdk-6u37-linux-i586.bin
$ ./jdk-6u37-linux-i586.bin

我期望它安装 JDK,但是我得到的却是这样的:

./jdk-6u37-linux-i586.bin: line 1: html: No such file or directory
./jdk-6u37-linux-i586.bin: line 2: head: No such file or directory
./jdk-6u37-linux-i586.bin: line 3: title: No such file or directory
./jdk-6u37-linux-i586.bin: line 4: META: No such file or directory
./jdk-6u37-linux-i586.bin: line 5: link: No such file or directory
./jdk-6u37-linux-i586.bin: line 6: link: No such file or directory
./jdk-6u37-linux-i586.bin: line 7: $'\r': command not found
./jdk-6u37-linux-i586.bin: line 8: body: No such file or directory
./jdk-6u37-linux-i586.bin: line 9: div: No such file or directory
./jdk-6u37-linux-i586.bin: line 10: table: No such file or directory
./jdk-6u37-linux-i586.bin: line 11: tr: No such file or directory
./jdk-6u37-linux-i586.bin: line 12: syntax error near unexpected token `<'
./jdk-6u37-linux-i586.bin: line 12: `      <td rowspan="2" valign="middle" nowrap><a href="http://www.oracle.com"><img src="/errors/us/assets/oralogo-small.gif"'width="154" height="19" hspace="10" vspace="25" border="0" ></a></td>

使用 sudo 的话就是这样:

./jdk-6u37-linux-i586.bin: 1: cannot open html: No such file
./jdk-6u37-linux-i586.bin: 2: cannot open head: No such file
./jdk-6u37-linux-i586.bin: 3: cannot open title: No such file
./jdk-6u37-linux-i586.bin: 3: Request: not found
./jdk-6u37-linux-i586.bin: 4: cannot open META: No such file
./jdk-6u37-linux-i586.bin: 5: cannot open link: No such file
./jdk-6u37-linux-i586.bin: 6: cannot open link: No such file
: not foundlinux-i586.bin: 7: 
./jdk-6u37-linux-i586.bin: 8: cannot open body: No such file
./jdk-6u37-linux-i586.bin: 9: cannot open div: No such file
./jdk-6u37-linux-i586.bin: 10: cannot open table: No such file
./jdk-6u37-linux-i586.bin: 11: cannot open tr: No such file
./jdk-6u37-linux-i586.bin: 12: Syntax error: redirection unexpected

答案1

您显然尝试下载了无效链接。您尝试执行的是一个 html 文件,可能包含一些浏览器中会显示的错误。尝试使用浏览器手动下载 .bin,然后以相同方式执行它。

答案2

好的,我已经从您提供的链接下载了文件(没有使用 curl)。只需右键单击它,转到Properties > permissions并检查Allow Executing File as program。然后转到终端并写入文件路径(包括文件本身)。

我使用了浏览器,而不是curl因为使用 curl 时无法接受 Oracle 上的协议。这可能是您尝试使用 curl 下载时无法成功的原因。

对我有用。

相关内容