cancel
Showing results for 
Search instead for 
Did you mean: 

Java 1.8 and hybris 5.5.1: compiling lambda's

Former Member
0 Kudos

I use Hybris 5.1.1 and run it with Java 1.8.

When I use Java 1.8 to compile a java file with a lambda expression, I get the following error:

[yjavac] Lambda expressions are allowed only at source level 1.8 or above [yjavac] ---------- [yjavac] 1 problem (1 error)

When I try in platform/resources/ant/util.xml to change the yjavac task call to add

it says [yjavac] Unrecognized option : -source 1.8

How can I compile Java 8 code?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Aha, that completely changes situation 😉

You shouldn't change anything in util.xml or whatever build related file. The only thing you need to do is to put in your local.properties:

 build.target=1.8
 build.source=1.8

and recompile. 5.5.1 was transition release so default was still 1.7 but able to compile with target 1.8. Platform 5.6 will come with these settings set to 1.8 (btw without backward compatibility with 1.7). I hope it will help.

Answers (3)

Answers (3)

Former Member
0 Kudos

Works perfectly ! Thanks !

Former Member
0 Kudos

Sorry typo I use 5.5.1 :)

Former Member
0 Kudos

Platform 5.1.1 is not compatible wit Java 1.8. We have provided support for Java 1.8 from platform 5.5.1. The main problem is the fact that if you want to use JDK8 you must use Spring 4, and your version of platform is using Spring 3.