简体   繁体   中英

Java application doesn't know name of file being opened - Mac OS X

I have a Java application in an application bundle that has a file association (using Info.plist) that runs when a document is double-clicked. How do I get the filename of the document that was double-clicked in my Java application? Right now my Java app just runs and displays an empty document. There doesn't seem to be any command line arguments passed to the application.

I think you have to implement ApplicationListener or extend ApplicationAdapter and implement the handleOpenFile() method. See http://today.java.net/pub/a/today/2004/01/05/swing.html for a more elaborate explanation.

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