"package own.examples": necessary for NetBeans?  
Author Message
Mirco Novena





PostPosted: 2004-9-27 20:56:00 Top

java-programmer, "package own.examples": necessary for NetBeans? Hello together

I am learning java and for my beginning, I just used a simple editor to
write the example codes. Now I wanna try NetBeans, but unfortunately all my
codes aren't working! I found out, that NetBeans need at the beginning of
the source file: "package own.examples" (i.e. where the source is stored).

Of course none of the sources I've written contains this add-on (because I
didn't need it). So they don't work with NetBeans. Why? If I am adding this
small "sentence" to the source code, I can compile it with NetBeans without
any problems, -> but not any longer with the command prompt (I am using
WinXP Pro at the moment).

What am I doing wrong? Is this sentence really necessary? I am asking,
'cause I want to implement a CMS (maybe JSF or Struts) and therefore I want
to know:
1) if it is better to use Eclipse or jEdit (do they need this extra
sentence, too?),
2) and if I am using an Application Server, it always needs "package
own.examples" or not? (so that maybe it is better not to use NetBeans 'cause
of this "lack")

thanks and cheers
mirco novena



 
Andrew Thompson





PostPosted: 2004-9-27 21:51:00 Top

java-programmer >> "package own.examples": necessary for NetBeans? On Mon, 27 Sep 2004 14:55:48 +0200, Mirco Novena wrote:

> I am learning java ..

<http://www.physci.org/codes/javafaq.jsp#cljh>

>..and for my beginning, I just used a simple editor to
> write the example codes.

That is a good idea.

>..Now I wanna try NetBeans,

That is a bad idea, unless..

>...but unfortunately all my
> codes aren't working! I found out, that NetBeans need at the beginning of
> the source file: "package own.examples" (i.e. where the source is stored).

..you know how to compile and run from the command line.
a) A 'Hello World!' code.
b) Simple GUI code
c) Simple *packaged class*
d) Simple multi-class, multi-package GUI code.

> Of course none of the sources I've written contains this add-on

A package statement in not an 'add-on', perhaps you should
research package statements before you go much further.

> What am I doing wrong?

Getting in over you head, an advanced IDE such
as Eclipse of NetBeans can increase your productivity
if you already understand packages and various other
things like how to configure them.

>..Is this sentence really necessary?

For anything beyond 'purely experimental' or
'throwaway' code, yes.

>.I am asking,
> 'cause I want to implement a CMS

Which will have many classes, grouped by common nature into
common (clearly named, all lower case) directories. There are
your package statements, the directory names. Assuming
you devlop your project in ..
C://MyProject/code/
..your Java source files might be grouped in,
C://MyProject/code/ui/CMSApplet
C://MyProject/code/ui/CMSFrame
C://MyProject/code/security/LogIn
C://MyProject/code/data/GenericRecord
C://MyProject/code/data/UserRecord
C://MyProject/code/data/ProjectRecord
C://MyProject/code/data/RecordParseException

..in that case, your packages, are 'ui',
'security' and 'data'.

>..(maybe JSF or Struts)

..but web apps can be slightly different with .jsp's..

>..and therefore I want
> to know:
> 1) if it is better to use Eclipse or jEdit (do they need this extra
> sentence, too?),

You should figure what it means before you proceed.

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane