Fix for Java Cannot Find Symbol: QClasses

Batuhan Kök
2 min readNov 29, 2022

--

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;

  1. Open the project
  2. Build it with Maven or Gradle
  3. Scroll down to “target” folder
  4. Right click to “generated-sources > java
  5. Select “Generated Sources Root
IntelliJ IDEA — JetBrains

And that’s it! It should fix the error and you should be able to see your generated classes.

See ya 👋

--

--