socksocket
socksocket

Reputation: 4371

opencsv with intelliJ

I added to my project under lib directory the jar of opencsv.
then, in intelliJ under Project Structure -> Libraries added the jar.

but, somehow intelliJ doesn't recognize it.
why is that?

Upvotes: 1

Views: 10593

Answers (2)

CrazyCoder
CrazyCoder

Reputation: 402375

Libraries in the Project Structure dialog represent the global libraries that can be configured once and then used in multiple projects and modules. To make a library available for a module, add it to the module dependencies.

Upvotes: 2

Kris
Kris

Reputation: 5792

Don't go this way, create a maven project and it will solve many problems you haven't encountered yet :).

  1. Open up you intelliJ Idea
  2. select 'File' -> 'New Project' 'Create project from scratch' -> 'Next'
  3. Enter the project title, select 'Maven Module' -> 'Next'
  4. Click 'Finish' Replace the generated pom.xml with the following:

    http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

    <groupId>opencsvtst</groupId>
    <artifactId>opencsvtst</artifactId>
    <version>1.0</version>
    
    <dependencies>
        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.0</version>
        </dependency>
    </dependencies>
    

  5. Under src/main/java add your classes (the one with the main method probably) and use the opencsv library.

You will find the compiled jar within the target folder once you build the project.

Upvotes: 3

Related Questions