1

I'm using IntelliJ to build a Spring Boot Java project with Gradle. I have jcommon-1.0.23.jar and jfreechart-1.0.19.jar in a libs directory and follow these solutions to add Jar files as libraries in IntelliJ.

It works fine in another project, but in this project, nothing works and I got the error

Task :compileJava D:\dev\logsview\logsview\src\main\java\com\tool\logsview\generic\entity\GanttChart.java:4: error: package org.jfree.chart does not exist import org.jfree.chart.ChartPanel;

The weird thing is after some tries, the IDEA doesn't show errors, but still fails when compiled.

Java file:
enter image description here

Lib dir structure:
enter image description here

Lib added in Project Structures Module:
enter image description here

Lib added in Project Structures Lib: enter image description here

I have tried restarting the IDEA, recompiling, compiling using the command line and IDEA, etc.

HoRn
  • 1,458
  • 5
  • 20
  • 25
Elly
  • 145
  • 7
  • For reference, version 1.5.3 is current. – trashgod Oct 18 '22 at 22:19
  • Did you add dependency to your build.gradle? – notAPPP Oct 18 '22 at 23:14
  • 1
    Since you're using Gradle as a build system Project Structure settings might be lost after the project reload. Instead of manually adding dependencies to your project you can add https://mvnrepository.com/artifact/org.jfree/jcommon/1.0.23 and https://mvnrepository.com/artifact/org.jfree/jfreechart/1.0.19 to your build.gradle file and reload the project. – Egor Klepikov Oct 19 '22 at 06:18
  • @EgorKlepikov It works. Thanks for the info! For some reason, I thought build.gradle is used to add springboot-related dependencies only and other libraries should be added via Project Structure. – Elly Oct 19 '22 at 14:49

0 Answers0