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
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.