当前位置: 技术问答>java相关
cannot resolve symbol错误!急!
来源: 互联网 发布时间:2015-11-20
本文导语: 用JCreator编译java代码时,出现cannot resolve symbol错误,代码如下: package pj.cwt.database; import java.sql.*; public class DBConnect { private Connection conn; private Statement stmt; private PreparedStatement prepstmt; ...
用JCreator编译java代码时,出现cannot resolve symbol错误,代码如下:
package pj.cwt.database;
import java.sql.*;
public class DBConnect
{
private Connection conn;
private Statement stmt;
private PreparedStatement prepstmt;
private DBConnectionManager dcm;
...
...
...
错误信息:
D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabaseDBConnect.java:15: cannot resolve symbol
symbol : class DBConnectionManager
location: class pj.cwt.database.DBConnect
private DBConnectionManager dcm;
^
是不是CLASSPATH设置错误?
我的CLASSPATH=d:j2sdk1.4.0libtools.jar;d:tomcatjakarta-tomcat-3.3.1classes;d:tomcatjakarta-tomcat-3.3.1lib;D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabase
请问该如何解决?
package pj.cwt.database;
import java.sql.*;
public class DBConnect
{
private Connection conn;
private Statement stmt;
private PreparedStatement prepstmt;
private DBConnectionManager dcm;
...
...
...
错误信息:
D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabaseDBConnect.java:15: cannot resolve symbol
symbol : class DBConnectionManager
location: class pj.cwt.database.DBConnect
private DBConnectionManager dcm;
^
是不是CLASSPATH设置错误?
我的CLASSPATH=d:j2sdk1.4.0libtools.jar;d:tomcatjakarta-tomcat-3.3.1classes;d:tomcatjakarta-tomcat-3.3.1lib;D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabase
请问该如何解决?
|
不一定绝对,但至少,你的classpath是不正确的.
加个 .
----------
CLASSPATH=.;d:j2sdk1.4.0libtools.jar;d:tomcatjakarta-tomcat-3.3.1classes;d:tomcatjakarta-tomcat-3.3.1lib;D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabase
加个 .
----------
CLASSPATH=.;d:j2sdk1.4.0libtools.jar;d:tomcatjakarta-tomcat-3.3.1classes;d:tomcatjakarta-tomcat-3.3.1lib;D:tomcatjakarta-tomcat-3.3.1webappsROOTWEB-INFclassespjcwtdatabase
|
引用方法的文件名与方法定义不符吧,检查一下方法是不是没加"()"
|
加一句:
import pj.cwt.database.*;
吧!
import pj.cwt.database.*;
吧!