0

For a jython script for wsadmin... I am doing

CLASSPATH = "/path/jar1.jar" + "\n" + "/path/jar2.jar"

But its not working, it setting as /path/jar1.jar/path/jar2.jar

Where am I going wrong.

Debajyoti Das
  • 2,038
  • 4
  • 34
  • 66
  • 1
    note also that websphere documentation explicitly recommend avoiding `\n`: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Fcxml_jython.html – oz123 Jan 28 '14 at 06:22

2 Answers2

1

You should use path separator (os.pathsep) instead of newline:

>>> import os
>>> os.pathsep.join(["/path/jar1.jar", "/path/jar2.jar"])
'/path/jar1.jar:/path/jar2.jar'
falsetru
  • 357,413
  • 63
  • 732
  • 636
  • But in websphere path name are supposed to be separated by line break not : `In the native path list box, browse or add a path which forms the location for the resource provider native libraries. Native path entries are separated by using the ENTER key and must not contain path separator characters (such as ';' or ':'). Native paths can contain variable (symbolic) names which you can substitute using a variable map.` – Debajyoti Das Jan 28 '14 at 10:01
  • @DebajyotiDas, What if you hardcode `CLASSPATH=/path/jar1.jar:/path/jar2.jar` ? (`CLASSPATH=/path/jar1.jar;/path/jar2.jar` if you're using Windows) – falsetru Jan 28 '14 at 10:57
  • Turns out WAS will auto convert `;` to newlines. Thanks anyway :) – Debajyoti Das Jan 28 '14 at 11:01
  • @DebajyotiDas, classpaths should be separated by `:` in unix. – falsetru Jan 28 '14 at 11:04
0

Working:

Whilst the WAS admin console (the web page) requires you to enter the classpath with newlines, the wsadmin tool requires that it be separated by the host O/S file separator. So there is no need to modify the input string at all.

classpath = "a.jar;b.jar;c.jar"

Will work just fine.

Source: How to get newlines in classpath for JMSProvider using wsadmin

Community
  • 1
  • 1
Debajyoti Das
  • 2,038
  • 4
  • 34
  • 66