| | |
newnee: package problem??
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2008
Posts: 17
Reputation:
Solved Threads: 0
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 I made a subpackage called "two" so structure: /home/marcux/HandleProject/one/two.
At top of file Show.java I put: I compiles Show.java, no problem.
In Test.java I made an instance of object "Show" like:
After that I tried to compile and got the error: can not find symbol.
Aha... CLASSPATH, rihgt??
So I wrote in my terminal:
Still gets the same error at compiletime??
Tried with: 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 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
Java Syntax (Toggle Plain Text)
package one;
At top of file Show.java I put:
Java Syntax (Toggle Plain Text)
package one.two;
In Test.java I made an instance of object "Show" like:
Java Syntax (Toggle Plain Text)
Show s = new Show();
Aha... CLASSPATH, rihgt??
So I wrote in my terminal:
Java Syntax (Toggle Plain Text)
export CLASSPATH=/home/marcux/HandleProject/one
Tried with:
Java Syntax (Toggle Plain Text)
import one.*;
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.
I'm not 100% sure, but I think you need to
to import the two subpackage where the Show class resides.
java Syntax (Toggle Plain Text)
import one.two.*;
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend. ![]() |
Other Threads in the Java Forum
- Previous Thread: java interest program help?
- Next Thread: Binary search tree problem
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu windows working





