Skip to Content
author's profile photo Former Member
Former Member

Java 1.8 and hybris 5.5.1: compiling lambda's

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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 20, 2015 at 11:26 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2015 at 11:15 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2015 at 11:18 AM

    Sorry typo I use 5.5.1 :)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2015 at 11:45 AM

    Works perfectly ! Thanks !

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.