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

查看:465
本文介绍了在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。

  • 在用于执行操作的应用程序字段中,需要显示类似于的内容C:\Program Files \ Java2 \\ j2re1.4.2_04\bin\javaw.exe-jar%1%(注意:以'javaw'开头的部分必须与此完全相同;路径的其他部分名称可能因您使用的Java版本而异,然后按确定按钮,直到所有对话框都关闭。

  • 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 Files\Java\j2re1.4.2_04\bin\javaw.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天全站免登陆