java - How do I print the current classpath for a Jenkins plugin? -


i'm developing jenkins plugin i'm having few problems think might due jar missing in plugin's classpath though in plugin's web-inf/lib directory.

normally use following code in java print classpath doesn't seem work jenkins.

classloader cl = getclass().getclassloader(); url[] urls = ((urlclassloader)cl).geturls(); for(url url: urls){     system.out.println(url.getfile()); } 

when execute plugin above code causes classcastexception exception thrown message hudson.classicpluginstrategy$antclassloader2 cannot cast java.net.urlclassloader

what best way print classpath being used jenkins plugin?

having read through javadoc antclassloader seems solution lot easier expecting , i've written following code can used print classpath jenkins plugin.

antclassloader cl = (antclassloader) getclass().getclassloader(); string[] classpath = cl.getclasspath().split(":"); (string classpathelement : classpath) {     system.out.println(classpathelement); } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -