Menu

#944 java.lang.CharSequence cannot be resolved

4: Serious
open
nobody
None
9
2014-08-19
2014-01-28
No

When I compile this code:

StringBuilder sb = new StringBuilder();
sb.append("a");

I get this error:
Error: The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.

Does anyone know how to fix it?

Related

Bugs: #944

Discussion

  • RastaBillySkank

    RastaBillySkank - 2014-01-28

    And, I use Eclipse compiler A0.48, becouse JDK 8.0 compiler don't want to compile.

     
    • Robert Cartwright

      The error message is generated by the Eclipse compiler for reasons I do not
      understand. I recommend downloading either a Java 6 or Java 7 JDK. I
      defined the following class

      class Sample {
      public String foo;
      public Sample() {
      StringBuilder sb = new StringBuilder();
      sb.append("a");
      foo = sb.toString();
      }
      }

      I successfully compiled this class (and created an instance in the DrJava
      interactions pane) using compiler in Java 7, Java 6, and Java 5.
      Compilation with Java 8 failed because DrJava passes the argument -target
      "1.7" to the compiler which is not compatible with the Java 8 compiler
      processing Java 8 source code. I will fix this problem, but I defer
      addressing the strange behavior of the Eclipse compiler. The error is
      either a problem in the Eclipse compiler or a library compatibility issue
      that is best solved by bunding a different open source compiler with
      DrJava Almost noone uses the Eclipse compiler; we included it in DrJava to
      enable users to run Drjava using a JRE installation (which has no Java
      compiler). The inclusion predates the open-JDK versions of Java, so we
      should replace the Eclipse compiler by an open-JDK compiler. I will
      eventually make this change.

      Best,

      Corky Cartwright

      On Tue, Jan 28, 2014 at 1:29 PM, RastaBillySkank rastabillyskank@users.sf.net wrote:

      And, I use Eclipse compiler A0.48, becouse JDK 8.0 compiler don't want to
      compile.


      Status: open
      Created: Tue Jan 28, 2014 07:23 PM UTC by RastaBillySkank
      Last Updated: Tue Jan 28, 2014 07:24 PM UTC
      Owner: nobody

      When I compile this code:

      StringBuilder sb = new StringBuilder();
      sb.append("a");

      I get this error:
      Error: The type java.lang.CharSequence cannot be resolved. It is
      indirectly referenced from required .class files.

      Does anyone know how to fix it?

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/drjava/bugs/944/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #944

  • Stephen Gilbert

    Stephen Gilbert - 2014-06-25

    Hello Mr. Cartwright,

    I just encountered this problem with some students who ran your updated (Java 8)
    version of DrJava (from the Rice page) without the JDK, but using JRE 8. If they have the JDK, it doesn't cause a problem. The bug is in the eclipse compiler. I was able to fix it by just downloading the latest (Luna) eclipse core batch compiler (ecj-4.4.jar) from the Eclipse downloads page: http://download.eclipse.org/eclipse/downloads/drops4/R-4.4-201406061215/

    I was then able to update the DrJava.jar by opening it in 7Zip, deleting the eclipse folder inside org, and dragging and dropping the eclipse folder from inside ecj-4.4.jar. Once I did that, your test program shown compiled and ran with all 4 compilers (6, 7, 8, ecj) even when using the Java 8 runtime.

    --Steve

     

Log in to post a comment.