1

Disclaimer:

I asked a question yesterday, which was marked as a duplicate of this question.

However, the person who marked it, didn't keep into consideration that me following the duplicated post's answer didn't sort my issue. Furthermore, that question was concerning a move from Java 8 to Java 9, which was in beta at the time.

In my case, I'm upgrading from Java 8 to 11 (oracle, not openjdk), which is the current stable version of Java. Furthermore, I'm running the second to latest version of InteliJ (2018.3), latest being 2018.3.1.

I followed the steps outlined in my question's comments, but it still doesn't solve my issue.

Finally, the issue I'm facing isn't only that some package's zip headers are empty, but that references to classes in the same source root can't be accessed.


Actual question:

As mentioned in the title, I've updated my JavaSDK version to 11.

When I do this, all of IntelliJ's references (class references in the same source root folder) are lost. Even package declarations are invalid when using later version of jdk. When I run it on 1.8, it all runs fine (see first image for successful rebuild).

Version

After changing to openjdk-11, which was upgraded by following this answer - see manual, I receive these errors:

Errors

As you can see in the above image ListExample is in the correct package / source root, but seems to be inaccessible (The file does indeed exist!).

I've followed advice on other threads, such as rebuiling, invalidating cache, restarting etc etc.

Nothing seems to allow me to compile the project.

EDIT:

Latest screenshot (06/12/18) with JDK 11.

enter image description here

Compilation successful screenshot with JDK 8:

enter image description here

Failed compilation of Person.java class:

enter image description here

geostocker
  • 1,190
  • 2
  • 17
  • 29
  • have you updated IntelliJ as well? – Naman Dec 05 '18 at 17:14
  • You're using Unity so my confidence in that you're using an updated version of IntelliJ is pessimistic. The dupe linked illustrates what you can do. – Makoto Dec 05 '18 at 17:15
  • @Makoto I'm using IntelliJ Ultimate 2018.3, with the latest stable version of Java, downloaded from Oracle. The issue you referred to is a person using Java 8, which works fine on my machine (see the first screenshot). – geostocker Dec 05 '18 at 17:17
  • Checking for updates does, indeed provide me with 2018.3.1, which surely should not solve this issue? Please unmark as duplicate. – geostocker Dec 05 '18 at 17:18
  • ...No, the other person was using Java 9 there, not 8. – Makoto Dec 05 '18 at 17:18
  • That still doesn't explain why I'm having this issue on jdk-11 when I'm missing a minor update to IntelliJ. I'd understand it if I hadn't updated IntelliJ since say January this year (jdk-11 was released in March). Please unmark the duplication or cite a more recent source. – geostocker Dec 05 '18 at 17:20
  • @Makoto I just followed the linked provided in the comments (following it to [here](https://www.linuxuprising.com/2018/10/how-to-install-oracle-java-11-in-ubuntu.html)). Installing that version still doesn't work. – geostocker Dec 05 '18 at 17:45
  • 1
    Have you tried to build project in command line? Do you get the same errors there? – y.bedrov Dec 06 '18 at 08:41

1 Answers1

1

IntelliJ shows that it couldn't load the entire project:

16:50 Error Loading Project: Cannot load 2 modules Details...

Moreover you have broken dependencies:

enter image description here

You most likely need to resolve that type of problems and do a project rebuild (Build > Rebuild Project from top menu). Currently you are running a partially imported project, it's hard to tell what is the root cause.

Karol Dowbecki
  • 43,645
  • 9
  • 78
  • 111
  • I've tried rebuilding and invalidating cache multiple times. Doesn't work... :/ – geostocker Dec 06 '18 at 12:12
  • Did you resolve the project import problems? Are all the modules loaded and there are no errors other than compilation problems? – Karol Dowbecki Dec 06 '18 at 12:43
  • No errors that I can see. I've moved files around a bit, but they are in the correct packages (correct paths) and are importing files that do exist. As mentioned in my question, everything builds fine on JDK 8, but breaks on JDK 11. It seems to have less to do with the project structure and more to do with something else. :/ – geostocker Dec 06 '18 at 12:46
  • Added an edit to display what I'm seeing now (just running the one project in its own window). – geostocker Dec 06 '18 at 12:48
  • I also added another screenshot where the compilation is successful in the same project, with the only difference being what JDK version is used (1.8 to 11). – geostocker Dec 06 '18 at 12:50
  • Can you show the `Person` class source and that it compiles without errors on Java 11? It could be the Jigsaw modules which were introduced in Java 9. – Karol Dowbecki Dec 06 '18 at 12:51
  • It doesn't compile. Even though it doesn't refer to any other class in my project, the package is incorrect somehow. See edit in a few seconds. – geostocker Dec 06 '18 at 12:52
  • You have broken dependencies in your project, empty ZIP files. Perhaps some of them are not compatible with Java 11. Fix this problems before looking into problems in IntelliJ. – Karol Dowbecki Dec 06 '18 at 13:00
  • That's so strange, tho... I imported the package references suggested by IntelliJ. Any suggestion(s) on how I can do this? I literally started using IntelliJ last week and have no clue where to even start. – geostocker Dec 06 '18 at 13:03
  • OK. I just went on and deleted the packages in the path. All seems to compile now... So strange. :/ – geostocker Dec 06 '18 at 13:08
  • @geostocker Moral of the story, do not ignore errors as they will have potentially unforeseen consequences. – Karol Dowbecki Dec 06 '18 at 13:10
  • Indeed. It's interesting how those errors have little to no impact on the references, though. I would have understood if I couldn't build x if it depended on package y which didn't exist. But recompiling Person, which had no dependencies, still raised the package error. Thanks. I'll mark this as my answer. Appreciate it – geostocker Dec 06 '18 at 13:12