最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

DoubleClick to start Java-Application, in Windows-Explorer - Stack Overflow

programmeradmin4浏览0评论

I have a Java application, an executable Jar. And the Java application starts via the CMD console (java -jar MyApp.jar or javaw MyApp), another CMD console.


import java.io.IOException;

public class StartApplication {
    
    public static void main(String[] args) {
        try {
            String command = "cmd.exe /k start";
            Process process = Runtime.getRuntime().exec(command);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

That works fine. But how do I start the application from Windows Explorer, with a double click, because the CMD does not open or the program does not start. How can I start the application in Windows Explorer? Using “Open with” and selecting the Java directory does not work. Is there a special configuration I need to make or have I forgotten something I should do beforehand?

This problem feels like I'm a beginner again....

发布评论

评论列表(0)

  1. 暂无评论