Setting PATH variable

435 views
Skip to first unread message

Prakash A

unread,
May 15, 2012, 6:06:04 AM5/15/12
to Jenkins Users
Hello All,

I'm very new Jenkins (even to CI tools). I have a problem in running
ANT target from Jenkins. Let me clarify the question.

I've my jenkins installed in CentOS using native method (YUM repo).
I've also installed JDK, Ant. I did configured the path of those
things in Jenkins -> Manage Jenkins -> Configure System.

Then created a new Job to build product. In the job, subversion access
information as well as ant target to be run in the build step were
configured.

When running the job, im able to connect to SVN and download the
files. When trying to run the ant target, i got the following error
and build the failed.

[workspace] $ /usr/ant/apache-ant-1.8.3/bin/ant web
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

Based on my understanding, the error is that the appropriate JDK bin
path was not configured properly in PATH environment variable. Is my
assumption rite??

I also tried to set the PATH variable in two places. 1. Jenkins ->
Manage Jenkins -> Configure System -> Global Properties by having
'PATH' in the name and '/usr/java/home/bin' (Yes, Sun JDK was
installed in that path) as the value. 2. Jenkins -> Job1 ->
configuration -> Invoke Ant -> Advanced -> Properties as 'PATH=/usr/
java/home/bin'.

Im lost here. Please let me know, how i can change the PATH variable.

Thanks,
Prakash.A

John Smith

unread,
May 15, 2012, 8:08:39 AM5/15/12
to jenkins...@googlegroups.com
I suspect the problem isn't your PATH, but your CLASSPATH. You'll need to make sure this includes:

  ${JAVA_HOME}/jre/lib/rt.jar

(Assuming that you've already set JAVA_HOME).

Prakash A

unread,
May 16, 2012, 2:05:35 AM5/16/12
to jenkins...@googlegroups.com
Hi,

Thanks for your response. But i did set the classpath as you suggested, still getting the same error. Following is the output in the console.

[workspace] $ /usr/ant/apache-ant-1.8.3/bin/ant -DCLASSPATH=/usr/java/jdk1.6.0_24/jre/lib/rt.jar print
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Build step 'Invoke Ant' marked build as failure

Please let me know, how to resolve the issue.

Thanks,
Prakash.A

John Smith

unread,
May 16, 2012, 4:15:03 AM5/16/12
to jenkins...@googlegroups.com
Hi,

To my mind this sounds like a ANT problem rather than something to do with Jenkins (although it could be manifesting through Jenkins). Have you tried calling the ANT script directly from the command line?

Another question - is the problem running ANT it's self, or is the problem when ANT tried to compile/run/test your code? What I mean is not only does ANT run inside a VM, but it also creates VMs to do it's work. Is it the ANT's VM that has the classpath problem or is it the child VM's that have the problem?

John Smith

unread,
May 16, 2012, 4:41:59 AM5/16/12
to jenkins...@googlegroups.com
Hi,

I'm suspect your problem might be a generic ANT issue rather than something specifically associated with Jenkins. Are you are to run this script from the command line on your Jenkins server.

The other question is where you get the error - is it in launching ANT, or is it ANT trying to compile/test/run you application. The reason I ask is that when ANT runs (which is an application in a VM) it can create child VMs with different class paths to perform your tasks. I'm wondering which VM has the class path error.

On Wed, May 16, 2012 at 7:05 AM, Prakash A <prakash.a...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages