문제

I created an Eclipse project and I need to use the Super CSV library with Dozer. I downloaded the Super CSV and created a new folder "super-csv" in /usr/lib.

Now I have: /usr/lib/super-csv/super-csv that contains the super csv jar (+ javadoc and source), /usr/lib/super-csv/super-csv-dozer that contains the super csv dozer jar, javadoc and source plus a "lib" folder.

Inside /usr/lib/super-csv/super-csv-dozer/lib there are many .jar files that are needed for super-csv-dozer to work, so I added it as native library for super-csv-dozer entry in library tab of java build path in Eclipse.

When I try to compile the project, I receive a java.lang.ClassNotFoundException pointing a class that is contained in one of the jar files in the lib folder.

Everything works only if I manually add every jar in lib folder as an external jar.

Can someone explain me where I am doing wrong?

도움이 되었습니까?

해결책

I'd recommend using Maven - it's a widely used tool for Java builds. To start using Super CSV, it would be as simple as adding the 2 dependencies (listed on the Super CSV website), and your Eclipse project would be ready to go.

There's a bit of a learning curve though, so if you want to just add the jars to Eclipse's build path manually, I'd recommend creating a lib directory at the root of your project and putting all of the jars there.

my-project
    |-src
    |  |- (your source in here)
    |
    |-lib
       |-commons-beanutils-1.8.3.jar
       |-commons-lang-2.5.jar
       |-commons-logging-1.1.1.jar
       |-dozer-5.3.2.jar
       |-slf4j-api-1.7.1.jar
       |-super-csv-2.0.1.jar
       |-super-csv-dozer-2.0.1.jar

You can then add them to the build path (here's a good guide).

Just a note: if you're not using the Dozer extension, then you'll only need super-csv-2.0.1.jar on the build path.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top