-2

I've compiled my Java program into the Mac's .app format using the javapackager command. How do I get the files that a user will open my program with using the system's "Open With" context menu command?

For example, if I had a file MyFile.txt on the desktop and I right clicked and opened it with my program, how do I access MyFile.txt?

William
  • 11
  • 4
  • There is a the same question on `apple.stackexchange`, so I can't mark it as a duplicate. https://apple.stackexchange.com/questions/15030/how-can-i-add-a-new-application-to-the-open-with-menu – Arnaud Claudel Aug 15 '19 at 18:25
  • That question is how to add it to the "Open with" menu. I'm asking after it has been added to the menu, how do you access the file that was right clicked on. – William Aug 15 '19 at 19:19
  • Have you checked the parameters ? The path is likely to be here – Arnaud Claudel Aug 15 '19 at 20:21
  • 1
    Nothing is passed to the main() method. – William Aug 15 '19 at 20:57

1 Answers1

0

I think file associations was what I was looking for (https://docs.oracle.com/javase/tutorial/deployment/selfContainedApps/fileassociation.html). Thanks to Reddit user PhantomOTOpera. But I still haven't managed to figure out how to get the file.

William
  • 11
  • 4