Skip to main content

Install and play with Java 11

If you got the chance to read my other article about new features in Java 11 you already know what all features we are going to get when Java 11 releases on September 25th. In case you haven’t read already please do check it out “Are you ready for Java 11?” here.

Are you going to wait till September 25th to try out new features? I am sure definitely not. So what you should be doing now to have some hand’s on JDK 11 features? This article is exactly about that in which I will be guiding you on how you can download JDK 11 and play with it. So without wasting any more time let’s begin.

So Step 1, grab the JDK 11. You will need to head to http://jdk.java.net/11/ and download JDK 11 Early-Access build. You can download either OpenJDK build or Oracle JDK build. In order to download Oracle JDK build you will have accept the Early Adopter Development License Agreement at this point.

So once you finish downloading, extract and install it on your local system. I am sure all of you know the JDK installation process so I will not go into much detail. Make sure you have JDK 11 in the PATH variable and then open command prompt to check the installed Java version.


If you see above then you have successfully installed JDK 11 and you are ready to try out the new features.
I will use JShell – an interactive tool (introduced in Java 9) here to demonstrate the features. In order to open JShell type jshell in the command prompt and you will see jshell prompt.


Let’s try out JEP 323: Local-Variable Syntax for Lambda Parameters according to which 'var' will be allowed for the formal parameters of an implicitly typed lambda expression
If you see in above example var is used as formal parameter in a lambda expression which is implicitly (which means type information is inferred by compiler) typed. 

Here I am using command prompt and JShell because IDE support for JDK 11 is not yet readily available. Eclipse user may have to wait for next quarterly release as Eclipse photon doesn't support Java 11 yet. IntelliJ IDEA users may be lucky as latest update 2018.6 of it supports Java 11. But i haven't tried it yet so please feel free to download it and try out. If none of IDE works you can follow my tutorial and get your hands dirty using command prompt and JShell.

So enjoy your time with Java 11!

Comments

Popular posts from this blog

Local variable type inference : Welcome 'var' in Java

Yes, you read it right. ‘var’ is now available for Java developers as well. JDK 10 which got released on March 20 th , 2018 rolled out a shiny feature which allows developers to use var for declaring local variables. We all know that Java is static typed language. But wait a minute, does this inclusion of var now make Java a dynamic typed language? As we know JavaScript allows to define variables using var and it is indeed dynamically typed language. Quick refresher of static and dynamic types: Static type – Types cannot change at runtime. For example, below java code will not compile int myvar = 1; myvar = “Toyota”; myvar = ["Saab", "Volvo", "BMW"]; Dynamic type – Types can change at run time. For example, below code in JavaScript is valid var myvar; myvar = 1; myvar = “Toyota”; myvar = ["Saab", "Volvo", "BMW"]; So to answer the question “Does this inclusion of var now make Java a dynamic t...