this should be done during installation. How do you plan to let your user install your application?
you must understand at this point that you just made things a lot more difficult. registering file extensions means tampering with the registry. What happens if the user no longer wants your application? or moves a file running your application?
You will need to select the creator of the installation. here's the question: https://stackoverflow.com/questions/3767/what-is-the-best-choice-for-building-windows-installers
and then you will have to learn this installer creator language. here, as what you ask is done in nsis. remember that the script takes care of issues such as "if the user uninstalls my application and I did not change file associations during installation, should I remove these file associations when uninstalling?" so it's a little longer. here it is anyway: http://nsis.sourceforge.net/File_Association
perhaps this can be done in a simpler way in another installer creator.
however, in this example, you provide the nsis registration function for the start command for your application, and then add% 1 to it in the Windows file association start command. so you have to give it a start command
javaw -cp installpath\yourcode.jar package.name.MainClassName
and then everything should work out. this, of course, will require some experimentation, and you will need to be sure how to start the application from the command line.
Good luck
source share