This question already has an answer here:
I have moved from eclipse to intellij.
In eclipse, I had two packages:
Now i have created an intellij project and copied one of my old eclipse project's src/ into the intellij src/ folder.
In eclipse, if I wanted to add Junit so I did:
Build Path -> Add External Jars -> Junit -> Finish
How to do this in intellij??
Becaue i get the following errors for my junit tests
Error:(3, 24) java: package org.junit does not exist
Error:(3, 1) java: static import only from classes and interfaces
Error:(4, 24) java: package org.junit does not exist
Error:(4, 1) java: static import only from classes and interfaces
Error:(5, 24) java: package org.junit does not exist
Error:(5, 1) java: static import only from classes and interfaces
Error:(6, 24) java: package org.junit does not exist
Error:(6, 1) java: static import only from classes and interfaces
Error:(10, 17) java: package org.junit does not exist
Error:(11, 17) java: package org.junit does not exist
Error:(12, 25) java: package org.junit.runners does not exist
If you know where the Junit's jar package is, you can do it like this:
1)Press the Ctrl+Alt+Shift+S key at the same time
2)select Libraries
3)click + ,select java
4)select your jar file
If you use maven that is easy . Just in the "pom.xml" file join like that :
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
</dependency>
<dependencies>