简体   繁体   English

无法在Java代码中打开特定的JAR文件

[英]Unable to open specific JAR file in Java Code

I'm not able to open my JAR file using the following code. 我无法使用以下代码打开我的 JAR文件。 Though, I'm able to open other JAR files. 不过,我可以打开其他 JAR文件。

try {  
        Desktop.getDesktop().open(new File("myPlugin.jar"));  
     }  
       catch(Exception exception) {  
        exception.printStackTrace();  
        }    
      }

I don't know if I'm exporting the JAR file incorrectly or some error in the Manifest file. 我不知道我导出的JAR文件不正确还是清单文件中的某些错误。

Manifest-Version: 1.0
Class-Path: .
Main-Class: Reader

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks. 谢谢。

也许尝试输入文件的完整路径

Sounds like you are asking Windows to invoke your jar-file. 听起来您正在要求Windows调用您的jar文件。 Can you invoke it from CMD.EXE? 您可以从CMD.EXE调用它吗?

java -jar myPlugin.jar

My guess is that you get an error, which is silently discarded. 我的猜测是您得到一个错误,该错误被静默丢弃。 Running from CMD.EXE will show you the problem. 从CMD.EXE运行将向您显示问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM