Oracle’s latest edition of the world’s biggest software platform, Java 8 was released on March 2014. Here are the 5 things you need to know about this edition of this marvelous language.
1. Introduction of Lambda Expressions.
Lambda Expressions let you treat functionality as a method argument, or code as data. Simply, they let us create ‘anonymous‘ functions that do not need to be bound to an identifier.
More information about Lambda Expressions can be found here.
2. Introduction of Compact profiles
Sure, we all know that the Java platform is getting bigger and bigger in terms of the system classes and libraries. At last they (Oracle) recognized this and have come up with a ‘profile‘ mechanism that lets you choose a ‘compact’ profile to be used. This provides 2 important benefits:
a. It reduces the memory footprint of the application
b. It reduces the application start up time
Three profiles are introduced: compact1, compact2 and compact3. Each profile contains all APIs of all the profiles lower than itself. You invoke the javac command with the ‘-profile’ option to use the profile desired.
More information about compact profiles and what exactly they contain, see this Oracle blog post.
3. Nashorn Java Script Engine
You can invoke Nashorn in 3 ways.
a. Use Java Scripting API (javax.script) to invoke an instance of Nashorn Engine.
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName(“nashorn”);
b. Use the command jrunscript
c. Use the command jjs
Note that you can use Unix Shell Scripting features for Java Script scripts with nashorn engine (How cool ?)
4. JDBC-ODBC bridge is GONE
I have no idea if folks are still using this. But it can be a disaster if you used it and you upgraded to Java 8. Move to the JDBC driver provided by the Vendor.
5. Memory Management change
PermGen (Permenant Generation is GONE). It has been replaced by MetaSpace. See my other article for more information.
There are various other additions and changes with Java 8. See the complete list here.
PS: Being an APM (Application Performance Management) enthusiast, I’m looking forward to explore the Java Mission Control 5.3 that is included with Java 8. 🙂
Happy Engineering !!