gpt4 book ai didi

java - 在ubuntu 10.10上安装jdk1.7.0

转载 作者:搜寻专家 更新时间:2023-10-31 20:29:56 27 4
gpt4 key购买 nike

我是 ubuntu 10.10 的新手,我将它用作 VM。我尝试安装 jdk 1.7 以从终端运行 java 程序。我按照链接中的说明进行操作:How to Install Oracle Java on Ubuntu Linux .安装完成后,我尝试测试运行一个 Hello World java 程序。当我执行 javac Hello.java 时程序编译成功。然而,当我尝试使用 java Hello 运行该程序时,它没有在终端上给出任何输出并给出以下内容:

Unable to launch the application.

异常(exception):

CouldNotLoadArgumentException[ Could not load file/URL specified: Hello]
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:722)

包装异常

java.io.FileNotFoundException: Hello (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:722)

此外,我尝试使用 java -version 检查我的 java 版本,它给出了以下输出:

 Java(TM) Web Start 10.0.0.147-fcs 
Usage: javaws [run-options] <jnlp-file>
javaws [control-options]
where run-options include:
-verbose display additional output
-offline run the application in offline mode
-system run the application from the system cache only
-Xnosplash run without showing a splash screen
-J<option> supply option to the vm
-wait start java process and wait for its exit

control-options include:
-viewer show the cache viewer in the java control panel
-clearcache remove all non-installed applications from the cache
-uninstall remove all applications from the cache
-uninstall <jnlp-file> remove the application from the cache
-import [import-options] <jnlp-file> import the application to the cache

import-options include:
-silent import silently (with no user interface)
-system import application into the system cache
-codebase <url> retrieve resources from the given codebase
-shortcut install shortcuts as if user allowed prompt
-association install associations as if user allowed prompt

当我尝试使用 java 运行程序时,我在这里看到它使用了 javaws

我不明白为什么会这样或出了什么问题。任何帮助将不胜感激。我只是 Ubuntu 的初学者。提前致谢!!


编辑 1你好.java:

public class Hello
{
public static void main(String... s)
{
System.out.println("Hello World.!!!");
}
}

最佳答案

您的输出来自 java -version给你 javaws -version 的输出。所以这似乎是您的文件系统中的链接错误。如果您使用 update-alternatives,您会在您的二进制文件夹 (/usr/bin) 中创建一个符号链接(symbolic link)。也许你在学习教程时有一些错字?我很确定这就像 sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.7.0_05/bin/javaws" 1或类似的东西。

您可以尝试重新输入“update-alternative”命令。

关于java - 在ubuntu 10.10上安装jdk1.7.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11283409/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com