我正在编写一个java应用程序,它可以处理标准链接(http
/ https
)。
如何将我的应用程序注册为在Windows 10中打开这些链接(即默认浏览器)的默认程序?
我知道我可以在Windows设置中选择默认浏览器,但它只显示有限的列表,无法连接自定义程序。
我找到了this,但它只显示了如何在win10之前完成它,而且我不确定它是否可以在java中完成。
答案 0 :(得分:2)
exe
。我使用了launch4j。确保已设置textVersion
和icon
。
注册客户
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities]
'ApplicationDescription'='MyApp'
'ApplicationIcon'='C:\MyApp\MyApp.exe,0'
'ApplicationName'='MyApp'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities\URLAssociations]
'http'='MyAppURL'
'https'='MyAppURL'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\DefaultIcon]
@='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\shell\open\command]
@='C:\MyApp\MyApp.exe'
注册网址处理程序
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL]
@='MyApp Document'
'EditFlags'=0x2
'FriendlyTypeName'='MyApp Document'
'URL Protocol'=''
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\DefaultIcon]
@='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell]
@='open'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell\open\command]
@='"C:\MyApp\MyApp.exe" --url "%1"'
注册默认程序
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
'MyApp'='Software\Clients\StartMenuInternet\MyApp\Capabilities'