简体   繁体   中英

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

I builded nsis script successfully for my java project. I have converted my java project into bat (windows machine requires bat file for executing) file named as test.bat . My installation steps done successfully.

After installation the bat file can not start the service. 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. IIRC you will need wrapper.exe, wrapper.dll, and wrapper.jar to be installed along your application. Check the website for further information.

Then you have NSIS call that wrapper to install the service on the target machine:

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). After installing the service you should be able to start it with something like...

Exec '"net start your_service_name"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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