KDecker
KDecker

Reputation: 7148

IntelliJ compilation issue, java cannot find symbol yet provides its location?

I am developing an application in IntelliJ which has a class HackTrickBoard in a well defined namespace AbstractGames.ConcreteGames.mnkGame.HackTrick. In the same namespace I have created a new class HackTrickGUI with one method Main, in this method I simply instantiate a new HackTrickBoard class.

package AbstractGames.ConcreteGames.mnkGame.HackTrick;

// Marked as unused in IntelliJ
import AbstractGames.ConcreteGames.mnkGame.HackTrick.HackTrickBoard;

public class HackTrickGUI
{
    public static void main(String s[])
    {
        //HackTrickBoard board = new HackTrickBoard();
        AbstractGames.ConcreteGames.mnkGame.HackTrick.HackTrickBoard board = new AbstractGames.ConcreteGames.mnkGame.HackTrick.HackTrickBoard();
    }
}

When I try to compile this code I am given an error

java: cannot find symbol
  symbol: class HackTrickBoard
  location: AbstractGames.ConcreteGames.mnkGame.HackTrick

It seems that java cannot find the HackTrickBoard class yet knows where it is? IntelliJ had no issue finding it from the autocomplete menu and does not highlight its syntax as an error.

Is something wrong with Main?

In IntelliJ for the Run/Debug configurations I did not see an option for a command line application so I am starting this as a "Application", maybe this is the issue?

Upvotes: 0

Views: 542

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 402443

The class could be excluded from compilation, it's indicated by a small x on the class icon in the project view.

Excludes can be removed here:

excludes

Upvotes: 1

Related Questions