newnee: package problem??

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2008
Posts: 17
Reputation: marcux is an unknown quantity at this point 
Solved Threads: 0
marcux marcux is offline Offline
Newbie Poster

newnee: package problem??

 
0
  #1
Oct 12th, 2008
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
  1. package one;
I made a subpackage called "two" so structure: /home/marcux/HandleProject/one/two.
At top of file Show.java I put:
  1. package one.two;
I compiles Show.java, no problem.
In Test.java I made an instance of object "Show" like:
  1. 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:
  1. export CLASSPATH=/home/marcux/HandleProject/one
Still gets the same error at compiletime??
Tried with:
  1. 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
Last edited by marcux; Oct 12th, 2008 at 2:13 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 799
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: newnee: package problem??

 
0
  #2
Oct 13th, 2008
I'm not 100% sure, but I think you need to
  1. import one.two.*;
to import the two subpackage where the Show class resides.
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC