5
votes

I'm using IntelliJ IDEA 12 Ultimate for the trial period and came across a bit of a weird issue. While going through the code for a recent tutoring job, I had the screenshot below after trying to compile a class:

enter image description here

The error output is after pressing Ctrl-Shift-F9 to compile the class DrawCircleLab8. As you can see, DrawingPanel is indeed in package lab8 and there are no errors until the compile time exception.

When I imported the exact same project structure in Eclipse, I was able to compile and run without a problem.

Changing the SDK from 1.7 to 1.6 had no effect. How can I resolve this issue for IntelliJ?

1
can you compile through the command line? - Apollo SOFTWARE
@AmitApollo, yes, javac works, as well as eclipse. The joker of this deck is idea 12. - Jason
I've had a similar problem with Android Studio (based on intelliJ). I had to end up using eclipse, and the sad part is it was a simple ubiquitous mail class I was using, and it was a Runtime error not Compile time, which I thought was odd. I know with android studio you have to do a gradlew clean, and then set your compilation dependencies and libraries appropriately. It's definitely an IDE centric issue though! - Apollo SOFTWARE

1 Answers

7
votes
  1. Try removing import statement for this class and then adding it once again.

  2. From your screenshot I assume that src is already marked as a source root, but to be sure you can do this once again:

    • right-click src in the Project Tree
    • select Mark as... -> Source root
  3. If the above won't work, try to compile whole project first. Compiling only one class may not work if you had never compiled the rest of the project before.