Idea Intellij: Can't import the libraries: package does not exist

Viewed 11525

I'm trying to make use of a jReddit library, which, in turn requires apache HttpComponents and Commons IO libraries.

I downloaded the sources, added them in Itellij Idea through File - Project Structure - Modules - Add Content Root.

All the classes from the libraries that my code makes use of are imported successfully. But the problem appears when compiling - it says that package com.github.jreddit.oauth does not exist and package org.apache.http.impl.client does not exist and that it cannot find symbol of those libraries' classes.

Why does this happen and how to fix it?

2 Answers

I ran into this error after upgrading IntelliJ to version 2019.1. These steps fixed it for me:

  1. Click Run from the toolbar
  2. Choose Edit Configurations
  3. Make sure the Scratch file you want to run is selected on the left panel
  4. In Use classpath of module dropdown, select the project module that contains the proper module
Related