This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse Problem, Incorporate existing .class into project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse Problem, Incorporate existing .class into project" Watch "Eclipse Problem, Incorporate existing .class into project" New topic

Eclipse Problem, Incorporate existing .class into project

Chris Hericks

Joined: Oct 26, 2012
Posts: 12
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:
Project Layout:
- Folder("graph", classes in here)
- Folder("src")
-- Pkg("project4")
--- Class("main")

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?
Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

Hi Chris,

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.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Eclipse Problem, Incorporate existing .class into project
It's not a secret anymore!