0

I new to Python and am looking for a way to create my CLASSPATH argument for Jython script in wsadmin for Websphere, by reading from a folder and including all jars in that folder.

Example :

/jar_dir
    1.jar
    2.jar
    ...
    70.jar

CLASSPATH= INSTALL_PATH + "/jar_dir/1.jar;" + INSTALL_PATH + "/jar_dir/2.jar;"  .... INSTALL_PATH + "/jar_dir/70.jar;" 

How can I do this?

AndyG
  • 39,700
  • 8
  • 109
  • 143
Debajyoti Das
  • 2,038
  • 4
  • 34
  • 66

2 Answers2

1

what I would do

import glob

...

";".join(glob.glob(INSTALL_PATH+"/jar_dir/*.jar"))
Debajyoti Das
  • 2,038
  • 4
  • 34
  • 66
Xavier Combelle
  • 10,968
  • 5
  • 28
  • 52
  • This worked... But i came acroos an issue. I have to keep the order of few jars. Right now its setting as I wanted but I don't want to take any risk. Any ideas ? – Debajyoti Das Jan 29 '14 at 10:01
  • 1
    the problem there is no way to know which order keep except if it is alphabetic or by time creation – Xavier Combelle Jan 29 '14 at 12:00
1

The correct way to do this would be: [1] Adding the jars to "com.ibm.ws.scripting.classpath" to your wsadmin.properties file. See This.

[2] Or add the switch "-wsadmin_classpath /path/to/jar" when you call wsadmin.

Threadicide
  • 126
  • 7