简体   繁体   中英

java: when running jar file from icon Runtime.getRuntime.exec() doesn't work

so I have this problem. I have an aplication, which is using Runtime.getRuntime.exec(adobePath) to run Adobe Reader. When I run my aplication using NetBeans or from cmd line by using java -jar "MyApp.jar" it does work fine. But when I run jar file by double-click or from cmd using MaApp.jar it doesn't work. I'm using Windows 7.

What can be wrong?

Thanks

edit: Maybe I said it wrong way. When I run jar file by double-click it does run. And it works, but when Runtime.getRuntime.exec(adobePath) is called nothing happens. And It work fine in NetBeans or when I run App by java -jar "MyApp.jar" .

Right-click on the jar and see under Open With ?

Make Java Runtime as default program to run with.

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