私はubuntu 10.10を初めて使用し、VMとして使用しています。jdk 1.7 をインストールして、端末から Java プログラムを実行しようとしました。リンクの指示に従いました: How to Install Oracle Java on Ubuntu Linux。インストールが完了した後、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.!!!");
}
}