Skip to main content

Using lambdas in JDK8

1 reply [Last post]
bjbarton
Offline
Joined: 2012-06-28
Points: 0

I just downloaded the JDK8 snapshot (b44) and installed it on my MacBook.
The compiler runs but informs me that I need to specify -source 8 to use a lambda expression.
I do this and get the same error message.

Is the current snapshot supporting lambda expressions?
If so, how do I tell the compiler that I want to process lambdas?
If not, should I install the latest lambda version and try that?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sunnyjava
Offline
Joined: 2006-10-25
Points: 0

I still get this error with the b59.
Is lambda still not available for Early access outside Oracle?

C:\Users\XYZ\RnD\Java8>javac -source 8 Main.java
Main.java:4: error: lambda expressions are not supported in -source 1.8
String user = doPrivileged(() -> System.getProperty("user.name")
);
^
(use -source 8 or higher to enable lambda expressions)
1 error

C:\Users\XYZ\RnD\Java8>