1

It's probably a stupid question, but I can't figure out how to properly import a folder of .java files as a library into my IntelliJ project.

I am trying to use the JavaMoney API, which I downloaded from here.

I know that the normal way would be File > Project Structure > Modules > Dependencies > + JARs or Directories, yet that always adds an "Empty Library" to the list, which is nowhere to be seen in the Project View.

Could someone set me on the right track here?

Sergey Ponomarev
  • 2,947
  • 1
  • 33
  • 43
gmolau
  • 2,815
  • 1
  • 22
  • 45
  • If you aren't using Gradle or Maven, you can add any 3rd party JAR you wish to a directory /lib and add that to your CLASSPATH. – duffymo Sep 04 '16 at 14:03

1 Answers1

2

You should not use the sources directly. You should start to use maven (or gradle). In that case you can simply add a dependency:

<dependency>
    <groupId>javax.money</groupId>
    <artifactId>money-api</artifactId>
    <version>1.0.1</version>
</dependency>

If you don't want to use maven, you should import the existing maven project from the repository and export it as a *.jar file.

Or you simply download the prebuilt version from a mvn-repository.

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
  • Thanks, I hadn't found the repository. I'm only a beginner, I still have to look into build management. – gmolau Sep 04 '16 at 13:45
  • Although perfectly correct and the only sensible thing to do, and upvoted from me, this should be a comment really. It is just that the question is very poor, but the "correct" answer to the actual question would be to import those files as a module within a project. – Oleg Sklyar Sep 04 '16 at 13:46
  • "perfectly correct" - yes. Seeing these faux moderator comments that answer nothing and provide no value from low rep users drives me crazy. – duffymo Sep 04 '16 at 14:01