0

I have written an application in Java/Swing, which edits a bespoke filetype.

I have also implemented drag & drop to add further files to edit. I have added mimetypes to my desktop environment so that a double click starts my application & opens the file.

My Problem is, when I double click on a second file, it starts a second instance of my program. How do i setup this to open the second file in the initial instance of my application ?

As this is StackOverflow, not AskUbuntu...What needs to be done on the Java/Swing side to enable this to work?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
NWS
  • 3,080
  • 1
  • 19
  • 34
  • Which application, and how are you opening it? Are you using ProcessBuilder? – Gilbert Le Blanc Oct 10 '20 at 22:15
  • @GilbertLeBlanc Its my own application. The problem is to have my application listen & process file open requests from the desktop. Not using ProcessBuilder. – NWS Oct 10 '20 at 22:18
  • Since it's your own application, there's no way we can help you debug the problem without seeing code. If you would create a [mre] of your application, it would be helpful. – Gilbert Le Blanc Oct 10 '20 at 22:24
  • There is no code to post, as I don't know where to begin implementing this feature. Many java applications have this feature, so it is possible, a starting point is what is needed. – NWS Oct 10 '20 at 22:48
  • 1
    [How to allow running only one instance of a Java program at a time?](https://stackoverflow.com/questions/920386/how-to-allow-running-only-one-instance-of-a-java-program-at-a-time) – Gilbert Le Blanc Oct 10 '20 at 22:52
  • Also see https://stackoverflow.com/questions/177189/how-to-implement-a-single-instance-java-application. – VGR Oct 10 '20 at 23:55
  • @GilbertLeBlanc - Thanks All - I will investigate further with the linked questions. – NWS Oct 11 '20 at 07:26

0 Answers0