1

How to configure intelliJ to disply errors in java code like eclipse? see the screenshotenter image description here

6
  • What errors? Your code looks fine to me. Commented Sep 26, 2014 at 8:59
  • no junit package is missed Commented Sep 26, 2014 at 9:00
  • Yes this is the problem. eclipse shows that junit package is missing but intellij does not show any errors on the editor Commented Sep 26, 2014 at 9:03
  • Then perhaps the issue is with your Eclipse project setup. Commented Sep 26, 2014 at 9:05
  • 2
    +1 for paintbrush skillz. Commented Sep 26, 2014 at 9:50

2 Answers 2

2

It does show the errors you expect, if you don't have the JUnit jar files in the classpath.

I created the exact same file as you showed in my IntelliJ and it really shows the errors:

enter image description here

What you might have done is that you have probably accidentally added the jar to the classpath.

Check the External Libraries as you can see in the picture. If there is no JUnit there, then it really is missing.

Now I can easily add the JUnit jar from IntelliJ and you'll notice the difference in the External Libraries:

enter image description here

Here it has been added under External Libraries and the error goes away.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

You almost certainly already included the junit library into your IntelliJ project configuration.

This is easy to do, since IntelliJ has a quick action (alt-enter) to Add junit to classpath.

Look in Settings -> Libraries / Global Libraries and you will see it there. :)

Or you can look directly in Settings on the relevant Module -> Dependencies

Either that, or the project you are working in is configured already (perhaps via maven?) to have a junit dependency.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.