在Windows中将自定义文件扩展名与java应用程序相关联

问题描述:

我想在Windows下将几个文件扩展名链接到我的java应用程序中。当用户双击带有链接扩展名的文件时,我想打开我的应用程序,我需要知道启动应用程序的文件路径。

I would like to "link" few file extensions to my java application under windows. When user double clicks file with "linked" extension, I would like to open my app and I need to know path to file that launched app.

如果部署应用程序。使用 Java Web Start ,可以在启动文件中声明对文件类型的兴趣。请参阅演示。文件服务,...

If you deploy the app. using Java Web Start, an interest in file-types can be declared in the launch file. See the demo. of the file services, which..


..提示用户关联文件扩展名。 zzz (只是一种不太可能与现有文件关联冲突的文件类型)内容类型 text / sleepytime 。 ..

..prompts the user to associate file extension .zzz (simply a file type unlikely to * with existing file associations) of content type text/sleepytime. ..

当用户双击 .zzz 文件时,它应该是在应用程序中打开。实际上,提示这个词并不是整个故事。如果启动沙盒版本,系统将提示您关联文件类型。受信任的版本不会提示。

When the user double clicks a .zzz file, it should open in the app. Actually, the word 'prompts' there is not the whole story. If you launch the sand-boxed version you will be prompted as to associating the file-type. The trusted version does not prompt.

要向流程添加更多用户控制,请查看 IntegrationService 在1.6.0_18(我还没有那个演示。)在与用户核实后,您可以在启动时运行它。

To add more user-control to the process, look to the IntegrationService that was introduced in 1.6.0_18 (I don't have a demo. of that one yet). You might run it at start-up, after checking with the user.