In Jenkins, we can change the port on which Jenkins service is running in any operating system via commands.
We need to use httpPort argument while running Jenkins.
To change the default port for Jenkins use following commands.
Use the following command at command prompt in Windows or Terminal in Linux: java -jar jenkins.war --httpPort=9999
For https Use the following command at command prompt in Windows or Terminal in Linux: java -jar jenkins.war --httpsPort=8888
However, it can be a solution if default port is already occupied. In such case when you try to run Jenkins it will give following error:
java.net.BindException: Address already in use: bind
In such case also if you want a quick solution then just change a default port on which Jenkins runs.
Labels: Devops, Java, Jenkins