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!!
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.
Also note, that Java is case sensitive. So in
something window = new Something();
something and Something are two different classes :)
You need to import the class into the referencing class. Ctrl + Space (while highlighting the classname) should do the trick in Eclipse.
You need to add the jar file that has the class something
to your project and import it your class.
精彩评论