开发者

Drop file onto .jar and pass filename to main()

开发者 https://www.devze.com 2023-02-07 05:57 出处:网络
I\'d like to 开发者_开发知识库drop a file onto my jar and have the filename passed on to my main method as argument.

I'd like to 开发者_开发知识库drop a file onto my jar and have the filename passed on to my main method as argument. I'm on OSX. How can I do that?


If the app. is deployed using Java Web Start, a file association can be declared. Double click any file of that type and the path of the file is supplied to the main(String[]).

BTW - here is a demo. of the JNLP file API. Note well the 2nd bug report, which would mean a minimum version of 1.6.0_10+ in order not to delete a file dropped on the application's icon.


To do this on OSX you might have to create an application bundle from your .jar. This process is documented pretty well at the Apple Developer Center (scroll down to "Mac OS X Application Bundles"). You can build a Java app which blends really well into the OSX desktop if you follow what they present there, and it's pretty easy.

0

精彩评论

暂无评论...
验证码 换一张
取 消