关于javabean编译老提示"找不到符号"的问题,我都快疯了
以下是原文件:
1、PigeonBean.java
package pigeon;
import java.sql.*;
import pigeon.pigeonInfos;
public class PigeonBean
{
private static String strDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver ";
private static String strDBUrl = "jdbc:odbc:pigeon_db ";
private Connection conn =null;
private ResultSet rs = null;
public PigeonBean()
{
try
{
Class.forName(strDBDriver);
conn = DriverManager.getConnection(strDBUrl);
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
}
public ResultSet getPigeonInfo()
{
String strSql = null;
try
{
Statement stmt = conn.createStatement();
strSql = "Select * from pigeon_info ";
rs = stmt.executeQuery(strSql);
}
catch(SQLException e)
{
System.err.println(e.getMessage());
}
return rs;
}
public void addPigeonInfo(PigeonInfos pigeonInfos)
{
String strSql = null;
try
{
strSql = "insert into pigeon_info values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
PreparedStatement pstmt = conn.prepareStatment(strSql);
pstmt.setString (1,pigeonInfos.getXieHui());
pstmt.setString (2,pigeonInfos.getNianFen());
pstmt.setString (3,pigeonInfos.getDiQu());
pstmt.setString (4,pigeonInfos.getHuanHao());
pstmt.setString (5,pigeonInfos.getYuSe());
pstmt.setString (6,pigeonInfos.getYanSa());
pstmt.setString (7,pigeonInfos.getXingBie());
pstmt.setString (8,pigeonInfos.getChuShengRi());
pstmt.setString (9,pigeonInfos.getXueTong());
pstmt.setString (10,pigeonInfos.getZhuangTai());
pstmt.setString (11,pigeonInfos.getZuoYuZhe());
pstmt.setString (12,pigeonInfos.getDangQyZ());
pstmt.setString (13,pigeonInfos.getFuGexx());
pstmt.setString (14,pigeonInfos.getMuGexx());
pstmt.setString (15,pigeonInfos.getZhaoPian());
pstmt.setString (16,pigeonInfos.getBeiZhu());
pstmt.executeUpdate();
}
catch (ClassNotFoundException e)
{
System.out.println();
}
}
}
2、PigeonInfos.java
package pigeon;
import java.sql.*;
public class PigeonInfos
{
private String xieHui;
private String nianFen;
private String diQu;
private String huanHao;
private String yuSe;
private String yanSa;
private String xingBie;
private Date chuShengRi;
private String xueTong;
private String zhuangTai;
private String zuoYuZhe;
private String dangQyZ;
private String fuGexx;
private String muGexx;
private String zhaoPian;
private String beiZhu;
public String getXieHui()
{
return xieHui;
}
public void setXieHui(String xieHui)
{
this.xieHui = xieHui;
}
public String getNianFen()
{
return nianFen;
}
public void setNianFen(String nianFen)
{
this.nianFen = nianFen;
}
public String getDiQu()
{
return diQu;
}
public void setDiQu(String diQu)
{
this.diQu = diQu;
}
public String getHuanHao()
{
return huanHao;
}
public void setHuanHao(String huanHao)
{
this.huanHao = huanHao;
}
public String getYuSe()
{
return yuSe;
}
public void setYuSe(String yuSe)
{
this.yuSe = yuSe;
}
public String getYanSa()
{
return yanSa;
}
public void setYanSa(String yanSa)
{
this.yanSa = yanSa;
}
public String getXingBie()
{
return xingBie;
}
public void setXingBie(String xingBie)
{
this.xingBie = xingBie;
}
public Date getChuShengRi()
{
return chuShengRi;
}
public void setChuSengRi(Date chuShengRi)
{
this.chuShengRi = chuShengRi;
}
public String getXueTong()
{
return xueTong;
}
public void setXueTong(String xueTong)
{
this.xueTong = xueTong;
}
public String getZhuangTai()
{
return zhuangTai;
}
public void setZhuangTai(String zhuangTai)
{
this.zhuangTai = zhuangTai;
}
public String getZuoYuZhe()
{
return zuoYuZhe;
}
public void setZuoYuZhe(String zuoYuZhe)
{
this.zuoYuZhe = zuoYuZhe;
}
public String getDangQyZ()
{
return dangQyZ;
}
public void setDangQyZ(String dangQyZ)
{
this.dangQyZ = dangQyZ;
}
public String getFuGexx()
{
return fuGexx;
}
public void setFuGexx(String fuGexx)
{
this.fuGexx = fuGexx;
}
public String getMuGexx()
{
return muGexx;
}
public void setMuGexx(String muGexx)
{
this.muGexx = muGexx;
}
public String getZhaoPian()
{
return zhaoPian;
}
public void setZhaoPian(String zhaoPian)
{
this.zhaoPian = zhaoPian;
}
public String getBeiZhu()
{
return beiZhu;
}
public void setBeiZhu(String beiZhu)
{
this.beiZhu = beiZhu;
}
}
两个文件都在同一个目录下,PigeonInfos.java编译没有问题,可是PigeonBean.java编译就出现下面的问题:
C:\Tomcat 5.0\webapps\pigeon\WEB-INF\classes\pigeon> javac PigeonBean.java
PigeonBean.java:3: 找不到符号
符号: 类 pigeonInfos
位置: 软件包 pigeon
import pigeon.pigeonInfos;
^
PigeonBean.java:37: 找不到符号
符号: 类 PigeonInfos
位置: 类 pigeon.PigeonBean
public void addPigeonInfo(PigeonInfos pigeonInfos)
^
PigeonBean.java:43: 找不到符号
符号: 方法 prepareStatment(java.lang.String)
位置: 接口 java.sql.Connection
PreparedStatement pstmt = conn.prepareStatment(strSql);
^
3 错误
classpath如下:
.;D:\Java\jdk1.5.0_03\lib\dt.jar;D:\Java\jdk1.5.0_03\lib\tools.jar;
[解决办法]
import pigeon.pigeonInfos; 改成 import pigeon.PigeonInfos;
[解决办法]
手写?
用的什么ide呀?
[解决办法]
应该是Eclipse
[解决办法]
改成import pigeon.PigeonInfos;
还是一样一没有用
[解决办法]
智商问题,鉴定完毕~