listen for “open file with my java application” event on windows

痴心易碎 提交于 2019-12-03 15:25:36

Based on the documentation you linked to, it looks like you can do this:

StartupNotification.registerStartupListener(new StartupNotification.Listener() {
    public void startupPerformed(String parameters) {
        System.out.println("Startup performed with parameters " + parameters);
    }
});

Since startupPerformed will be called from different threads, you will need to make sure that the code that handles these notifications is thread-safe.

The documentation also says:

For multiple files, files are surrounded by double-quotes and separated by spaces.

So you will need to parse the parameter string yourself as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!