java - Error: Access restriction: The type 'DataSource' is not API (restriction on required library ..\rt.jar) -


i'm trying understand how work spring jdbc framework.

i've found example on http://www.tutorialspoint.com/spring/spring_jdbc_example.htm , trying implement in own project.

this example

package test;  import javax.sql.datasource; import org.springframework.jdbc.core.jdbctemplate;  public class testjdbctemplate {        private datasource datasource;        private jdbctemplate jdbctemplateobject;         public void setdatasource(datasource datasource) {           this.datasource = datasource;           this.jdbctemplateobject = new jdbctemplate(datasource);        }  } 

but got problem with

import javax.sql.datasource 

access restriction: type 'datasource' not api (restriction on required library 'c:\program files (x86)\java\jre1.8.0_31\lib\rt.jar')

what's wrong import , how fix it. kind of import i've seen in examples spring jdbc framework.

go build path settings of project in eclipse. remove jre system library. add again. should resolve error.