2

我意识到这已经被问了很多,但无法从这些答案中找出问题所在。

我有一个抽象类任务:

package crowdtrust;

public abstract class Task
{

  public enum Type
  {
    BinaryImageClassification;
  };

  public abstract void assignCrowd();
};

一个实施任务:

package crowdtrust;

import java.util.Collection;
import java.util.List;

public class BinaryTask extends Task
{

  private List<SubTask> subtasks;

  public BinaryTask(String name, String question)
  {
    super();
    this.name = name;
    this.question = question;
  }

  public boolean assignSubtask(SubTask s)
  {
      return subtasks.add(s);
  }

  public void assignCrowd()
  {
    //TODO 
  }

};

和子任务类:

package crowdtrust;
public class SubTask {
  //not important
}

这些都在 ct/src/crowdtrust

从 ct 我运行这个 makefile:

CONTEXT   = webapps/ROOT
SRCDIR    = src

CLASSDIR  = $(CONTEXT)/WEB-INF/classes
LIBDIR    = $(CONTEXT)/WEB-INF/lib

JAVAC     = javac

SOURCES   = $(wildcard $(SRCDIR)/crowdtrust/*.java)
CLASSES   = $(SOURCES:.java=.class)

all: install clean

clean:
    rm -f $(CLASSES)

install: $(CLASSES)
    install -m600 $(CLASSES) $(CLASSDIR)/crowdtrust

%.class: %.java
    $(JAVAC) -cp $(LIBDIR) $<

得到这些(加上更多类似的)错误:

javac -cp webapps/ROOT/WEB-INF/lib src/crowdtrust/BinaryTask.java
src/crowdtrust/BinaryTask.java:6: cannot find symbol
symbol: class Task
public class BinaryTask extends Task
                                ^
src/crowdtrust/BinaryTask.java:9: cannot find symbol
symbol  : class SubTask
location: class crowdtrust.BinaryTask
  private List<SubTask> subtasks;
               ^

任何想法是什么导致了错误?

4

1 回答 1

4

我相信它没有正确找到依赖关系并且BinaryTaskTask. 要解决此问题,请在您的 make 文件中将显式依赖项定义为:

  SOURCES = Task.java SubTask.java BinaryTask.java
  BinaryTask.class: Task.class SubTask.class
于 2012-11-14T17:06:12.247 回答