can't run example. Unknown source...
A fast, programmer-friendly, free CSV library for Java
Brought to you by:
jamesbassett,
kbg
I'm new to Java and am working alone at home trying to compare 2 csv files. I
have JBuilder 2007 loaded and created a SuperCSV project and attached the
libraries JRE6, SuperCSV, spiffy, JUnit4.7 and hamcrest.
I've started simple and just copied the example code into my project as 2
classes : ReaderObject and UserBean.
The code has complied (although i have 23 warnings largely to do with
deprecated cellprocessor constraints).
I'm afraid I have no-one else to ask for help so any tips you may have to
overcome my runtime error would be very gratefully received.
When opting to run the main() method my code crashes on the line
ICsvBeanReader inFile = new CsvBeanReader(new FileReader("C:/family
files/jo/JBuilder2007workspace/SuperCSV/src/foo.csv"),
CsvPreference.EXCEL_PREFERENCE);
with the following console error message:
xception in thread "main" java.lang.NoClassDefFoundError:
spiffy/core/util/HashMapBuilder
at org.supercsv.util.MethodCache.<init>(Unknown Source)
at org.supercsv.io.CsvBeanReader.<init>(Unknown Source)
at ReadingObjects.main(ReadingObjects.java:27)
If it's difficult to say what the cause is. Would you be willing to donate
some other example files that may help me?
Thanks for taking the time to read this.
Joanne
You are missing a dependency to the spiffy-core.jar. you can find that on
sourceforge, too.
Thanks for your reply, but I have included a spiffy jar file and I can see the
class definition within it defined as:
spiffy.core.util.HashMapBuilder<K, V="">
I thought it may have something to do with interfaces not being defined or
something?
Could I have the wrong spiffy jar? I'm pointing to one called
spiffy-with_source-all-0.05.jar
Yes, this might be the wrong jar, my one is called spiffy-core-0.5.jar and it
works here. Anyway, check if the jar is available in the runtime classpath. Do
you run your app from an IDE like Eclipse or from command line?
I have checked the available download at
https://sourceforge.net/projects/spiffyframework/files/spiffyframework/v0.xx
/spiffy-all-0.05.zip/download and this contains
the spiffy-all-0.05.jar, which for itself contains the missing class file. Add
this to your classpath and you'll be fine.
Great - this helps a lot. Won't get chance to try it until later, but I think
you may have hit on something with the runtime classpath. I've been using
JBuilder 2007 (which i'm new to) and so will need to investigate this.
Thank you very much!
Thanks again - I've overcome the latest hurdle! I'm sure I'll hit many more !!
Jo