Netbeans指责不存在的错误(我猜)

时间:2013-07-02 01:56:06

标签: java jsp web

我是Java世界的新手,我遇到了ArrayList的问题:

这是我的代码:

package ontologia;

import br.ufal.ic.joint.RepositoryFacade;
import br.ufal.ic.joint.module.ontology.operations.OntologyCompiler;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Mauricio
 */
public class NewClass {

    // Caminho do arquivo jar que será gerado
    String ontologyPath = "C:/family.jar";
    // URL da ontologia que deseja ser compilada
    String ontologyURL = "file:///C:/bbcOntology.owl";
    List<String> lista = new ArrayList<String>();

    lista.add(ontologyURL);
    // Chama a fachada do JOINT
    RepositoryFacade fachada = new RepositoryFacade();
    OntologyCompiler compiler = fachada.getOntologyCompiler(ontologyPath, lista); // Gerador do JOINT
    compiler.compile(); // Compila a ontologia em classes Java
}

我在Netbeans上编程并且在lista.add(ontologyURL);

上指责错误

我做错了吗?

截图

enter image description here

1 个答案:

答案 0 :(得分:1)

代码(逻辑语句)应该在某个方法内部,而不是直接在类中。

public class NewClass {
  public void someMethod()
   {
    //Here your code goes.
   }

}