我是ubuntu 10.10的新手,并且正在使用它作为虚拟机。我试着安装jdk 1.7从终端运行java程序。我遵循链接中的说明:How to Install Oracle Java on Ubuntu Linux。安装完成后,我试着运行一个Hello World java程序。程序编译成功,当我做javac Hello.java
。然而,当我试图运行使用java Hello
程序,它并没有给终端上的任何输出,给了我下面的:在Ubuntu 10.10上安装jdk1.7.0
Unable to launch the application.
例外:
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
我在这里看到它使用javaws
当我尝试运行程序使用java
。
我不明白为什么会发生这种情况或发生了什么问题。任何帮助将非常感激。我只是Ubuntu上的初学者。 在此先感谢!
编辑1 Hello.java:
public class Hello
{
public static void main(String... s)
{
System.out.println("Hello World.!!!");
}
}
你需要显示'Hello.java'。 – Starkey
我现在已经提供了这个问题作为编辑。 – akaHuman
奇怪,请问为什么你使用Ubuntu 10.10(相当过时)?如果从安装目录中调用java,输出是什么? – home