This feels ridiculous that I have to ask this, but I can't seem to add multiple jar files to the classpath for groovyConsole and groovysh. How do I add multiple jar files to the classpath? Here is what I've tried:
groovyConsole -cp ~/lib/compile/jar/mysql-connector-java-5.1.32.jar:~/lib/compile/jar/ojdbc6-11.2.0.3.jar
However, when I execute this code in the console I get the following:
file:/Users/charlie/lib/compile/jar/mysql-connector-java-5.1.32.jar
file:/Users/charlie/projects/fuseanalytics/./
file:/Users/charlie/.gvm/groovy/current/lib/ant-1.9.3.jar
file:/Users/charlie/.gvm/groovy/current/lib/ant-antlr-1.9.3.jar
file:/Users/charlie/.gvm/groovy/current/lib/ant-junit-1.9.3.jar
file:/Users/charlie/.gvm/groovy/current/lib/ant-launcher-1.9.3.jar
file:/Users/charlie/.gvm/groovy/current/lib/bsf-2.4.0.jar
file:/Users/charlie/.gvm/groovy/current/lib/commons-cli-1.2.jar
file:/Users/charlie/.gvm/groovy/current/lib/commons-logging-1.1.1.jar
file:/Users/charlie/.gvm/groovy/current/lib/gpars-1.2.1.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-ant-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-bsf-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-console-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-docgenerator-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-groovydoc-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-groovysh-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-jmx-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-json-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-jsr223-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-nio-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-servlet-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-sql-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-swing-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-templates-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-test-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-testng-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/groovy-xml-2.3.6.jar
file:/Users/charlie/.gvm/groovy/current/lib/hamcrest-core-1.3.jar
file:/Users/charlie/.gvm/groovy/current/lib/ivy-2.3.0.jar
file:/Users/charlie/.gvm/groovy/current/lib/jansi-1.11.jar
file:/Users/charlie/.gvm/groovy/current/lib/jcommander-1.35.jar
file:/Users/charlie/.gvm/groovy/current/lib/jline-2.11.jar
file:/Users/charlie/.gvm/groovy/current/lib/jsp-api-2.0.jar
file:/Users/charlie/.gvm/groovy/current/lib/jsr166y-1.7.0.jar
file:/Users/charlie/.gvm/groovy/current/lib/junit-4.11.jar
file:/Users/charlie/.gvm/groovy/current/lib/multiverse-core-0.7.0.jar
file:/Users/charlie/.gvm/groovy/current/lib/qdox-1.12.1.jar
file:/Users/charlie/.gvm/groovy/current/lib/servlet-api-2.4.jar
file:/Users/charlie/.gvm/groovy/current/lib/testng-6.8.8.jar
file:/Users/charlie/.gvm/groovy/current/lib/xmlpull-1.1.3.1.jar
file:/Users/charlie/.gvm/groovy/current/lib/xstream-1.4.7.jar
Notice that the first jar file, the mysql jar file, is added to the classloader, but the second jar file, the oracle jar file, is not added. I've also tried using the -cp argument twice like:
groovyConsole -cp ~/lib/compile/jar/mysql-connector-java-5.1.32.jar -cp ~/lib/compile/jar/ojdbc6-11.2.0.3.jar
But that just fails with an error. The docs are conspicuously devoid of any guidance other than vague hints that it works just like Java. Hence why its so frustrating the first attempt didn't work out of the box.
I've also tried to add the Jar files after starting groovyConsole using Script > Add Jar(s) to Class path menu option, but it adds none of the jar files.
So why doesn't this work in a more straight forward manner?
$HOME
then.~
is not handled by the shell, but must be handled by the app/java. – Reannareap