Reputation: 45062
I am trying to automate build process for Android and iOS apps with the help of Jenkins.
What I want:
I am working in secured ODC and installing Apache Tomcat will require unnecessary absurd change request process and require chain of approvals. So in order to avoid process block I am trying to deploy Jenkins .war as Windows service.
What I tried:
Jenkins
Jar from the Jenkins web site java -jar C:\Users\663918\Downloads\jenkins.war
The problem:
Executing above command giving me the following error. I tried searching on Google but I was unable to find anything useful.
Error: Could not find or load main class ?jar
If anyone can help me with my situation that would be very helpful.
Upvotes: 1
Views: 2348
Reputation: 509
Try this, opened the registry editor (by typing regedit in cmd) and going to HKEY_CLASSES_ROOT > jarfile > shell > open > command, then opening (Default) and changing the value from
"C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*
to
"C:\Program Files\Java\jre7\bin\java.exe" -jar "%1" %*
(I just removed the w in javaw.exe.) After that you have to right click a jar -> open with -> choose default program -> navigate to your java folder and open \jre7\bin\java.exe (or any other java.exe file in you java folder). If it doesn't work, try switching to javaw.exe, open a jar file with it, then switch back.
I don't know anything about editing the registry except that it's dangerous, so you might wanna back it up before doing this (in the top bar, File>Export).
Upvotes: 2
Reputation: 96
You need to configure the details of the Jenkins service in a file jenkins.xml , located in the same directory as your jenkins.war file.
jenkins.xml :
<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs the Jenkins continuous integration system</description>
<env name="JENKINS_HOME" value="C:\jenkins" />
<executable>java</executable>
<arguments>-Xrs -Xmx512m-Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8081
--ajp13Port=8010</arguments>
</service>
After windows service configuration your Jenkins will starts as soon as you start your machine...
Upvotes: 0
Reputation: 76
Not sure if you got it working.
In the wiki it is also mentioned that
Note: Alternatively, you can install a servlet container like GlassFish and Tomcat, which can run as a service by itself, and then deploy Jenkins to it.
All you have to do is download tomcat (No installation required - you will find binaries. There are some great IDEs available which packages tomcat so that you don't have to worry about setting up at all if you have Eclipse or Spring STS), start tomcat server and then deploy Jenkins.war.
Once it is deployed, you can access Jenkins using URL http://localhost:8080/jenkins/
Upvotes: 0
Reputation: 1025
First line on the wiki:
NOTE: if you installed Jenkins using the windows installer, you shouldn't need to do anything else here because the windows installer automatically runs Jenkins as a windows service.
Have you used the Windows installer? Otherwise try that one out.
Upvotes: 0