0

At the moment I've got all my classes in the com.example.myfirstapp package, which is fine. But I'd like to add folders within this package. For example, I'd like to move MyData.java so that it's in com.example.myfirstapp/MyDataClasses - if that makes sense.

I've looked at some other Stackoverflow articles about this, and it seems like people have a lot of horror stories about doing something which seems so simple.

What is the correct way to do this? I assume I'd need to let Eclipse refactor some stuff to recognise the new folder, but I'm not really sure how to go about doing this. Coming from a Visual Studio background, it seems Eclipse handles this in a completely different way...

Any comments appreciated, thanks.

b85411
  • 9,420
  • 15
  • 65
  • 119
  • "Folders" are generally converted in packages. That means that code inside com.example.myfirstapp/MyDataClasses will become com.example.myfirstapp.MyDataClasses... is that what you want? – luanjot Oct 16 '13 at 07:46
  • This makes no sense. You are mixing packages with folders. Do you want to add a new source folder or do you want to add a package? – mithrandir Oct 16 '13 at 07:47
  • is this what you want http://stackoverflow.com/questions/8025371/adding-folder-in-eclipse-in-src-directory-without-making-it-package – Shrikant Oct 16 '13 at 07:49
  • I'm new to the Android way of doing things, so please tell me if I'm wrong. In a Visual Studio solution, I'd have a project and in that project I'd have folders. So say I had MyProj, I may have a Helper folder within it to put my helper classes in. Isn't a project analogous to a "package"? – b85411 Oct 16 '13 at 07:49

1 Answers1

1

You can get more info on creating packages here:

Eclipse Java project folder organization

http://www.tutorialspoint.com/eclipse/eclipse_create_java_package.htm

http://www.vogella.com/articles/Eclipse/article.html

Community
  • 1
  • 1
Goofy
  • 6,098
  • 17
  • 90
  • 156
  • Thanks for your response. In practice, what is the difference between my creating a new folder in com.example.myfirstapp and creating a new package in com.example.myfirstapp. Eclipse let's me do both, when should I or shouldn't I use one or the other? – b85411 Oct 16 '13 at 07:56