2

I've got a maven project that uses Java 9. It imported into IntelliJ IDEA 2017.2.3 Community.

But for some reason it cannot find standard java classes like String or Float. For example

enter image description here

When I try to Setup Project JDK it changes nothing

enter image description here

What is the problem?

module-info looks like this

module com.lapots.breed.platform.cloud.javacloudsample {
    requires spring.boot;
    requires hibernate.jpa;
    requires spring.web;
    requires spring.boot.autoconfigure;
}

Project itself is there java-cloud-sample

Naman
  • 27,789
  • 26
  • 218
  • 353
lapots
  • 12,553
  • 32
  • 121
  • 242
  • Did you create a `module-info.java` with `requires java.base`? – Naman Sep 07 '17 at 10:49
  • 1
    Which JDK 9 build do you use? – CrazyCoder Sep 07 '17 at 10:53
  • @CrazyCoder 9+181 – lapots Sep 07 '17 at 11:45
  • @nullpointer nope. added my `module-info` to question – lapots Sep 07 '17 at 11:46
  • @user1432980 and does adding `requires java.base` not solve your problem? – Naman Sep 07 '17 at 11:48
  • @nullpointer it marks it as red – lapots Sep 07 '17 at 11:49
  • @user1432980 What error does it read? – Naman Sep 07 '17 at 11:51
  • @nullpointer module not found `java.base` – lapots Sep 07 '17 at 11:55
  • @user1432980 Using your project itself. I am unable to reproduce the error. Probably check your IntelliJ configuration, specifically project structure for Project and SDK configuration. By the way intelliJ 2017.2.3 and jdk-9+181, here as well. – Naman Sep 07 '17 at 12:20
  • 2
    Looks like the SDK is not configured correctly in the IDE. You (mis-named) Classpath tab will is the modules in the JDK when you have it configured correctly. – Alan Bateman Sep 07 '17 at 12:49
  • @AlanBateman hm I though `9` is the new naming of `jdk` (instead of `1.9`). Indeed with `1.9`. Also it names it as `9` by default. it works now! Thanks. – lapots Sep 07 '17 at 14:22
  • Does [this](https://stackoverflow.com/a/46002269/6166627) help you? – Sam Sep 07 '17 at 15:29
  • 1
    @Sam, setting JDK was enough – lapots Sep 07 '17 at 15:56
  • 1
    @user1432980 I believe this should be closed. This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting. – Naman Sep 07 '17 at 17:12
  • @lapots I am facing exact same problem on my mac. Could you please elaborate what solved your issue. – Naman Apr 21 '18 at 00:48
  • @Naman well I am not sure regarding latest versions of IDEA but I by default it configured java 9 as 9 version (new naming or something), I just changed to 1.9 (similar to 1.8) – lapots Apr 21 '18 at 20:20

0 Answers0