简体   繁体   中英

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.

您需要添加具有类的jar文件something到你的项目,并导入你的类。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM