How to move from Jenkins as service to Jenkins as application? - jenkins

Running Jenkins 2.46.3 as a Windows service (Windows Server 2012 R2) does not allow me to interact with desktop applications. I've tried to fix this but it did not work for me (by changing registry settings), so I would like to run Jenkins as an application.
The problem is that when I run command: "C:\Program Files (x86)\Jenkins\jre\bin\java.exe" -jar jenkins.war Jenkins is extracted to C:\Users\Administrator\.jenkins folder and I have to setup it from the begining.
I don't want to setup it from the begining, I would like to run current installation as an application from the same folder it has been installed. How can I do this?

You need to tell where your Jenkins home directory is located. You can see your current Jenkins home directory in Manage Jenkins -> Configure System -> Home directory. (e.g C:\Program Files (x86)\Jenkins)
Then create a new environment variable called JENKINS_HOME to your Jenkins home directory (e.g C:\Program Files (x86)\Jenkins).
Stop your Jenkins instance, close your current command interpreter and start a new one, and launch Jenkins with your command (C:\Program Files (x86)\Jenkins\jre\bin\java.exe" -jar jenkins.war).

Related

How to add Maven local path in Jenkins running in a docker container

I have maven installed in my windows machine (here is the path: C:\Program Files\apache-maven-3.8.4) and Jenkins running in a docker container.
When I try to add maven path in Jenkins >> Global Tools Configuration, It is giving me following error
C:\Program Files\apache-maven-3.8.4\ is not a directory on the Jenkins controller (but perhaps it exists on some agents)
Is it possible to refer locally installed maven or JDK path in Jenkins which is running in a docker container? If yes, can you provide a sample working path
Thanks,
Bala

Why Jenkins failure with Error : Exit 9009

I am trying to deploy a Katalon Testcase to Jenkins but some errors appear, such as:
is not recognized as an internal or external command
Exit 9009
Jenkin using old update jenkin.war
You should Update file at : https://jenkins.io/doc/book/installing/#installing-docker
WAR file
The Web application ARchive (WAR) file version of Jenkins can be installed on any operating system or platform that supports Java.
To download and run the WAR file version of Jenkins:
Download the latest stable Jenkins WAR file to an appropriate directory on your machine.
Open up a terminal/command prompt window to the download directory.
Run the command java -jar jenkins.war.
Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears.
Continue on with the Post-installation setup wizard below.
Solve it well

After installing jenkins with tomcat manage jenkins is not showing

I am new to jenkins I know how to run build on jenkins from remote .When I was trying to configure in my local I followed the steps as below
1) Downloaded apache-tomcat-7.0.62
2) Downloaded jenkins.war [Jenkins ver. 1.651.2]
3) Copied jenkins.war and placed inside tomcat/webapps
4) Started the server
5) After starting it deployed jenkins folder inside the webapps
6) Pointed the JENKINS_HOME env varibale to this folder.
I am able to see the dashboard on my borwser after the starting the server
http://127.0.0.1:8080/jenkins/
But I am not getting any options like Manage Jenkins to customize anything.
Attached the screen shot for your reference.I tried with admin admin credentials but it didn't worked .What is the default credentials for this?.
and if any plugins I am missing please let me know.
Faced same problem today. It seems that you deleted, or it was not created - JENKINS_HOME folder, it should be placed in user\.jenkins.
At first check it - if there is really none, run the following command in folder with your jenkins.war, but stop tomcat first:
java -jar jenkins.war
After executing this command, go to http://localhost:8080 , it should run jenkins now not as tomcat part. Now you can create first admin user by follow instuctions.
When user was created, stop jenkins and run tomcat again, you will be able to login with created admin user in your tomcat/jenkins.

Running a Windows batch file in Jenkins

I trying to run my Tests cases for a project in Jenkins through DOS Command line on Windows server . I am using Jenkins ver. 1.559.
I am trying to run a Windows batch file through a Jenkins job that has the java command.
Under the "Build" section >> "Execute Windows Batch command" >> Command: call E:\Jenkins\App\UnitTests\App_UnitTests.bat
Save and Build the job.
I am getting an error and here is my Console Output
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>java.exe -cp "E:\Jenkins\App\PPS\App\bin\;E:\Jenkins\App\PPS\App\lib\junit-4.10.jar;E:\Jenkins\App\PPS\App\lib\*.jar;" org.junit.runner.JUnitCore com.omnitracs.fra.junit.EventTests
'java.exe' is not recognized as an internal or external command, operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>PAUSE
Press any key to continue . . .
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>EXIT
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
The java command runs fine outside Jenkins.
I have set the JAVA_HOME for the local user and also the PATH variable to point to where java.exe is.
What am I doing wrong? Please help.
For a windows environment, there is some extra configuration needed for more advanced builds. Ultimately you have two options
From Jenkins, The Definitive Guide:
This basic installation will work fine in a simple context, but you
will often need to fine-tune your service. For example, by default,
the Jenkins service will be running under the local System account.
However, if you are using Maven, Jenkins will need an .m2 directory
and a settings.xml file in the home directory. Similarly, if you
are using Groovy, you might need a .groovy/lib directory. And so on.
To allow this, and to make testing your Jenkins install easier, make
sure you run this service under a real user account with the correct
development environment set up. Alternatively, run the application as the
system user, but use the System Information page in Jenkins to check
the /Users/johnsmart/Projects/Books/jenkins-thedefinitive- guide
directory, and place any files that must be placed in the user home
directory here....
To configure your Jenkins server to run under a service account (The suggested option), Install Jenkins as a service, and under the services properties set the log on user info.

Jenkins losing configuration

I downloaded the jenkins war and su into the jenkins user and ran the following command
java -jar jenkins.war
I setup the configuration and when I rebooted the computer and loaded it up, all the configuration was gone. I checked the /home/jenkins/.jenkins and all the directories appear to be there. Looking at the system info section in jenkins I see the home directory set right
HOME /home/jenkins
Thoughts?
Ok I figured it out. I just had to as the jenkins user export the JENKINS_HOME variable and that did it

Resources