Mattes Mattes - 6 months ago 49
Java Question

Import opencsv library in groovy

again i feel stupid. I want to use the opencsv library. I downloaded it (grab does not work from my network) and defined in my "central configuration" :

this.class.classLoader.rootLoader.addURL(new URL("file:///${currentDir}/lib/opencsv-3.5.jar"))


I now start groovy with the given parameter:

groovy.exe" -Xms1024m -cp .;lib/opencsv-3.5.jar test.gy


Within the script I import the Reader:

import au.com.bytecode.opencsv.CSVReader


And this is where it fails...

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Y:\pimconsole\scripts\testcsv.gy: 6: unable to resolve class au.com.bytecode.ope
ncsv.CSVReader
@ line 6, column 1.
import au.com.bytecode.opencsv.CSVReader


I thought i had it figured out :/

Answer

I found the answer: They repacked the stuff and it is now com.opencsv.CSVReader and no longer au.com.bytecode.opencsv.CSVReader... But it was hard to find that...

import com.opencsv.CSVReader

works Sorry :x