从jar中将manifest添加到已编译的exe文件中 [英] add manifest to compiled exe file from jar

查看:167
本文介绍了从jar中将manifest添加到已编译的exe文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可运行的MyApp.jar,我使用launch4j编译成MyApp.exe,因为这个应用程序需要管理员权限,我尝试通过以下文章添加清单文件: http://msdn.microsoft.com/en-us/library/bb756929.aspx
我执行

I've a runnable MyApp.jar which I compiled to MyApp.exe by using launch4j and because this app need administrator permissions I try to add manifest file to it by following this article : http://msdn.microsoft.com/en-us/library/bb756929.aspx When I perform

mt.exe –manifest manifest.xml –outputresource:MyApp.exe;#1

完成过程没有错误,但MyApp.exe文件只将其大小从6mb减少到32kb,当我尝试运行它时,我得到了以下错误:错误:jarfile无效或损坏。
也许有人知道它有什么问题?
我的清单文件附在下面:

the process completed without errors but MyApp.exe file reduces its size from 6mb to 32kb only and when I try to run it I got the following error: Error: Invalid or corrupt jarfile. Maybe somebody know what's wrong with it? My manifest file is attached below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="MyApp.exe"
     type="win32"/> 
  <description>{app name}</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="true"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>


推荐答案

最后我们通过launch4j添加清单文件解决了这个问题应用程序在编译期间将 uiAccess 标记从 true 更改为 false uiAccess =false尽管我们的应用程序是图形的,否则它不起作用。

Finally we have solved this by adding manifest file through launch4j app during compilation time and changed uiAccess flag from true to false uiAccess="false" despite of the fact that our application is graphic, otherwise it didn't work.

我使用过这个文件:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="MyApp.exe"
     type="win32"/> 
  <description>{app name}</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

并把它放在这里:

And put it here:

这篇关于从jar中将manifest添加到已编译的exe文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆