我可以通过 cmd 运行 .jar 文件,但我不能双击它们 [英] I can run .jar files through cmd, but I cannot double click them

查看:27
本文介绍了我可以通过 cmd 运行 .jar 文件,但我不能双击它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我下载一个 .jar 文件说在我的世界中安装一个 mod 并双击它时,它没有运行.装载轮运行了大约两秒钟然后停止,没有其他任何事情发生.我知道的 .jar 设置正确,因为它通过命令运行 cmd

When I download a .jar file to say install a mod to minecraft and double click it, it doesn't run. The loading wheel goes for like two seconds and then stops, and nothing else happens. The .jar I know is set up right because it runs through cmd with the command

    cd "wherever the file is"
    java -jar "file name".jar

所以我已经尝试使用 javajdk1.7.0_25jrein 中设置为 javaw.exe 的默认程序运行它.什么都没有发生的地方.所以文件关联设置到了正确的位置.我在这里不知所措.

So I've already tried to run it with the default program set as javaw.exe in the javajdk1.7.0_25jrein. Same where nothing happens. So the file association is set to the right place. I am at a loss here.

这还不错,因为我仍然可以通过 cmd 运行它们,但是当我进入书中关于 jars 的部分时,我希望能够通过 Windows Explorer GUI 运行它,这就像一半使用我可以看到的 .jar 文件的好处.

It isn't so bad since I can still run them through cmd, but when I get to the part in the book about jars, I want to be able to run it through the Windows Explorer GUI, which is like half the benefit of using .jar files that I can see.

是否可能是注册表错误?我已经看到很多专门针对这个问题的问题,但其中大部分似乎是设置 .jar 的问题,我没有这样做,我认为这里不是这种情况.

Is it possibly a registry error? I have seen a lot of questions specifically about this problem, but most of them it seems were problems with setting up the .jar, which I didn't do, and I don't think that is the case here.

我有 Windows Vista 64 位.

I have Windows Vista 64bit.

如果我不够具体,请随时提问.

If I wasn't specific enough, feel free to ask.

推荐答案

我遇到了同样的问题,结果是注册表中的 .jar 文件关联被破坏了.以下步骤修复了它:

I had the same problem, and it turns out that the .jar file association in the registry was broken. The following steps fixed it:

  • 打开注册表编辑器,导航到HKEY_CLASSES_ROOTjarfileshellopencommand,修改Default键的值如下
  • [您的JRE的位置]替换为[您的JRE的位置]injavaw.exe";-jar%1"%* 与你的 JRE 的根目录安装.例如,C:Program FilesJavajre7injavaw.exe"-jar%1"%*.
  • HKEY_LOCAL_MACHINESOFTWAREClassesjarfileshellopencommand重复上述步骤.
  • Open the Registry Editor, and navigate to HKEY_CLASSES_ROOTjarfileshellopencommand, and modify the value of the Default key as follows
  • Replace [Location of your JRE] in "[Location of your JRE]injavaw.exe" -jar "%1" %* with the root directory of your JRE installation. For example, "C:Program FilesJavajre7injavaw.exe" -jar "%1" %*.
  • Repeat the above steps for HKEY_LOCAL_MACHINESOFTWAREClassesjarfileshellopencommand.

我有一台 Windows 7 机器,但我认为这也适用于 32 位环境.

I have a Windows 7 machine, but I assume this would work for 32-bit environments as well.

修复了示例中的路径 - 它应该使用程序文件"目录而不是程序文件 (x86)".

Fixed the path in the example - it should use the "Program Files" directory and not "Program Files (x86)".

这篇关于我可以通过 cmd 运行 .jar 文件,但我不能双击它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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