Could someone explain to me what the deal is with ...
# getting-started
j
Could someone explain to me what the deal is with JDK versions? 11 is the latest but 8 seems to be mostly used. One is going to be managed by OpenJDK and the other by OracleJDK? Are there licensing differences as well? Should 8 be used when starting fresh?
s
Howdy - strictly speaking Java 12 is the latest version, JDK 11 is the most recent LTS version
j
So if we add 12 in to the mix, does it affect the answers to the questions? 🙂
s
Well, unless your environment requires you to use JDK 8 to build (which is not uncommon), there isn’t necessarily a specific reason to stick with it
o
I believe there are licensing issues. I think you’re safe with OracleJDK for 8, but after you may need to use OpenJDK.
s
Everyone believes there are licensing issues, but nobody ever expands on what that means
m
If you're starting fresh, I'd strongly recommend starting with either 11 or 12. As to 11 vs 12, that's a corporate/environment/business decision. 11 is LTS, so you won't feel compelled to update until 14 (the next LTS). Reduces the number of times you're upgrading, but does mean you have to wait a bit longer for some new features. This assumes you don't have some business/technical restrictions somewhere in your process that only support 8.
👆 3
j
When I started a fresh Kotlin project, I saw that
implementation(kotlin("stdlib-jdk8"))
was added by default. Does JDK version affect Kotlin in some way?
s
The short answer is no, but like all things in software development there are caveats
I would say don’t worry about it until you need to
j
Disclaimer: My usecase is purely on a personal project level
I was a bit surprised that I had to create an Oracle account to download a JDK
m
Kotlin targets JDK6 as a base (for Android primarily). The stdlib-jdk7 and stdlib-jdk8 add some features to the stdlib that can ONLY be done on those JDK versions.
s
Ehhh you don’t actually need an oracle account is the thing - they just have a really poor UX on that front
s
From the article:
>>
Called Java SE Subscription, the new program for mission-critical Java deployments provides commercial licensing, with features offered such as the Advanced Java Management Console. Also, Oracle Premier Support is included for current and previous Java SE releases. It is required for new deployments of Java SE 8, and includes support for Java SE 7. (As of January 2019, Oracle will require a subscription for businesses to continue getting updates to Java SE 8.)
this does not meaningfully affect anyone running a newer version of the JDK
and even those of us stuck building with JDK 8 simply use AdoptOpenJDK or Corretto or a similar offering
👍 1
j
This is all a bit much. 😄 For someone building something on their own, what should I use, do I have to even think about which version I use?
s
you really don’t lol
j
OK 😄
s
I’d say grab JDK12 for whatever platform you’re on
if you’re on macOS I can give you the
brew
instructions if you need ’em
j
I'm on Windows. So what would I have to change in my project for it to use 12 for instance?
I'm using IntelliJ and Gradle for what it's worth
s
If you’re building with IntelliJ, you can set your project to use your newly-installed jdk to build/run
you can keep the stdlib-jre8 dependency
you’ll probably also wanna read through this page to clarify what options you have in your
build.gradle
https://kotlinlang.org/docs/reference/using-gradle.html
m
@Shawn stdlib-jdk8 for JDK9+ otherwise it conflicts with the module system.
s
oh, whoops, typo on my end
👍 1
good catch
j
Alright thanks @Shawn and @Mike
👍 2
c
This article by the Java Champions give a great update on the legal stuff https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244
💯 1
Recently released project provides for supporting Java syntax for Java 12 on Java 8. https://github.com/bsideup/jabel
🤯 1