Running Windows commandline from Java as an Administrator - Creating a .manifest file

本小妞迷上赌 提交于 2019-12-01 11:04:34

The application manifest described here, and the Java manifest file (in the JAR file at META-INF/MANIFEST.MF), are two completely separate concepts that share only a name. There's nothing in META-INF/MANIFEST.MF that will help a Java executable gain elevation.

Besides, its the JVM that needs the elevation, not the class files. Putting the .manifest file with all your class files will not achieve anything.

If I had to do something like this, my preferred approach would be to use a program such as elevate.exe to call CHKDSK. elevate.exe can be found at this blog article linked to in the question you've mentioned. I haven't tested elevate.exe, and the author originally wrote it for Windows Vista, so I don't know how well it works on Windows 7.

It seems that CHKDSK is the only part of your app that requires elevation. If so, it would make sense from a security point-of-view not to have the whole app elevated all of the time when most of the time it can manage without.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!