Reputation: 376
I have a simple code with a main class, but it is not identified by ide, I am not identifying the problem.
Main.java
public class Main {
public static void main(String[] args) {
FileReader leitor = new FileReader("config.txt");
BufferedReader buffer = new BufferedReader(leitor, 2 * 1024 * 1024);
String linha = buffer.readLine();
while (linha != null) {
System.out.print(linha+"\n");
linha = buffer.readLine();
Thread.sleep(1000);
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
I can't select the main class
Thanks
Upvotes: 1
Views: 166
Reputation: 5164
Intellij did not recognize the java
folder as a source folder.
I guess, you did not import the project as a maven project. Checkout the import maven project guide.
To fix this quickly, you can right click on the java
folder, select Mark Directory as
and choose Sources Root
.
Upvotes: 1