Monday, April 28, 2014

Java 8 - Learn Lambda Expressions Part 3

Posted by Sharath
Hello Friends, 

As in the first two parts we got some idea about Lambda Expressions - Now we will proceed how to execute the Lambda Expressions (LE) in our local JVMs. 

You can do it by two simple ways 
- IDE 
- Command Prompt. 

1) IDE - As we all know NetBeans also from Oracle Corporation they launched NetBeans IDE 8 along with Java 8 - You can download that and proceed to execute Java 8. Otherwise if you are eclipise user you have to wait till 'Luna' whihc is slated to release in June 2014. 

2) Command Prompt: Obviously you can execute the Java 8 through Command Line with much more easy facilities provided from newer version. 

Here while I am trying to execute I got a situation where in my Java 6, Java 7 were already installed. So how to execute with Java 8 - Though I can uninstall them and I can use Java 8 but some softwares/sites using Java 6/7 so i tried out for a workaround. 

Here I am explaining you that workaround - Where if you already ahving any java version also you can still work with Java 8 using this below technique. 

For example - if you have a source on your desktop with a folder named 'Sharath' - and the java class which you want to compile using your Java 8 JDK is 'TestJava8Program.java'

In order to execute this - Assume your java 8 installed in C:\Program Files\Java\...\bin\

In Command Prompt for Compiling: 
C:\<<AbsolutePath>>\Desktop\Sharath\"C:\Program Files\...\Java\..<<Java8JDK>>...\bin\javac.exe" TestJava8Program.java  - Enter 

In Command Prompt for Executing: 
C:\<<AbsolutePath>>\Desktop\Sharath\"C:\Program Files\...\Java\..<<Java8JDK>>...\bin\java.exe" TestJava8Program  - Enter




Post a Comment