Java类未找到异常,但它在同一个src文件夹中 [英] Java Class Not Found Exception but its in the same src folder

查看:217
本文介绍了Java类未找到异常,但它在同一个src文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码就像

ArrayList<someClassIMade> c=new ArrayList<someClassIMade>();
c.add(new someClassIMade(blah,blah))

添加行我得到一个类未找到异常! someClassIMade类在与主类相同的src文件夹中,所以我很困惑。我从字面上做这个所有的freakin时间为什么它不工作突然?我检查了我的运行配置和是的src文件夹是有。程序运行和所有,我只看到异常,当我去调试,看看为什么添加行不工作,瞧,类未找到。

But for some reason in the add line I get a class not found exception! The someClassIMade class is in the same src folder as the main class so I'm baffled. I literally do this all the freakin time why is it not working all of a sudden? I checked my run configuration and yes the src folder is there. The program runs and all, I only see the exception when I went to debug to see why the add line wasn't working and voila class not found. I'm rambling, help?

编辑:
更多代码使这个更清晰
这里是someClassIMade

More code to make this a little clearer Here is the someClassIMade

public tuples{
    private int start;
private int end;
private int[] tuple=new int[2];
public int getStart() {
    return start;
}
public void setStart(int start) {
    this.start = start;
}
public int getEnd() {
    return end;
}
public void setEnd(int end) {
    this.end = end;
}
public int[] getTuple() {
    return tuple;
}
public void setTuple(int[] tuple) {
    this.tuple = tuple;
}
public tuples(int start,int end){
    this.start=start;
    this.end=end;
    tuple[0]=start;tuple[1]=end;

}

}
它第一次当它显示在类中我试图使用它,这是错误发生的地方。他们都在(默认包),我只使用Java本机库。希望清除的东西

} and the code I posted earlier is the first time when it shows up in the class I'm trying to use it in and that's where the error occurs. They are both in the (default package) and I am using only Java native libraries. Hope that clears things up

推荐答案

正在使用eclipse吗?如果是,请执行一个项目清洁,并自动选择生成。我认为这些类没有生成。

Are using eclipse? If yes, please do a project clean and select build automatically. I think the classes are not getting build.

这篇关于Java类未找到异常,但它在同一个src文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆