在弄一个工程,可是.java文件不能导出想要的.class文件,下面是某一个没成型的.class文件,刚学对项目和myeclipse都不熟,希望大家给指点指点。
// Compiled from ShipManManager.java (version 1.6 : 50.0, no super bit)
public abstract interface manager.ShipManManager {
// Method descriptor #6 ()V
// Stack: 3, Locals: 0
static {};
0 new java.lang.Error [8]
3 dup
4 ldc <String "Unresolved compilation problems: \n\tThe declared package "rc.fisher.manager" does not match the expected package "manager"\n\tThe import rc cannot be resolved\n\tThe import rc cannot be resolved\n\tThe import rc cannot be resolved\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipManQueryInfo cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipManQueryInfo cannot be resolved to a type\n\tUser cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n"> [10]
6 invokespecial java.lang.Error(java.lang.String) [12]
9 athrow
Line numbers:
[pc: 0, line: 1]
// Method descriptor #19 (Ljava/lang/String;)LShipMan;
public abstract ShipMan findShipManOracle(java.lang.String arg0);
// Method descriptor #21 (LShipManQueryInfo;)Ljava/util/List;
public abstract java.util.List searchShipMansOracle(ShipManQueryInfo arg0);
// Method descriptor #19 (Ljava/lang/String;)LShipMan;
public abstract ShipMan findShipMan(java.lang.String arg0);
// Method descriptor #24 (LShipManQueryInfo;Ljava/lang/Integer;Ljava/lang/Integer;LUser;)Ljava/util/List;
public abstract java.util.List searchShipMans(ShipManQueryInfo arg0, java.lang.Integer arg1, java.lang.Integer arg2, User arg3);
// Method descriptor #26 (Ljava/lang/String;)Ljava/util/List;
public abstract java.util.List findShipManById(java.lang.String arg0);
// Method descriptor #28 (LShipMan;)V
public abstract void addShipMan(ShipMan arg0);
// Method descriptor #15 (Ljava/lang/String;)V
public abstract void delShipMan(java.lang.String arg0);
// Method descriptor #28 (LShipMan;)V
public abstract void updateShipMan(ShipMan arg0);}myeclipseclass
// Compiled from ShipManManager.java (version 1.6 : 50.0, no super bit)
public abstract interface manager.ShipManManager {
// Method descriptor #6 ()V
// Stack: 3, Locals: 0
static {};
0 new java.lang.Error [8]
3 dup
4 ldc <String "Unresolved compilation problems: \n\tThe declared package "rc.fisher.manager" does not match the expected package "manager"\n\tThe import rc cannot be resolved\n\tThe import rc cannot be resolved\n\tThe import rc cannot be resolved\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipManQueryInfo cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipManQueryInfo cannot be resolved to a type\n\tUser cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n\tShipMan cannot be resolved to a type\n"> [10]
6 invokespecial java.lang.Error(java.lang.String) [12]
9 athrow
Line numbers:
[pc: 0, line: 1]
// Method descriptor #19 (Ljava/lang/String;)LShipMan;
public abstract ShipMan findShipManOracle(java.lang.String arg0);
// Method descriptor #21 (LShipManQueryInfo;)Ljava/util/List;
public abstract java.util.List searchShipMansOracle(ShipManQueryInfo arg0);
// Method descriptor #19 (Ljava/lang/String;)LShipMan;
public abstract ShipMan findShipMan(java.lang.String arg0);
// Method descriptor #24 (LShipManQueryInfo;Ljava/lang/Integer;Ljava/lang/Integer;LUser;)Ljava/util/List;
public abstract java.util.List searchShipMans(ShipManQueryInfo arg0, java.lang.Integer arg1, java.lang.Integer arg2, User arg3);
// Method descriptor #26 (Ljava/lang/String;)Ljava/util/List;
public abstract java.util.List findShipManById(java.lang.String arg0);
// Method descriptor #28 (LShipMan;)V
public abstract void addShipMan(ShipMan arg0);
// Method descriptor #15 (Ljava/lang/String;)V
public abstract void delShipMan(java.lang.String arg0);
// Method descriptor #28 (LShipMan;)V
public abstract void updateShipMan(ShipMan arg0);}myeclipseclass
Eclipse编译的类,会放到特定目录下的(java普通工程,编译后的class文件默认放到bin目录下;web工程,编译后的class放到WebRoot\WEB-INF\classes)。还找不到?那就在工程目录下,找到.classpath文件,里面的内容打开看看,一般格式这样的(我这个是Web工程):<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="lib" path="libs/junit-4.10.jar"/>
<classpathentry kind="lib" path="libs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="conf/log4j.properties"/>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
第二,右键->source->clean up
第三,如果红色还没消失,点击进入多个java文件(随机),看看Java文件里面是否出现红色错误。
第四,你的这句话“可是.java文件不能导出想要的.class文件”,改成
“可是.java文件不能编译想要的.class文件”更合适,刚开始我还以为你要导出工程呢,看完才明白是导入了工程不能运行是吧?