Mattes
Mattes

Reputation: 159

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 :/

Upvotes: 4

Views: 3976

Answers (2)

Mattes
Mattes

Reputation: 159

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

Upvotes: 1

Craig
Craig

Reputation: 2376

I believe this answers your question. Basically, just drop the jar file in your groovy lib directory.

Upvotes: 0

Related Questions