简体   繁体   English

使用NSIS脚本安装后无法运行我的应用程序吗?

[英]Can't get run my application after installing using NSIS script?

I builded nsis script successfully for my java project. 我为Java项目成功构建了nsis脚本。 I have converted my java project into bat (windows machine requires bat file for executing) file named as test.bat . 我已经将我的Java项目转换为名为test.bat bat(Windows计算机需要bat文件才能执行)文件。 My installation steps done successfully. 我的安装步骤成功完成。

After installation the bat file can not start the service. 安装后,bat文件无法启动服务。 I have checked following path 我已经检查了以下路径

Start Menu -> Control Panel -> Administrative Tools -> Services.

I can see the services in this list, but i could not see my service file name. 我可以在此列表中看到服务,但看不到我的服务文件名。

I have tried following script lines 我已经尝试按照脚本行

!define MUI_FINISHPAGE_RUN "$INSTDIR\test.bat"

Also i have tried this one 我也尝试过这个

Function test
  ExecShell "" "$INSTDIR\test.bat"
FunctionEnd

How to solve this? 如何解决呢?

I installed a java service with the wrapper from http://wrapper.tanukisoftware.org that is able to install jars as a service. 我使用http://wrapper.tanukisoftware.org的包装器安装了Java服务,该服务能够将jars安装为服务。 IIRC you will need wrapper.exe, wrapper.dll, and wrapper.jar to be installed along your application. IIRC,您需要在应用程序中安装wrapper.exe,wrapper.dll和wrapper.jar。 Check the website for further information. 检查网站以获取更多信息。

Then you have NSIS call that wrapper to install the service on the target machine: 然后,您有NSIS调用该包装程序以在目标计算机上安装服务:

Detailprint "Installing service"
nsExec::Exec "$\"$INSTDIR\wrapper.exe$\" -i $\"$INSTDIR\wrapper.conf$\""

The uninstaller portion: 卸载程序部分:

Detailprint "Stopping service"
nsExec::Exec "$\"$INSTDIR\wrapper.exe$\" -p $\"$INSTDIR\wrapper.conf$\""

Detailprint "Removing service"
nsExec::Exec "$\"$INSTDIR\wrapper.exe$\" -r $\"$INSTDIR\wrapper.conf$\""

As you can see, you will also have to create a wrapper.conf to specify details about the service (eg which main class to use). 如您所见,您还必须创建wrapper.conf来指定有关服务的详细信息(例如,使用哪个主类)。 After installing the service you should be able to start it with something like... 安装服务后,您应该可以使用类似...的方式启动它。

Exec '"net start your_service_name"'

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

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