Hi all!
I have been doing Java a bit but just been putting my .class files in the same dir.
Everything works fine.
I have started looking at packages to make a better structure in my projects.
I just made a test and didn't got it working.
My structure is like: /home/marcux/HandleProject/one
In dir "one" I put Test.java
At the top I wrote

package one;

I made a subpackage called "two" so structure: /home/marcux/HandleProject/one/two.
At top of file Show.java I put:

package one.two;

I compiles Show.java, no problem.
In Test.java I made an instance of object "Show" like:

Show s = new Show();

After that I tried to compile and got the error: can not find symbol.
Aha... CLASSPATH, rihgt??
So I wrote in my terminal:

export CLASSPATH=/home/marcux/HandleProject/one

Still gets the same error at compiletime??
Tried with:

import one.*;

in Test.java
Still no luck!
Compiling with the files in same dir without package my test program works fine!
What am I doing wrong???

Many many thanks!
Marcux

I'm not 100% sure, but I think you need to

import one.two.*;

to import the two subpackage where the Show class resides.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.