eclipse - java.lang.CharSequence cannot be resolved when using drawString -


public void drawcities(arraylist<city> cities, graphics page) {     for(int i=0; i<10; i++)     {         int dim[]=cities.get(i).getlocation();         string name= cities.get(i).getname();         int x= dim[0]*2;         int y=dim[1]*2;         page.fillrect(x, y, 5, 5);         page.drawstring(name, x, y);     } }     

in eclipse, when trying compile code error, stating

exception in thread "main" java.lang.error: unresolved compilation problem: type java.lang.charsequence cannot resolved. indirectly referenced required .class files  @ travelpanel.<init>(travelpanel.java:26) @ travelgui.<init>(travelgui.java:22) @ travelgui.main(travelgui.java:39) 

the error pointing @ drawstring line. using jre 8

it can occur because of java 8 unsupported version of eclipse. version of eclipse using. here's java 8 compatibility details eclipse https://www.eclipse.org/downloads/index-java8.php

if jvm cannot recognize appropriate java version many weird behaviour may occur. so-

  1. make sure using compatible version of eclipse
  2. make sure have set jdk path correctly in project (you may want check again)
  3. clean , rebuild project

this should work.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -