Home > Net >  What can I do to fix compiling error on eclipse using Tomcat server on my local machine on eclipse I
What can I do to fix compiling error on eclipse using Tomcat server on my local machine on eclipse I

Time:10-31

I am having an issue when I try to compile my local project on Tomcat Server using eclipse IDE. I am using GWT 2.7.0 and my java version is 1.8.301. When I compile using command line locally, it builds successfully, but when I try compiling using eclipse it yields the following error. Thank you so much in advance for your help, and apologizes if I am not clear with what my issue is.

[ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/ObjectUtils.java'
               [ERROR] Line 1343: Method references are allowed only at source level 1.8 or above
         [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
         Tracing compile failure path for type 'org.apache.commons.lang3.ArrayUtils'
            [ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/ArrayUtils.java'
               [ERROR] Line 3794: Method references are allowed only at source level 1.8 or above
         [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
         Tracing compile failure path for type 'org.apache.commons.lang3.StringUtils'
            [ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/StringUtils.java'
               [ERROR] Line 1214: Method references are allowed only at source level 1.8 or above
               [ERROR] Line 2001: The method getBytes(String) in the type String is not applicable for the arguments (Charset)
               [ERROR] Line 1152: Method references are allowed only at source level 1.8 or above
         [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
         Tracing compile failure path for type 'org.apache.commons.lang3.Validate'
            [ERROR] Errors in 'jar:file:/C:/Users/11033178/.m2/repository/de/knightsoft-net/gwt-commons-lang3/3.12.0-3/gwt-commons-lang3-3.12.0-3.jar!/org/apache/commons/lang3/Validate.java'
               [ERROR] Line 390: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
               [ERROR] Line 343: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 249: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T[], () -> {})
               [ERROR] Line 249: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 296: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
               [ERROR]**strong text** Line 441: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 226: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 390: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 226: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
               [ERROR] Line 296: Lambda expressions are allowed only at source level 1.8 or above
               [ERROR] Line 343: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
               [ERROR] Line 441: The method requireNonNull(T, String) in the type Objects is not applicable for the arguments (T, () -> {})
         [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
         Unification traversed 50904 fields and methods and 4978 types. 4934 are considered part of the current module and 4934 had all of their fields and methods traversed.
      [ERROR] Compiler returned false
      [WARN] recompile failed
      [WARN] continuing to serve previous version

CodePudding user response:

This error message is the clue to your problem:

[ERROR] Line 1343: Method references are allowed only at source level 1.8 or above

It appears that your Eclipse project is configured for a JDK version earlier than java 8 (1.8), and you are using the method references language feature that require version 8.

CodePudding user response:

You are using GWT 2.7, which doesn't support Java 8 syntax (you need a minimum of GWT 2.8, latest is 2.9.0), but you are using libraries such as gwt-commons-lang3 version 3.12.0-3 which use Java 8 syntax (and possibly libraries).

Either downgrade the libraries you are using, or upgrade to a more recent version of GWT which can handle Java 8 syntax (and libraries).

  • Related