我是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