我如何code-签署任何捆绑JavaFX应用程序时所创建的可执行程序启动? [英] How do I code-sign the executable launcher that is created when bundling a JavaFX application?

查看:148
本文介绍了我如何code-签署任何捆绑JavaFX应用程序时所创建的可执行程序启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这么多的痛苦后,我来我的项目的完成,现在我需要知道如何code签署可执行文件。不,不是的.jar,我知道该怎么做。我需要的是能够为code-签署推出为我们的用户的.jar .exe文件,让他们没有看到你想允许来自未知发布者下面的程序警告消息。

So after much pain I'm coming to the completion of my project and now I need to know how to code sign the executable. No, not the .jar, I know how to do that. What I need is to be able to code-sign the .exe file that launches the .jar for our users, so that they don't see the "Do you want to allow the following program from an unknown publisher" warning message.

我知道如何与INNO脚本定制过程,我可以用它来code-签署安装程序,我知道如何包括将用于可执行文件和快捷方式不同的图标文件,我知道如何$ C $通过Ant脚本C-签署的jar,但此,逃避我完全。

I know how to customize the process with an INNO script and I can use that to code-sign the installer, and I know how to include different icon files that will be used for the executables and shortcuts, and I know how to code-sign the jar through the ANT script, but this, this eludes me entirely.

因此​​,没有人知道我可以去code-签约捆绑一个自包含JavaFX应用程序时启动罐子中的.exe?

So, does anyone know how I can go about code-signing the .exe that launches the jar when bundling a self-contained JavaFX application?

推荐答案

好了,所以我找到了。这是pretty痛苦的,因为有(如果我使用这个词在正确的上下文)比赛条件在这里,如果你开始再次运行过程之前,code签约没有完成,它失败,因为它不能与.exe文件,因为它正由另一个进程做任何事情。

Okay so I found it. This is pretty painful because there are (if I'm using this term in the correct context) "race conditions" here in that if the code signing doesn't finish before you start running the process again, it fails because it can't do anything with the .exe because it's being used by another process.

只要你的IDE中运行管理员(对于Windows反正)原来就没有必要要么提升你的脚本。

Turns out as long as your IDE is running in Admin (for Windows anyway) there's no need to elevate your script either.

Anyay,我的问题是,该文件已被设置为只读。很烦人所幸的VBScript允许您更改文件属性,所以它只是一个做的事情,试图$ C $之前C-签名:

Anyay, my problem was that the file was being set as Read-Only. VERY annoying but fortunately VBScript allows for you to change a files attributes so it was just a matter of doing that before trying to code-sign it :

<?xml version = "1.0" ?>
<package>
    <job id="CodeSign">
    <script language = "VBScript">
        <![CDATA[    
            'Set File as Normal. . .

            Dim objFSO, objFile
            Set objFSO = CreateObject("Scripting.FileSystemObject")
            Set objFile = objFSO.GetFile("<Relative Path>\<File.exe>")
            objFile.Attributes = 0

            Dim Shell
            Set Shell = WScript.CreateObject("WScript.Shell")
            Shell.Run "<Code Sign> ""<Relative Path>\<File.exe>""", 1, True
            Set Shell = Nothing
            Set objFSO = Nothing
            Set objFile = Nothing
        ]]>
    </script>
    </job>
</package>

所以,现在,终于,终于我们有一个完整的和可行的答案,显然很深奥的问题,没有人,但我自己已经处理了(或者是一个非常讳莫如深,我不知道它):你怎么code-通过签署一个JavaFX包创建的可执行文件之前,它被存储在哪里?

So now, finally, at LONG LAST we have a complete and viable answer to this, evidently very esoteric question that no one but myself has dealt with (or is a very closely guarded secret, I'm not sure which) : How do you code-sign the executable created by a JavaFX bundle before it gets stored?


  • 用JavaScript或VBScript中创建一个WSF文件(你
    preference)

  • 添加在该文件被保存到类路径的目录(NetBeans的,你去工具 - >选项 - > Java选项卡,选中添加目录到类路径,浏览到该目录下,并将其添加)。

  • 在您的WSF文件,在脚本部分,获取文件对象,并设置其属性为正常(0)。

  • 然后Shell.Run的code签名的应用程序的preferred方法。 1示出的是code登录窗口,真正是让VBScript中等待,直到它完成,以希望避免出现竞争状况。

.exe文件将一直保存在WSF脚本文件,使相对路径总是要一级目录&LT;文件名&GT; \\&LT; FILENAME.EXE&GT;

The .exe will ALWAYS be stored one directory up from the WSF script file so the relative path is always going to be <FILENAME>\<FILENAME.exe>.

我真的,真的希望这样可以节省别人悲伤了很多有一天...

I really, REALLY hope this saves someone a LOT of grief some day...

这篇关于我如何code-签署任何捆绑JavaFX应用程序时所创建的可执行程序启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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