dasen
dasen

Reputation: 15

How do I add an existing .class to an existing eclipse project?

how do I add an existing class into an existing project. I've got the file "Something.class" and in the code I do a

something window = new Something();

But it remains underlined in red. Does someone know how do I fix this?

Thanks!!

Upvotes: 0

Views: 7824

Answers (4)

Mario
Mario

Reputation: 11

Also note, that Java is case sensitive. So in

something window = new Something();

something and Something are two different classes :)

Upvotes: 1

fastcodejava
fastcodejava

Reputation: 41117

You need to add the jar file that has the class something to your project and import it your class.

Upvotes: 0

Quinn Bailey
Quinn Bailey

Reputation: 200

If it's not already part of your workspace, it should be enough just to File -> Import and then find the class you want included. If it's already part of the workspace, then Tommi's suggestion should do it.

Upvotes: 1

Tommi
Tommi

Reputation: 8608

You need to import the class into the referencing class. Ctrl + Space (while highlighting the classname) should do the trick in Eclipse.

Upvotes: 0

Related Questions