我是 ubuntu 10.10 的新手,并将其用作 VM。我尝试安装 jdk 1.7 以从终端运行 java 程序。我按照链接中的说明进行操作:如何在 Ubuntu Linux 上安装 Oracle Java。安装完成后,我尝试运行一个Hello World java程序。当我这样做时,程序编译成功javac Hello.java
。但是,当我尝试使用 运行程序时java Hello
,它没有在终端上给出任何输出,而是给了我以下信息:
无法启动应用程序。
例外:
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
使用java -version
,它给出了以下输出:
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
我在这里看到它javaws
在我尝试使用java
.
我不明白为什么会发生这种情况或出了什么问题。任何帮助将不胜感激。我只是 Ubuntu 的初学者。提前致谢!!
编辑 1 Hello.java:
public class Hello
{
public static void main(String... s)
{
System.out.println("Hello World.!!!");
}
}