Eclipse Problem, Incorporate existing .class into project
posted 2 years ago
Hello! I am being given several .class files to work with on a coding project for school. I am attempting to integrate them into my eclipse project but am having some trouble, even after looking at other topics online.
Here is my attempted solution:
- Folder("graph", classes in here)
I right clicked on the project > properties > Java build path > Libraries Tab > Add Class Folder
Select the "graph" folder in the existing project, and the folder showed up on the list
In the code for "main", attempted:
But the path is not recognized. Is there an error in my process, or in my import call?
It's perfect what you did so far.
My doubt is that the classes you're trying to use have a different package declaration, other than "graph".
Since you're using Eclipse, try removing the import you wrote in your main class. Then, inside one of your method's body, write the name of a class you're trying to use. Next, press Ctrl+Space immediately after the class name you just wrote and Eclipse will automatically add the import for you.
As an alternative, instead of Ctrl+Space you can also try Ctrl+Shift+O (Organize imports) and the outcome should be the same.