How to pass CLASSPATH variable to Jenkins.

6,675 views
Skip to first unread message

puyo puy

unread,
Oct 18, 2013, 1:43:52 AM10/18/13
to jenkins...@googlegroups.com
Hi,

I have an ant script running successfully using bat file. But when I run that script on Jenkins it failed with error "build_preprocess.xml:166: java.lang.NullPointerException".  After many hours of research, I believe that is related to the CLASSPATH environment variable did not pass to Jenkins.  Just wonder is there a way I can pass CLASSPATH to Jenkins?

Thanks in advance

Vivekanand S V

unread,
Oct 18, 2013, 2:00:22 AM10/18/13
to jenkins...@googlegroups.com
Inject environment variables using jenkins ? Or only for this case, u can add the "set CLASSPATH=PATH_GOES_HERE" line in your bat file before line that executes the ant file.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dirk Heinrichs

unread,
Oct 18, 2013, 2:04:45 AM10/18/13
to jenkins...@googlegroups.com
Put the classpath where it belongs: into the bat file. That script is
(hopefully) under version control together with anything else, so that
changes to the classpath don't require a change of the Jenkins job
configuration.

HTH...

Dirk
--

*Dirk Heinrichs*, Senior Systems Engineer, Infrastructure
*Recommind GmbH*, Von-Liebig-Stra�e 1, 53359 Rheinbach
*Tel*: +49 2226 1596666 1149
*Email*: d...@recommind.com <mailto:d...@recommind.com>
*Skype*: dirk.heinrichs.recommind
www.recommind.com <http://www.recommind.com>


http://www.recommind.com

puyo puy

unread,
Oct 22, 2013, 9:16:49 PM10/22/13
to jenkins...@googlegroups.com
Thanks guys, I found the solution by calling the bat file directly from Jenkins.  In this way, CLASSPATH is available.

        <exec dir="." executable="cmd.exe" >
            <arg line='/c "my.bat"'/>
        </exec>


On Fri, Oct 18, 2013 at 5:04 PM, Dirk Heinrichs <d...@recommind.com> wrote:
Am 18.10.2013 07:43, schrieb puyo puy:

> I have an ant script running successfully using bat file. But when I
> run that script on Jenkins it failed with error
> "build_preprocess.xml:166: java.lang.NullPointerException".  After
> many hours of research, I believe that is related to the CLASSPATH
> environment variable did not pass to Jenkins.  Just wonder is there a
> way I can pass CLASSPATH to Jenkins?

Put the classpath where it belongs: into the bat file. That script is
(hopefully) under version control together with anything else, so that
changes to the classpath don't require a change of the Jenkins job
configuration.

HTH...

    Dirk
--

*Dirk Heinrichs*, Senior Systems Engineer, Infrastructure
*Recommind GmbH*, Von-Liebig-Straße 1, 53359 Rheinbach

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/EKSlqHglcsI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages