- #COMPILING JAVA WITH JDK 12 INSTALL#
- #COMPILING JAVA WITH JDK 12 UPDATE#
- #COMPILING JAVA WITH JDK 12 ARCHIVE#
- #COMPILING JAVA WITH JDK 12 TRIAL#
My personal conclusion from all of this is that we need to cut Play 2. The 2.8.x branch will never be fully compatible with jdk 16/17, already because Guice 4.2.x (which depends on ASM) won't work with the newer JDK (Guice 5 however will be released soon with JDK 16/17 support, however I don't think it's a good idea to make such a major version bump in 2.8.x). This made me realize that I don't think it makes sense to invest time to make Play 2.8.x work with jdk 16 and upcoming 17 LTS because I don't think that will be successful. I am aware that the jdk 16 community build however builds against Play's 2.8.x branch, therefore I tried to fix this in interplay's 2.1.x branch as well via playframework/interplay#94 - however I was out of luck. So for Play's master branch this issue can be closed (because on master we already use interplay 3.0 which includes the referenced pull request) Go to “Sources”, then “Sources/Binary Format” and choose the corresponding JDK version (I had to).This got fixed by playframework/interplay#101 which dropped support for sbt 0.13 in interplay, which allowed us to get rid of Scala 2.10 and therefore also any -source and -target flag with 1.6 got removed: Right-click on project, go to Properties. You ccan modify the compiler version for a single project on NetBeans. Modify compiler version for a project on NetBeans If you want to run a Java program, you can do that on a JVM (Java Virtual Machine), which is provided with the JRE (Java Runtime Environment).
#COMPILING JAVA WITH JDK 12 TRIAL#
I had to make trial and error until I found the correspondence below. I had the clue that most computers were expecting class file version 52.0, but I was unsure what was the corresponding JDK version I had to use on my compiler.
#COMPILING JAVA WITH JDK 12 UPDATE#
I consider more logical to modify my compiler version (even when it implies not using the latest version) rather than expecting all users to update their JRE’s and modify their configuration just to make run my application.Ĭorrespondence between JDK and class file version When I am making a software, I expect that it is compatible on most computers without configuration changes.
![compiling java with jdk 12 compiling java with jdk 12](https://linuxhint.com/wp-content/uploads/2019/05/2-1.png)
As you can see, a new directory jdk-12.0.1/ is created in the /opt directory.
#COMPILING JAVA WITH JDK 12 ARCHIVE#
The JDK 12 tar.gz archive should be extracted.
#COMPILING JAVA WITH JDK 12 INSTALL#
PS C:> scoop install oraclejdk Installing oraclejdk (12.0.2-10) 64bit PS. Now, extract the Oracle JDK 12 tar.gz archive in the /opt directory with the following command: sudo tar xvzf jdk-12.0.1linux-圆 -C / opt. When I ran the same JAR file using Windows Command Prompt, I got this error:Įxception in thread "main" : package/path/ProjectName has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0 Java development kits (JDK) and runtime environments (JRE) are available. The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java TM platform. This was the error when double-clicking the JAR file:Įrror: A JNI error has occurred, please check your installation and try again The JDK is a development environment for building applications using the Java programming language. To my surprise, there were version incompatibilities even when both were in the latest versions. In my case, I have installed the latest JDK in a MacOS X computer and the latest JRE in other different Windows. So we may want to modify Java compiler version be because of compatibility. However, if the compiler version is newer than the virtual machine version, system will trigger an error when trying to run. We may tend to think that we should always use the latest version of the Java compiler. Preview features are present in all Java compilers and JVM implementations but disabled by default.
![compiling java with jdk 12 compiling java with jdk 12](https://user-images.githubusercontent.com/137350/61695689-4a410780-ad77-11e9-9c1c-e5d5c1a8e2d1.png)
![compiling java with jdk 12 compiling java with jdk 12](https://user-images.githubusercontent.com/17405573/56740110-91b3f980-6770-11e9-804a-c8af87cd401e.png)
Why would I need to change the Java compiler version? This JEP was introduced in 2018, circa JDK 12, to allow two kinds of preview feature in the Java SE Platform: preview language features and preview VM features.