Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » importing existing files as a package(import cannot be resolved)
importing existing files as a package [message #698748] Wed, 20 July 2011 07:22 Go to next message
rwclark is currently offline rwclarkFriend
Messages: 2
Registered: July 2011
Junior Member
I have a group of files in an hierarchical file system (com.psf.android....) that is outside of the projects' scope (i.e., in a different branch of the file system).

I've tried "importing" this as a file system for an app package that will use a class from this external file system.

It shows up in the workspace view as an icon of a folder with a blank box in the lower right corner (not as a package). The icon name is com, and it expands to reveal the complete hierarchy with the class files as I would expect.

However, when I try to use the package name in an import statement, I get
"the import com.psf cannot be resolved."

When I try to fully describe a type (com.psf.android.Example) within the code in an instantiation, I get
"cannot be resolved to a type"
Re: importing existing files as a package [message #698979 is a reply to message #698748] Wed, 20 July 2011 15:25 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
You need to make the folder a source folder. Right click on it and under Build Path should be an option to use as source folder.
Re: importing existing files as a package [message #699050 is a reply to message #698979] Wed, 20 July 2011 17:54 Go to previous messageGo to next message
rwclark is currently offline rwclarkFriend
Messages: 2
Registered: July 2011
Junior Member
That didn't solve anything.

Let's wind this back in time. I create a new project. I have a group of files in an hierarchical file system (com.psf.android....) that is outside of the projects' scope (i.e., in a different branch of the file system or even on another drive).

How do I use this group of files as they stand - that is, without cutting and pasting them into the project?
Re: importing existing files as a package [message #699076 is a reply to message #699050] Wed, 20 July 2011 19:18 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
What happens when you make it a source folder? Do you see any errors? Does the folder contain .java files or .class files?

If it contains .java files, then you need to make it a source folder as described. If it contains .class files, you need to add it to the build path as a Class folder on the Build Path/Libraries tab.
Re: importing existing files as a package [message #699281 is a reply to message #699076] Thu, 21 July 2011 09:10 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
If they are java files and you may want to edit them, you could create a new folder linking to the external folder.
Previous Topic:keep Loading web service DOM...(waiting) upgrade to eclipse 3.7
Next Topic:Print JDWP packets trace
Goto Forum:
  


Current Time: Wed Sep 25 18:14:51 GMT 2024

Powered by FUDForum. Page generated in 0.03206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top