I'm starting to have more source files than is easily managed and was wondering if it's possible to put the .java files into sub-folders of the package folder they are already in?
I'm using eclipse if that makes a difference.
Printable View
I'm starting to have more source files than is easily managed and was wondering if it's possible to put the .java files into sub-folders of the package folder they are already in?
I'm using eclipse if that makes a difference.
You would have to change how you package them.
For example
imports the source files in the java/awt folder, but none of the subdirectories in there.Code:import java.awt.*;
Imports the source files in java/awt/event folder.Code:import java.awt.event.*;
Thought that might be the case :(. Will that mean that they wont be displayed as a tree/hierarchy in the "Package Explorer" of eclipse? The current packages I have don't seem to display that way and it would make things a little less readable if I can't see the hierarchy at a glance :(.
C++ spoiled me rotten with all it's niceties so I get a little disappointed when Java lacks the same features. Oh well, at least it'll be better than it currently is, thanks for the quick reply :)
You should really have been using packages from the first class that you wrote. They explain how to use them here: Creating and Using Packages (The Java™ Tutorials > Learning the Java Language > Packages)
You've probably not defined your folders as source folders for your project in Eclipse. This has less to do with Java but more with your ability to use eclipse. Eclipse also has different types of viewing your projects according to your preference.
Nah, this doesn't really have anything to do with Java lacking features. There is nothing to suggest that source code organization is better in C++ than in Java.
I'm using a few packages already but they are just the ones that were created automatically when I created the project. The project started off as just a test to see that my idea was actually viable on the Android platform and as each part proved viable I just kept coding more parts so I wasn't really expecting to get this far when I started and as a result I didn't expect to run into this problem. Normally I would have used some sort of namespacing before I got to this point but I didn't think it was going to be necessary. I'll probably start up a new project for this soon and sort out the packages when copying the code across to it, along with any other refactoring that might be beneficial.
Anyway thanks for the link, saves me having to look it up :D
Awesome, that's going to neaten things up heaps, thanks :D.
Quote:
Awesome, that's going to neaten things up heaps, thanks
You're welcome.