Can't load Rlexer as lexer or parser in Intellij

I installed Java on my system + I also read the content on the Internet, but still, because I use IDE, I only get this error. At the same time, I want to tokenize a text file using lexer, and I get this error. How can I fix this error? enter image description here


  • Solution: The problem was that when we right-clicked on the grammar file and selected the Generate Antlr Recognizer option, we had to mark the gen directory that contained the Java file as the root source. enter image description here Java file was not in our output directory (out), the IDE could not find Java files and because of this it gave the above mentioned error..