Maya
Maya

Reputation: 29

Odd behaviour when importing classes

I am currently using DrJava and when I write the following import statement:

import java.util.Arrays;

I get the following error message:

Error: The import java.util.Arrays cannot be resolved

What am I doing wrong? The other import statements work perfectly fine.

import java.util.Random;
import java.util.Scanner;

Upvotes: 2

Views: 313

Answers (1)

System.out.println
System.out.println

Reputation: 21

I don't know if you keep having this problem with DrJava, but I'll post my solution in case someone else has the same issue.

I had exactly the same problem as you mentioned in DrJava. It would continuously show the same error, while invoking a method from java.util.Arrays, such as .toString(). I had downloaded the old stable release of DrJava (Windows App) through their website, as well as installing the latest updated JDK version. However, this didn't solve the problem. I tried installing other IDE, such as Eclipse, and it worked perfectly.

Thanks to a friend of mine who had the same problem, I was able to fix this. It worked for the both of us.

Try installing the latest current stable release drjava-beta-2019-220051: (https://sourceforge.net/projects/drjava/files/).

And for the JDK, I used the jdk-8u25-windows-x64 (this may vary with your OS and processor type): (https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html)

I'm not sure if this would be the best solution. But after this, it worked perfectly, as I was able to access all methods. Despite this, I still kept installed the latest JDK, which helped me to keep using Eclipse.

Good luck!

Upvotes: 2

Related Questions