I am using jdk9-ea 149 and created a sample javafx application
IntelliJ doesn't understand the java libraries, It's shows all the import statement in red color and they are all grayed out.even for java.util.List, java.util.ArrayList it has the same issue.
I am able to compile form outside but i am not able to compile the code from IntelliJ 2016.3.2 Ultimate Edition.
It looks like we need to add some libraries to IntelliJ project but with java9 build 149 jigsaw i don't know how to do that.
I am using Experimental features still it doesn't understand the import statements - see intellij setting below
IntelliJ Version : IntelliJ 2016.3.2 Ultimate Edition
Java Version: java 9-ea build: 149
As mentioned in IntelliJ IDEA 2016.3.1 is Out:
Speaking of JDK 9, IntelliJ IDEA 2016.3 won’t support builds 148 and up because they contain code that breaks things. Of course, we’re working to resolve this, and will support the latest JDK 9 builds in 2017.1 (its EAP may well start within the next few weeks).
In IntelliJ IDEA 2017.1: Java 9, Kotlin 1.1, Spring, Gradle, JavaScript, Go and more it says:
The latest builds of JDK 9 are fully supported, with assisted project import and coding assistance for editing module declarations.
So if you are using Java 9 build 148 or higher, you need to use version 2017.1 or higher.
Alternatively, if you need to use an older version of IntelliJ, downgrade to Java 9 build 147 or lower.
The latest version of IntelliJ IDEA, 2017.1, does support jdk 9.
Related
I am fully aware that there are pages on the Gradle website that say how to upgrade, but only from 4.x and up.
I am trying to follow a tutorial in making a simple 'my first' Minecraft mod. In it, you are told to install forge 1.7.10, which, from what I understand runs on Gradle 2.0.
In order for me to continue with the tutorial, after some digging, it appears that Gradle 2.0 is not compatible with JDK 12.0.2, but I'm not entirely sure how to solve this.
any help is much 'preciated.
extending the answer from Chriki, you can change the gradle version in $projectroot/gradle/wrapper/gradle-wrapper.properties
here you can change the path to point to already downloaded gradle-bin,
something like this (distributionUrl=../../../build/tools/gradle-4.10.3-bin.zip)
or directly to gradle repository
(e.g. distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip)
I’m afraid, you have a chicken and egg problem here: your JDK 12 requires a recent Gradle version (at least 5.4, if I’m not mistaken). At the same time, the forge plugin that is used in your build doesn’t support Gradle 5, yet.
Maybe you can install and use JDK 11 instead? In that case you could work with Gradle 4 with which the forge plugin also seems to work. With my JDK 11 installation I could get the build to work as follows:
sed -i 's/gradle-2.0/gradle-4.10.3/' gradle/wrapper/gradle-wrapper.properties
This changes the Gradle wrapper version to 4.10.3 in gradle/wrapper/gradle-wrapper.properties (can also be done manually with a text editor). When I now run
./gradlew project
the build seems to generally work fine. It only complains: “You must set the Minecraft Version!” That’s a different matter, though.
For anyone here from Google, Minecraft Forge versions below 1.12 DO NOT SUPPORT any java version besides JDK8. You need to install JDK8.
The maximum version you can update your Gradle to is therefore 4.8.1, as any versions above that require JDK9.
I have a project with many modules, all of which need to be compiled using Java 7. I have made sure every setting that I know of to point to that version of Java, yet somehow, every time I rebuild the project I get:
Information:javac 11.0.3 was used to compile java sources
followed by a list of errors:
Warning:(86, 25) java: as of release 9, '_' is a keyword, and may not be used as an identifier
Error:(86, 25) java: cannot find symbol
symbol: class _
location: class com.(...)`
Following other questions like:
Can't resolve -source errors on IntelliJ with regards to Project Language Level
IntelliJ IDEA tells me "Error:java: Compilation failed: internal java compiler error idea"
I have tried these settings:
Under Project Structure -> Project -> Project SDK: 1.7
Project Structure -> Project language level -> 7 - Diamonds, ARM, multi-catch etc.
Under Project Structure -> Modules checked every module, and that was not fun, because there are about 50. Sources tab -> Language level: Project detaulf (7 - Diamonds, ARM, multi-catch etc.)
Project Structure -> Modules, each Dependencies tab -> Module SDK: Project SDK (1.7)
Project Structure -> SDKs: it listed IDEA's built in Java 11, so I removed it, leaving only: 1.7
Settings -> Java Compiler -> Use compiler: Javac
Settings -> Java Compiler -> Use compiler from module target JDK when possible: unticked
Settings -> Java Compiler -> Per-module bytecode version: all modules set to 1.7
I am running the latest version of IntelliJ IDEA:
IntelliJ IDEA 2019.2 (Ultimate Edition) Build #IU-192.5728.98, built on July 23, 2019
Is this a bug with IDEA?
Here is the reason Intellij is choosing java 11:
https://www.jetbrains.com/help/idea/configuring-build-jdk.html
IntelliJ IDEA checks all JDKs that are used in the project: the JDKs
that are defined on both the project and module levels.
IntelliJ IDEA calculates the latest of these JDKs. This is necessary
to make sure that all modules can be compiled.
If the version of the latest JDK configured is lower than 1.6,
IntelliJ IDEA will pick the JDK version that is used for running the
IDE. This limitation is related to the fact that the compiler API used
by IntelliJ IDEA for building projects is supported starting from JDK
1.6.
And that is why switching the boot JDK to JDK8 re-enables the compilation of older java classes.
As mentioned in the comments by #Arnaud Claudel, I have tried switching the boot JDK of IDEA (described here https://www.jetbrains.com/help/idea/switching-boot-jdk.html) which helped. Incidentally, the lowest JDK version that IDEA will accept is 8.
I am not sure it is actual solution though and not just a workaround, because why would the IDE use JDK 11 in the first place, ignoring all the project's settings.
So I am leaving this question open for anyone to post a better solution.
I am transiting my project to use openjdk 8 from adoptopenjdk... I understand that OpenJDK does not carry javafx anymore. So I set the org.openjfx.javafx as my dependencies for the project. I see the dependency connected... but why does my import still can not find it?
Building in local terminal is the same issue
error: package javafx.util does not exist
import javafx.util.Pair;
^
Dependences are all there...
compile 'org.openjfx:javafx-controls:11'
compile 'org.openjfx:javafx-fxml:11'
What am I missing?
What you are trying to achieve will never work because Java8 is simply not compatibel with JavaFX 11 or 12. You will either have to use a Java 8 distribution which contains JavaFX or you will have to upgrade your Java to at least 11 too.
Liberica JDK 8 is an OpenJDK distribution that contains JavaFX. Choose the Full JDK.
I have searched but not found any detailed information about it. In http://www.oracle.com/technetwork/java/javafx/downloads/index.html it says
As of JDK 7u6 JavaFX is included with the standard JDK and JRE bundles
But I am getting error on compile the code includes javafx.* packages. The packages are not founding. I am using Oracle JDK 10.0.2 and Intellij Idea 2018.2. Code is worked after I added the $JAVA8_HOME/jre/lib/ext/jfxrt.jar as library.
But the strange thing is I am able to build the code to target bytecode version 8 without adding the jar file from JDK 8 as above.
So the question is
How can I get the latest JavaFX?
Is the latest JavaFX is in the JDK 8?
UPDATE
JDK 10 includes JavaFX and compiled and ran successfully in command line. There is a problem with Intellij IDEA 2018.2. It does not recognize the JavaFX packages.
The error message in Intellij:
Error:(3, 26) java: package javafx.application does not exist
Note: There is no error while coding in editor (Not underling red). Error occurs when compiling in Intellij.
Updated question title.
JavaFX is included in Oracle JDK up to and including Java 10. From Java 11 onwards it will not be included anymore but can be downloaded separately here http://jdk.java.net/openjfx/ .
Additional information on how to get started with JavaFX from version 11 onwards is also available here: http://docs.gluonhq.com/javafx11/ .
Problem solved with this step:
Set the Project byte code version to 10 instead of 8 in
File > Settings > Build, Execution, Deployment > Compiler > Java Compiler
Thanks for helps.
I just read How to have Eclipse use JDK8 to compile a project?
What i added jdk8 to eclipse as,
From the answers of How to have Eclipse use JDK8 to compile a project?
I tried to Update the JDT/Core, JDT/UI bundles from http://dist.springsource.com/snapshot/TOOLS/java8/e43
But it shows error as,
"Eclipse Java Development Tools Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed.
"Eclipse Plug-in Development Environment Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed.
How Can i fix it ?
I can say that Java 1.8 does in fact work with Eclipse Luna ( the beta version released around March 17, 2014) or later. I tried it and it was good.
Also, I noticed that in the Eclipse Marketplace, there are now plugins to install functionality into Kepler to support JDK1.8. I haven't tried the plugin myself though.
This is a old topic but I just wanted to point out that I have searched enough to find that Indigo version can't be updated to S.E 1.8 here the link which is given on eclipse website to update the Execution Environment but if you try it will throw error for Indigo.
Here is the link where the Information about execution environment is given.
This shows the step by step to update Execution environment.
I have tried to update Execution environment and I got the same error.