Using wcl in linux
Hey, i am trying to use in a linux distro. I tried multiple java builds from java 8. I setup the script like this:
#!/bin/sh
#JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin
export PLAIN_JAVA=/usr/PlainJava
#export JAVA_HOME
#export PLAIN_JAVA
/WCL/jdk1.8.0_141/bin/java -Djava.security.policy=rmi_no.policy -Djava.ext.dirs=./lib:$PLAIN_JAVA:$JAVA_HOME/jre/lib/ext -cp ./lib:$PLAIN_JAVA% -jar wcl.jar "$@"
And i keep getting this error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/team/repository/common/TeamRepositoryException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.ibm.team.repository.common.TeamRepositoryException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Can someone help me in this matter ?
2 answers
There is a 'mix' of unix / windows variable referencing it seems:
-Djava.ext.dirs=./lib:$PLAIN_JAVA:$JAVA_HOME/jre/lib/ext -cp ./lib:$PLAIN_JAVA% -jar wcl.jar "$@"
Try knocking off the % after PLAIN_JAVA.
$JAVA_HOME/bin/java -Djava.security.policy=rmi_no.policy -Djava.ext.dirs=./lib:$PLAIN_JAVA:$JAVA_HOME/jre/lib/ext -cp ./lib:$PLAIN_JAVA -jar wcl.jar "$@"
$JAVA_HOME/bin/java -Djava.security.policy=rmi_no.policy -Djava.ext.dirs=./lib:$PLAIN_JAVA:$JAVA_HOME/jre/lib/ext -cp ./lib:$PLAIN_JAVA -jar wcl.jar "$@"
I have tried to fix the Linux shell script recently. Have a look at https://github.com/jazz-community/work-item-command-line/blob/master/com.ibm.js.team.workitem.commandline/scripts/wcl.sh
I recently found out the order of the ext dirs is important and, as Kevin rightly points out, at some time some Windows CMD syntax crept in that needed to be fixed.
It would still not work for me on a red hat Linux but it seemed to work for another user. I did not have the time to look into it deeper.
Comments
Can you show me the link where the user claims that the script work ?
Sorry, can't find it. I basically copied the answer into my script. It was about 25 days ago.
This was basically how it looked like:
#!/bin/sh #JAVA_HOME=/usr/java/jdk1.8.0_20/bin #export JAVA_HOME PLAIN_JAVA=/usr/RTC606Dev/Installs/PlainJavaAPI export PLAIN_JAVA # In the -Djava.ext.dirs always keep the Java distribution in the front $JAVA_HOME/bin/java -Djava.security.policy=rmi_no.policy -Djava.ext.dirs=$JAVA_HOME/lib/ext:$JAVA_HOME/jre/lib/ext:./lib:$PLAIN_JAVA -cp ./lib:$PLAIN_JAVA% -jar wcl.jar "$@"