Fix for Java Cannot Find Symbol: QClasses
When you use QueryDSL or something similar, they generate some classes in build process instead of you. With these auto generated codes, some operations migth be easier for you or they can save your time to generate like getter/setter methods everytime that you change the properties of the class.
However, these generated classes might be a little bit annoying. Even if you try to build or compile the project, you may not have generated classes or dispite you have the codes, sometimes Java cannot find these classes.
Actually, you can try some methods to fix this, but first, I recommend you to need to check and perform the method that I’ll share below.
Let’s save your time and mental health with such a trick;
- Open the project
- Build it with Maven or Gradle
- Scroll down to “target” folder
- Right click to “generated-sources > java”
- Select “Generated Sources Root”
And that’s it! It should fix the error and you should be able to see your generated classes.
See ya 👋