how to add jar to classpath to be used in script runner external scripts

Hi, 

 

I want to add http-builder jar so I could use it in script runner, 

Where should I put it so i could just import it . 

I tried this.class.classLoader.rootLoader.addURL( new URL("file:///http-builder-0.7.2.jar") ) but it did not work ( at least not from the script console. ) 



2 answers

This widget could not be displayed.

This is included in 3.0.x... presumably you are using an earlier version?

using Version: 3.0.5

well, it's there then...

This widget could not be displayed.

Hi,

I have the same problem... (Version: 3.0.12)

Actually I have the following error message:

java.lang.NullPointerException: Cannot invoke method addURL() on null object

when I would like to add the JAR file URL:

File myFile=new File("/Users/bdo/Workspace/Application/jira/jira_home/scripts/jconn2.jar");
URL myUrl = myFile.toURI().toURL();
this.class.classLoader.rootLoader.addURL(myUrl)

Gives a solution or workaround for this case? For me it's not a good to copy my JAR file into the scriptrunner plugin lib folder, cause I can't update the Script Runner Add-On. 

Many thanks and regards,

Benjamin

You should use @Grab... there is much more to it than what you are doing. The classpath needs to be modified at the compile phase, the way you're doing it it's too late. http://docs.groovy-lang.org/latest/html/documentation/grape.html

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

112 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you