I have a Java program that I've made which opens and uses .project files. As long as I open the files from within the program everything works fine. However I want to be able to install the program and register (maybe even maintain) file association so that when the user will double click on a .project file one of two things will happen:
- If the program is not running, the program will launch and will have the file path (complete with name and extension) passed to it so it could open the clicked file.
- If the program is already running, do not open a second instance of the program but rather pass the file path (complete with name and extension) to the program so it could open it.
I've scoured the internet and found things such as: The Java™ Tutorials and Stack Overflow - inno setup file association but these answers are confusing. They talk about using external programs (is this necessary?) and don't explain properly how to accomplish file association in them or talk about Ant code while building in Netbeans (which I am using) but I don't really understand how to start Ant code, if I need to add it, add a new .xml file to the project or whatever.
I've tried manually associating my built JAR file in the Windows association list but it will not accept it. I am guessing I need it installed and/or converted somehow into an .exe.
In any case I want to distribute the program to others and so it needs to be done automatically.
I would prefer to have this work on multiple platforms but I am most concerned with this working on Windows (Windows 10).