在 Windows 上运行 JAR 文件 [英] Running JAR file on Windows

查看:26
本文介绍了在 Windows 上运行 JAR 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 helloworld.jar 的 JAR 文件.为了运行它,我在命令行窗口中执行以下命令:

I have a JAR file named helloworld.jar. In order to run it, I'm executing the following command in a command-line window:

java -jar helloworld.jar

这很好用,但是我该如何通过双击来执行它呢?我需要安装任何软件吗?

This works fine, but how do I execute it with double-click instead? Do I need to install any software?

推荐答案

最简单的方法可能是升级或重新安装 Java Runtime Environment (JRE).

Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE).

或者这个:

  • 打开 Windows 资源管理器,从工具中选择文件夹选项..."
  • 单击文件类型"选项卡,向下滚动并选择 JAR 文件类型.
  • 按高级"按钮.
  • 在编辑文件类型"对话框中,选择在操作"框中打开并单击编辑..."
  • 按浏览按钮并导航到 Java 解释器 javaw.exe 的位置.
  • 在Application used to perform action字段中,需要显示类似C:Program FilesJavaj2re1.4.2_04injavaw.exe" -jar "%1" %(注意:以javaw"开头的部分必须完全相同;路径名的另一部分可能会因您使用的 Java 版本而异)然后按 OK 按钮直到所有对话框都关闭.
  • Open the Windows Explorer, from the Tools select 'Folder Options...'
  • Click the File Types tab, scroll down and select JAR File type.
  • Press the Advanced button.
  • In the Edit File Type dialog box, select open in Actions box and click Edit...
  • Press the Browse button and navigate to the location the Java interpreter javaw.exe.
  • In the Application used to perform action field, needs to display something similar to C:Program FilesJavaj2re1.4.2_04injavaw.exe" -jar "%1" % (Note: the part starting with 'javaw' must be exactly like that; the other part of the path name can vary depending on which version of Java you're using) then press the OK buttons until all the dialogs are closed.

从这里被盗的:http://windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html

这篇关于在 Windows 上运行 JAR 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆