【问题标题】:I'm trying to compile my java project in command prompt and it's giving me these errors我正在尝试在命令提示符下编译我的 java 项目,它给了我这些错误
【发布时间】:2017-03-01 10:41:44
【问题描述】:

these are the errors

从这一点开始,我得到了错误

public ArrayList<DatabasePayroll> getDbPList() {
    ArrayList<DatabasePayroll> dbPList = new ArrayList<DatabasePayroll>();
    Connection connection = getConnection();

    String query = "SELECT * FROM `salary sheet`";
    Statement st;
    ResultSet rs;

    try {
        st = connection.createStatement();
        rs = st.executeQuery(query);
        DatabasePayroll databasePayroll;
        while (rs.next()) {
            databasePayroll = new DatabasePayroll(rs.getInt("Num"), rs.getString("Name"), rs.getDate("LastPaymentDate"), rs.getString("Site"), rs.getString("Designation"), rs.getFloat("SalaryBalance"), rs.getFloat("PerDay"), rs.getFloat("Days"), rs.getFloat("Salary"), rs.getFloat("OTHours"), rs.getFloat("OTRate"), rs.getDouble("OT"), rs.getFloat("Allowance"), rs.getDouble("GrossSalary"), rs.getFloat("Advance"), rs.getFloat("Loan"), rs.getDouble("NetSalary"), rs.getDouble("RequestedAmount"), rs.getString("Status"));
            dbPList.add(databasePayroll);
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return dbPList;
}

我正在使用 import java.util.ArrayList;包。

【问题讨论】:

  • 请将其简化为minimal reproducible example 并在问题中包含错误。 (我怀疑问题在于您只编译了部分代码并期望编译器找到其他类,但没有从包根目录编译...)

标签: java command-prompt


【解决方案1】:

看起来像是编译问题。确保您的 DatabasePayroll 类已正确导入。如果它来自外部 jar,则将该 jar 添加到构建路径中。最好使用像 eclipse 这样的 java IDE,它可以简化编译、调试等等。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    • 2015-08-21
    • 2022-12-21
    • 2015-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多