Java executable Jar as Service - install4j

I am new to install4j and exploring it for our product.
I build sample installer "Install a Service" screen. I can see service gets created. But I want to run my executable jar being managed by this service.
Please let me know how I can run Java executable on Service start using Install4j. I essentially want service should control the java code execution.
I saw "Run executable or Batch file" screen but this is not our requirement we want service to manage executable jar
Thanks in Advance.

You have to generate a service on the "Launchers" step. In the class path configuration of your launcher, you specify your JAR file and for the main class you can then select the main class from your JAR file.
Then you can select that executable in the "Install a service" action.

Related

Is there a way to ensure that the correct JAR file is called by the Install4J service wrapper?

We are using Install4J v9 and our application needs to run as a Windows service. When we have installed the application as a Windows service, we have the original jar file myApp.jar and the service wrapper myApp.exe (which is running our jar file as a service) in the installation directory.
How can we ensure that our jar myApp.jar file is called by the service wrapper myApp.exe and not a substituted, fraudulent jar file?
I am wondering if jar signing would work, but how could install4j validate this signature?
install4j has no functionality to validate signatures of JAR files for inclusion in the classpath.
However, if an attacker can modify your JAR file, they can also modify your .exe file, so adding protection to the .exe against modification of the JAR file would not make anything safer.

Install4j - embedding jar into generated launcher

I have 'generated launcher' which executes my java application - aplication is in jar package.
Is there any way how to include jar into generated EXE file(launcher)? Customer wants to have only exe file, not jar in installed folder. Is there any way how to do it?
There is no way to do that with install4j. You can do it with exe4j, by using the "JAR in EXE" mode and add the generated executable to the distribution tree instead of using the generated launcher. This only works for Windows, though.

How to make the jar file to been a service with install4j?

I already have the jar file of my application. I've created the installer with install4j and chosen the service executable type. However, after the installation none service is added to windows. Can anybody help me?
You have to add an "Install a service" action on the Installer->Screen & Actions step.

How to create a executable Jar file for the Groovy script developed using Eclipse IDE

I have developed groovy script to run the Automation Testing using Eclipse IDE. The code generally triggers the Web service based on the input and Validates the responses.
I have exported the jar file by right clicking the project. The jar file is created.
But when I try to run the jar using Command prompt I am facing an error.
Can anyone please help me how to create a executable jar for the Groovy script

when project deploys on jboss, i want to run some main() method separately with jboss

My question is the same as like below.
(Jboss version 5.0, in case it matters.)
I have a library in one of my web applications that needs to be configured with a machine-specific license before use. I don't want to put this library in shared/lib because at some point I may want to run multiple web applications with different versions of the library.
Right now the .jar files are stored in WEB-INF/lib. Thus, when I build the .war file and upload it to the server, the .jar file would still be the one bound to my PC. I would like to put a bash script somewhere in the webapp that Tomcat would automatically run when deploying the .war file - this script would then run the configuration script and bind the server's license file to the .jar. Is this possible? Is there a nicer way of doing what I want?
one thing is different. my jar should run with other process Id. that means it has to run as standalone separated by jboss. Even if this
String command = "cmd /C java -jar C:\\test\\WEB-INF\\lib\\teststart.jar";
oProcess = new ProcessBuilder(command).start();
works, I will be happy. that jar is runnable jar.
Do you have Any idea? Thanks..
What about something like ServletContextListener?
Create a class that implements this and in the contextInitialized method (contextInitialized will run during war deployment) create a ProcessBuilder to run your bash command.