*
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
Author

Eclipse Problem, Incorporate existing .class into project

Chris Hericks
Greenhorn

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:
Project
- 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.

Cheers,
Claudiu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse Problem, Incorporate existing .class into project
 
Similar Threads
using jar files
Error : class not found exception : com.mysql.jdbc.driver in eclipse Tool
import the java project using ANT in eclipse
Problem in config. JPA in JBOSS
Can't Build imported classes