0

So basically, I'm working on a project and recently got a new Laptop. Cloned the repository, and IntelliJ seems to have a problem with the following import statement:

import jdk.jshell.spi.ExecutionControl;

telling me that the package does not exist. I am seriously at a loss why only this one specific one does not work.

It's a Maven project, Java 11. I've tried various maven commands (clean install, clean package, site, ...), none of which did anything. Rebuilt the project, invalidate chaches/restart, even deleted the local repo and cloned the project all over again - still nothing.

So it must be a problem with the machine itself - maybe I'm missing something? Maybe some IntelliJ setting is wrong?

Help of any kind would be immensely appreciated, I am quite stuck with this atm.

jay p
  • 175
  • 1
  • 2
  • 9
  • Does your project have a `module-info.java` file in it? – VGR Jul 27 '19 at 01:55
  • Are you sure that the one exception PC has java 11 and that the JDK on the path is that java 11 one? That package is not available in java 8, could you be using jdk8 on that machine? `javac -version` will tell you for sure. – Paul Hicks Jul 27 '19 at 02:16
  • Does https://stackoverflow.com/a/56388149/104891 help? – CrazyCoder Jul 27 '19 at 02:19
  • No, I do not have a module-info.java file, and I wouldn't know what it is. I am running Java 11, and disabling "use --release" did not do anything :/ – jay p Jul 27 '19 at 21:03
  • Please share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – CrazyCoder Aug 05 '19 at 18:06

1 Answers1

1

I had that same issue too. I updated to Java 13, changed the JDK in the IntelliJ project structure and now it's working totally fine.

Check here how to change the JDK in the IntelliJ project structure: https://www.jetbrains.com/help/idea/sdk.html?_ga=2.136543410.361341407.1574701301-2015064944.1569589449#change-project-sdk

Change project SDK From the main menu, select File | Project Structure Ctrl+Shift+Alt+S.

On the panel on the left, locate the Project Settings section and select Project.

From the Project SDK list, select another SDK or SDK version.

If the necessary SDK is not defined in IntelliJ IDEA yet, click New and specify its home directory.

Isa
  • 11
  • 2