1

I am getting "java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files" error, after updating the JDK version from 1.6 to jdk 1.8 and when i press ctrl+space in IDE it is not showing any proposed templates(not auto-populating any methods). I have changed the Installed JREs to point to 1.8 (windows->prefrences->java->Installed JREs),included JDK 1.8 in the buildpath, Java Compiler or Compliance level is still 1.6(windows->prefrences->java->Compiler), which is the max compilance level shows in my IDE.

What is causing the issue? Can anyone help me how to resolve this problem?

IDE - Eclipse Galileo

DB - Oracle 11.2

JDK - 1.8

Compiler - 1.6

Thanks in advance !

yoganandh
  • 247
  • 1
  • 6
  • 20
  • 2
    Update the compiler? – OneCricketeer Feb 13 '17 at 14:44
  • I think you are doing development,So you should include JDK in your buildpath not JRE @yoganandh – Darshit Feb 13 '17 at 14:45
  • @cricket_007 I have no clue how to update compiler. can you help me how to update the compiler? – yoganandh Feb 13 '17 at 14:53
  • @Darshit Ya I have included JDK only in my buildpath – yoganandh Feb 13 '17 at 14:54
  • Change compiler in window > preference > project facets. Change java version to 1.8 and restart workbench. – Darshit Feb 13 '17 at 14:57
  • @Darshit As i alredy mentioned in my question my IDE shows compilance level only upto 1.6 – yoganandh Feb 13 '17 at 15:00
  • Eclipse Galileo (3.5) is ancient, if you actually want to use the new Java 8 features such as lambda expressions you will have to move to a much newer release of Eclipse (Neon 4.6.2 is the current release). – greg-449 Feb 13 '17 at 15:03
  • @greg-449 Thanks! I'll try updating eclipse but Is there a way to solve this without upgrading eclipse? because the project was completly developed usuing 1.6 and we just need to check whether the application runs without errors. – yoganandh Feb 13 '17 at 15:11
  • No, there is no way around upgrading your IDE. The answer of the linked question explains why. – Holger Feb 13 '17 at 17:01

2 Answers2

0

The compatibility mode of JAVA compilations for previous versions, when you're using newer versions is not perfect, i had different issues with that in the past. If you have a project compiled in 1.6 use JDK 1.6 instead of compatibility mode. In eclipse is easy to configure different JDK for different projects.

langeles86
  • 162
  • 1
  • 12
  • I have already tried with 1.6 it is working. but now I am supposed to update JDK from 1.6 to 1.8 that is the task given for me. Can you give any solution for this problem? – yoganandh Feb 13 '17 at 14:58
  • I am using JDK only. I have updated in my question thanks. – yoganandh Feb 13 '17 at 15:04
  • Read these thread(http://stackoverflow.com/questions/24301986/the-type-java-lang-charsequence-cannot-be-resolved-in-package-declaration) May be duplicated question. Resuming: "Java 8 supports default methods in interfaces. And in JDK 8 a lot of old interfaces now have new default methods. ...." – langeles86 Feb 13 '17 at 15:07
0

Make sure there is no reference to old JDK version in the eclipse.ini, and JAVA_HOME environment variable points to the latest version of JDK

kyserslick
  • 591
  • 1
  • 10
  • 27