Run Java application as administrator on Windows

后端 未结 2 851
没有蜡笔的小新
没有蜡笔的小新 2021-01-06 00:10

I am writing an installer in Java that will accordingly require elevated privileges to access the Program Files directory. Based on information that I\'ve found online, I\'

2条回答
  •  悲&欢浪女
    2021-01-06 00:44

    I think that the best approach to achieve this is to use the tools that microsoft built for developers since you can't do it in simple Java. In this case use a manifest file http://msdn.microsoft.com/en-us/library/aa375632(v=vs.85).aspx Just build the wrapper .exe that asks for this privileges and then spawns your java program.

提交回复
热议问题