我在使用javac时遇到问题。我没有收到错误消息,但是我 没有实现类的构建。这是简化版本。
我还有其他类,但是问题似乎出在实现类上。 请注意,我的界面和类都在同一目录中。
我的设置如下 C:\ work \ programming \ java \ lights \ src \ lights 我有2个.java文件light.java和desklight.java
这里不是这个问题 javac not displaying compiler errors?
这里不是这个问题 Interface Implementation error : cannot find symbol
这里不是这个问题 Compiling java with classpath doesn't find all jar files
/**
* light.java file
*/
package lights;
/**
* @author me
*
*/
public interface light
{
void Switch(boolean onoff);
void Bulb();
}
/**
* desklight.java file
*/
package lights;
import lights.light;
/**
* @author me
*
*/
public class desklight implements light
{
boolean on; // is the light on?
boolean working;
public void Switch(boolean onoff)
{//anybody home?
on = onoff;
}
//@Override
//public void Bulb()
//{// if it is on it should be working
// working = on;
//}
}
NB:将Bulb方法注释掉以测试错误消息。 如果我运行javac,我会得到。
C:\ work \ programming \ java \ lights \ src \ lights> javac * .java desklight.java:10:错误:desklight不是抽象的,并且不会在光照中覆盖抽象方法Bulb() 公共课桌灯实施照明 ^ 1个错误
没有创建.class文件,但实际上收到错误消息。
如果我使用源和目标运行javac,例如: C:\ work \ programming \ java \ lights \ src \ lights> javac -sourcepath C:\ work \ programming \ java \ lights \ src \ lights * .java -d C:\ work \ programming \ java \ lights \ bin \
我没有错误,在bin文件夹中没有light.class文件。
我想念什么?
PS,这是详细输出。 C:\ work \ programming \ java \ lights \ src \ lights> javac -verbose -sourcepath C:\ work \ programming \ java \ lights \ src \ lights * .java -d C:\ work \ programming \ java \ lights \ bin \ [解析启动的RegularFileObject [C:\ work \ programming \ java \ lights \ src \ lights \ light.java]] [解析完成21ms] [源文件的搜索路径:] [类文件的搜索路径:C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ resources.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ rt.jar,C :\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ sunrsasign.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ jsse.jar,C:\ Program Files \ Java \ jdk1 .8.0_144 \ jre \ lib \ jce.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ charsets.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ jfr.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ classes,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ access-bridge-64.jar,C: \ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ cldrdata.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ dnsns.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ jaccess.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ jfxrt.jar,C:\ Program Files \ Java \ jdk1。 8.0_144 \ jre \ lib \ ext \ localedata.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ nashorn.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ sunec.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ sunjce_provider.jar,C: \ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ sunmscapi.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ sunpkcs11.jar,C:\ Program Files \ Java \ jdk1.8.0_144 \ jre \ lib \ ext \ zipfs.jar,。,C:\ Program Files(x86)\ QuickTime \ QTSystem \ QTJava.zip] [加载ZipFileIndexFileObject [C:\ Program Files \ Java \ jdk1.8.0_144 \ lib \ ct.sym(META-INF / sym / rt.jar / java / lang / Object.class)]] [检查lights.light] [加载ZipFileIndexFileObject [C:\ Program Files \ Java \ jdk1.8.0_144 \ lib \ ct.sym(META-INF / sym / rt.jar / java / io / Serializable.class)]] [加载ZipFileIndexFileObject [C:\ Program Files \ Java \ jdk1.8.0_144 \ lib \ ct.sym(META-INF / sym / rt.jar / java / lang / AutoCloseable.class)]] [编写RegularFileObject [C:\ work \ programming \ java \ lights \ bin \ lights \ light.class]] [总计229ms]
C:\ work \ programming \ java \ lights \ src \ lights>