0

When compiling my main class I get this error:

Main.java:1: error: package com.formdev.flatlaf does not exist import com.formdev.flatlaf.FlatLightLaf;

I have followed all the steps online, I have gone to project structure, libraries, "+", added the flatlaf.jar file and pressed on apply. I have also tried to revalidate caches. The JDK recognises the import of the library as well as all its functions as they all show up in the suggested and give no errors until you try to compile.

1 Answers1

0

Make sure that you've added the library to the module dependencies. enter image description here

Ethan Yin
  • 156
  • 4
  • Yes the library is on the module dependencies. The weird thing is that in the IDE, the import is coloured and I get all the intellij suggestions with all the functions of the library and I get no errors, however when I go to compile I get the does not exist error. I dont know if its anything to do with the fact I have a src folder inside my project folder where it has all the class files? – Fabrizio Liani Jan 30 '23 at 13:16
  • when we compile a java program with the java compiler javac their is the concept of the classpath, you have the flatlaf dependency set up for intellij configured however its clearly missing from the class-path when you compile, suggest you use a build tool like gradle, maven or ant and the use the build tool to set up the dependencies on the classpath, javac has a classpath flag "-cp" javac -cp {dependency list } {java main class} – Nigel Savage Mar 29 '23 at 17:09