File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse Problem, Incorporate existing .class into project

 
Chris Hericks
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 75
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic