开发者

Programatically associating file types with .jar file

开发者 https://www.devze.com 2023-03-07 16:07 出处:网络
I know how to manually associate a file type with a .jar file: assoc .ext=filetype ftype filetype=\"C:\\Program Files\\Java\\jre6\\bin\\javaw.exe\" -jar \"path\\to\\jar\\file\\YourJarFile.jar\" \"%1\"

I know how to manually associate a file type with a .jar file:

assoc .ext=filetype
ftype filetype="C:\Program Files\Java\jre6\bin\javaw.exe" -jar "path\to\jar\file\YourJarFile.jar" "%1"

I'm currently using Runtime.exec() to try to do these commands, but I'm getting Access is d开发者_C百科enied. from the assoc command. I assume I need administrator privileges to run assoc, how can one do this from a java application?


try cmd /c assoc or such. It's an embedded command processor command


That should have connections with environnements context. try using the complete file path to assoc

0

精彩评论

暂无评论...
验证码 换一张
取 消