简体   繁体   中英

Unable to open specific JAR file in Java Code

I'm not able to open my JAR file using the following code. Though, I'm able to open other JAR files.

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.

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. Can you invoke it from 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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