简体   繁体   English

使用Java应用程序进行Inno设置

[英]Inno Setup with a java application

I really want to use inno setup or another software like that to make a "professional" installer, where the application is distributed through a license key or serial, and I want to make sure the installer can only install just once on a given machine. 我真的想使用inno设置或类似的软件来制作“专业”安装程序,在该应用程序中,该应用程序是通过许可证密钥或序列号分发的,我想确保安装程序只能在给定的计算机上安装一次 This is to prevent people from copying files from the installation folder and pasting them into another computer. 这是为了防止人们复制安装文件夹中的文件并将其粘贴到另一台计算机中。 I have read a lot of topics on this, but it always goes to the same point, only 1 key for an installer which means it can be installed several times with the same key. 我已经阅读了很多主题,但是它总是指向同一点, only 1 key for an installer这意味着它可以用相同的密钥安装多次。

I had tried locking my app directly without the inno installer, by setting a check with the motherboard id, but it's not the way that I want and is not perfectly designed. 我曾尝试通过设置带有主板ID的支票来直接锁定我的应用,而无需安装inno安装程序,但这不是我想要的方式,并且设计不完美。 This is because the software can have several valid keys, but when someone uses one, the key isn't valid anymore. 这是因为该软件可以具有多个有效密钥,但是当有人使用一个密钥时,该密钥就不再有效。

If you know no what computer it will run, at programming stage, you can easily restrict other computers by explicitly checking at the IP address, at the beginning of your code. 如果您不知道它将在哪台计算机上运行,​​则可以在编程阶段通过在代码开头显式检查IP地址来轻松限制其他计算机。

In case you don't know which computer it will be, but run it just on the first computer, you should save on an internal resource file, that it had already runned once. 如果您不知道它将是哪台计算机,而只是在第一台计算机上运行,​​则应将其已经运行过一次,保存在内部资源文件中。 Writing to internal resource may be a little complicated. 写入内部资源可能有点复杂。

In any case, restricting to one use, may also use the internal resource solution, but in case you don't require it (say, you know on which computer it will run) you can use preferences: 无论如何,仅限于一种用途,也可以使用内部资源解决方案,但是如果您不需要它(例如,您知道它将在哪台计算机上运行),则可以使用首选项:

// in the beginnig of your main
if(Preferences.get("myapp.usedonce") != null)
    return;

// at the end of main
Preferences.put("myapp.usedonce", "yes");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM