views:

223

answers:

3

For a Java class assignment I was given a file named LogReader.class to use. How can I make Eclipse recognize that this compiled class exists so that I can use it? I tried putting it into my src folder but that did not work. I'd rather not go back to compiling with the command line. I do not have access to the source of LogReader.class.

By the way, I'm running Eclipse Galileo.

A: 

The class file would need to be in your classpath, not your source. I'm not sure how this is set up in eclipse (I use netbeans), but I'm guessing the project should have classpath settings you can tweak.

Herms
+3  A: 

Go to project properties, and select java build path. Go to the libraries tab. Add the "class folder" to the build path. Note, you should move the .class file outside of the src folder.

Jay
A: 

You can either copy the .class file to the directory where the .class files of your project are generated, or add it to you classpath by editing the .classpath file in your project root directory

cw22