| | |
first project in netbeans
![]() |
hi everyone,
I have some experience with netbeans, but it is my first time for a java application.
I was wondering, as the main is already placed in a package, where would i place the other classes. Is there a rule or something. Because I saw the sample and the gui class was placed in the same package as main but the other class was in seperate package.
Also if i want to do client and server application is there any difference in term of packages and etc.
thanks
I have some experience with netbeans, but it is my first time for a java application.
I was wondering, as the main is already placed in a package, where would i place the other classes. Is there a rule or something. Because I saw the sample and the gui class was placed in the same package as main but the other class was in seperate package.
Also if i want to do client and server application is there any difference in term of packages and etc.
thanks
Figure out some logical structure and stick with it, that's the general rule.
What that structure actually is is less important than sticking to it.
What I generally do is place classes together based on functionality.
So in your case I'd make a package for the user interface classes.
Under that subpackages for classes used only in the client and the server (with the shared classes in the base user interface package).
Make a parallel tree for utility classes, etc.
May seem a lot of work for a small application with one or two classes per package but when you get into larger projects with hundreds or thousands of classes it can really help.
Someone forgot to do that where I now work and we have more than a bit of duplicate functionality because classes are in places they shouldn't be and get forgotten about, packages have literally hundreds of classes that are only loosely related if at all, making them hard to find, etc.
It pays thinking about that package structure for a while before you start coding, a day or even a few days on a large project is no luxury.
That's part of the design process, book the time on someone else's budget
What that structure actually is is less important than sticking to it.
What I generally do is place classes together based on functionality.
So in your case I'd make a package for the user interface classes.
Under that subpackages for classes used only in the client and the server (with the shared classes in the base user interface package).
Make a parallel tree for utility classes, etc.
May seem a lot of work for a small application with one or two classes per package but when you get into larger projects with hundreds or thousands of classes it can really help.
Someone forgot to do that where I now work and we have more than a bit of duplicate functionality because classes are in places they shouldn't be and get forgotten about, packages have literally hundreds of classes that are only loosely related if at all, making them hard to find, etc.
It pays thinking about that package structure for a while before you start coding, a day or even a few days on a large project is no luxury.
That's part of the design process, book the time on someone else's budget
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
hi,
so now i have a package messenger. inside it i have gui. inside gui i have serverside and clientside. i have two mains in gui one for client and one for server. I do import messenger.gui.clientside.*;
when i run it server runs ok. but i right clicked clien.java and compile and run it i get this error:
what should i do?
thanks
so now i have a package messenger. inside it i have gui. inside gui i have serverside and clientside. i have two mains in gui one for client and one for server. I do import messenger.gui.clientside.*;
when i run it server runs ok. but i right clicked clien.java and compile and run it i get this error:
Java Syntax (Toggle Plain Text)
java.lang.NoClassDefFoundError: messenger/UserInterface/ClientTest Exception in thread "main" Java Result: 1
what should i do?
thanks
![]() |
Similar Threads
- How to download source code for NetBeans and Eclipse? (Java)
- Java IDE(s) (Java)
- homework(easy): Java GUI/Netbeans using java.util.LinkedList (Java)
- linux/netbeans problem with default color covers set color of JTabbedPane (Java)
- Group Project Ideas (Geeks' Lounge)
Other Threads in the Java Forum
- Previous Thread: A Default size for a blank JList?
- Next Thread: need help...
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game gameprogramming givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






