找到由Eclipse编译的.class文件 [英] Find the .class file compiled by Eclipse

查看:223
本文介绍了找到由Eclipse编译的.class文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

我应该如何编译一个类?如何将它放入类文件(我创建的)? Eclipse只是在运行时自动编译所有的类?

How am I supposed to compile just one class? How do I put it INTO the class file (which I've created)? Doesn't Eclipse just automatically compile all the classes at runtime?

后面的故事

我正在关注教程,它告诉我: / p>

I'm following a tutorial and it tells me to:


将编译的类放入WEB-INF / classes。

Put the compiled class into WEB-INF/classes.

课程在哪里:

package org.odata4j.tomcat;
import java.util.Properties;
import org.core4j.Enumerable;
import org.core4j.Func;
import org.core4j.Funcs;
import org.odata4j.producer.ODataProducer;
import org.odata4j.producer.ODataProducerFactory;
import org.odata4j.producer.inmemory.InMemoryProducer;

public class ExampleProducerFactory implements ODataProducerFactory {

  @Override
  public ODataProducer create(Properties properties) {
    InMemoryProducer producer = new InMemoryProducer("example");

    // expose this jvm's thread information (Thread instances) as an entity-set called "Threads"
producer.register(Thread.class, Long.class, "Threads", new Func<Iterable<Thread>>() {
  public Iterable<Thread> apply() {
    ThreadGroup tg = Thread.currentThread().getThreadGroup();
    while (tg.getParent() != null)
      tg = tg.getParent();
    Thread[] threads = new Thread[1000];
    int count = tg.enumerate(threads, true);
    return Enumerable.create(threads).take(count);
  }
}, Funcs.method(Thread.class, Long.class, "getId"));

return producer;
  }
 }


推荐答案

您保存 .java 文件,如果没有编译器错误,Eclipse将将其编译为 .class 文件。您通常可以在项目的 bin 子目录中找到该文件。特别是,它将在 bin / org / odata4j / tomcat 中,因为您已将您的类声明为属于 org.odata4j.tomcat 包。随时随地将此文件复制到任何地方。

When you save your .java file, Eclipse will compile it into a .class file if there are not compiler errors. You can usually find this file in the bin subdirectory of your project. In particular, it will be in bin/org/odata4j/tomcat because you have declared your class to belong to the org.odata4j.tomcat package. Feel free to copy this file anywhere you wish.

这篇关于找到由Eclipse编译的.class文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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