Eclipse question - using class files in a project with out source .java

K

keperry

Our professor gives us .class files to use for our homework because
they contain methods/classes that are needed with the other source
files he provides. The problem is that Eclipse doesn't recognize these
..class files, and makes all my other .java files show errors.

I guess what I mean by doesn't recognize is that if there is a file
that has a class named "NewClass" called NewClass.class and I import
that into my eclipse project, then when I use OtherClass.java and try
to instantiate an NewClass object, then Eclipse doesn't recognize it.

Is there a way to fix this?

Btw - command-line compilation works fine of course, but this doesn't
let me use the power of Eclipse

Thanks,
Keith
 
V

Venkatesh

U should put the directory or jar containing that class file into ur
project library.

These are the steps to set up ur libraries properly in eclipse:
1. Right click on the project name in Package explorer and choose
Properties.
2. In the dialog box that comes up choose Java Build Path
3. Inside java build path, choose the "Libraries" tab and add
directories(Button - Add Class Folders)/jars (Button - Add jars/Add
external jars) etc ...

I'm using Eclipse 3.1.0, but guess the same thing is applicable for all
versions of eclipse

-Venkatesh
 
V

Venkatesh

Hi,

What is ur class file name? Is it inside a package? Where did u place
the class? Also, what path did u add in the "libraries" list.

Guess the correct path is not added, hence u r not finding things
working

-Venkatesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top