linuxenvironment-variableshudsonhudson-plugins

How to extract / unpack / unzip hudson.war in specified directory Linux / Windows and not on default?


I downloaded hudson generic .war hudson.war from http://www.eclipse.org/hudson/download.php and placed in some path.

On passing command

java -jar hudson.war

It extracts / unpacks / unzips hudson.war in .hudson directory under my home directory.

I want to extract / unpack / unzip under a directory / folder which I can specify.

Can someone please help ?


Solution

  • I understand, such situation arises when you have limited space under your home directory.

    Here are the steps and explanation for Windows and Linux

    Windows:

    By default java -jar hudson.war will extract .war on path %USERPROFILE%\.hudson For example in my case, in command terminal:

    C:\Hudson>echo %USERPROFILE%\.hudson
    C:\Users\osao.ORADEV\.hudson
    

    This is the path where hudson.war is extracted. For extracting in userdefined directory, you need to set HUDSON_HOME environment variable

    To set persistent environment variables: Right click My Computer ==> Properties ==> Advanced system settings ==> Environment Variables ==> System variables New. Make sure that HUDSON_HOME is not already there. If yes, delete it. Add HUDSON_HOME: <your specified directory>

    Now open/restart command terminal. Check echo %HUDSON_HOME% it must be updated HUDSON_HOME

    Now invoke java -jar hudson.war from the path where hudson.war is there. You will notice that extraction is in specified directory.

    Linux:

    By default extraction happens in $HOME You need to set $HUDSON_HOME Based on your SHELL: csh or bash

    csh:

    mkdir /home/osao/myHudsonHome
    setenv HUDSON_HOME /home/osao/myHudsonHome
    echo $HUDSON_HOME
    java -jar hudson.war
    

    bash:

    mkdir /home/osao/myHudsonHome
    export HUDSON_HOME=/home/osao/myHudsonHome
    echo $HUDSON_HOME
    java -jar hudson.war
    

    I hope this will help.