How to run the Jenkins WAR file example

Run a Jenkins war file

The easiest way to install Jenkins and run the popular CI/CD tools is to simply download the jenkins.war and run the Jenkins war file at the command line.

run jenkins war file

Java command to run a Jenkins war file.

Whether your run Jenkins in Windows or a Linux distro like Ubuntu or Red Hat, the Java command used to run the Jenkins war file is always the same:

java -jar jenkins.war

Note that the -jar switch is used, even though it is a war being opened.

After the jenkins.war file runs, the administrative console will be available on port 8080.

http://localhost:8080

Jenkins localhost 8080 not working

It’s worth noting that in order for this command to succeed, you must have the JDK installed. Java version 8 is the oldest release Jenkins CI will support. The Java 11LTS release is recommended.

 

Your intro to GitHub Actions training course

Here’s how to get started with GitHub Actions:

Follow these tutorials to learn GitHub Actions fast.

If you do have a problem where Jenkins on localhost 8080 is not working, verify that the JDK is installed and the Java utilities in the JDK’s bin directory are on the PATH. This can be accomplished with the java -version command.

C:\jenkins\warfile> java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
C:\jenkins\warfile> java -jar jenkins.war
Starting jenkins war file
Jenkins WAR file webroot: $user.home/.jenkins
Jenkins WAR file running on localhost 8080

Jenkins WAR file installation

The first run of the Jenkins war file will create a folder named .jenkins under the user’s home directory, and a configuration routine will run. On subsequent startups, you will be taken immediately to the Jenkins login page.

To simplify future start ups, create a file named jenkins-startup.bat if you’re on Windows, or jenkins-startup.sh on Linux, and just type the command used to run a Jenkins jar file in the file. From then on, you simply run the batch file or shell script to start Jenkins, and you don’t need to retype the Java command into the DOS prompt or the Linux terminal window.