如何将 jnlp 文件与 javaws 关联

Bet*_*sta 10 java

我的java的实际版本是

$ java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
Run Code Online (Sandbox Code Playgroud)

并且可以将 jnlp 文件作为

$ javaws ContestAppletProd.jnlp
Run Code Online (Sandbox Code Playgroud)

(这是 TopCoder Contest Arena)

但我想通过简单的双击运行它。

当我右键单击文件时,有“用其他应用程序打开”选项,但我不知道如何在此处添加 javaws。

ben*_*der 15

You will need to create a .desktop file like described in the this post for javaws to appear in Open With dialog.

In your case you will need to create a new text file in the folder ~/.local/share/applications. Name this file whatever you want, it has to have the extension .desktop. The content of this file has to be the following:

[Desktop Entry]
Encoding=UTF-8
Name=Java 6 Web Start
Comment=Java 6 Web Start
Exec=/usr/lib/jvm/java-6-oracle/jre/bin/javaws %u
Terminal=false
Type=Application
Icon=javaws
Categories=Application;Network;
MimeType=application/x-java-jnlp-file;
Run Code Online (Sandbox Code Playgroud)

请注意,参数中javaws可执行文件的路径Exec可能与您的系统不同。您可以javaws通过在终端中键入以下命令来找出可执行文件的路径:

which javaws
Run Code Online (Sandbox Code Playgroud)

或者使用以下命令列出所有 JDK/JRE 安装:

update-alternatives --display javaws
Run Code Online (Sandbox Code Playgroud)