Hey, thanks for posting! Today I accidentally found out what was at
the root of this problem.
So, please, take a look at 2 pictures attached. After I removed
CLASSPATH environmental variable from System Settings in Windows, the
files compiled successfully! (first link)
But, when I set it again, I couldn't compile those files.
So it's all only because of CLASSPATH variable! I wonder why? I
thought it shouldn't affect the compiler!
Any guesses?

[url=http://www.freeimagehosting.net/][img]http://
www.freeimagehosting.net/uploads/8487025792.jpg[/img][/url]

[url=http://www.freeimagehosting.net/][img]http://
www.freeimagehosting.net/uploads/25e05389c6.jpg[/img][/url]

On Mar 2, 1:49 pm, [email protected] wrote:
> Here are the outputs to <cmd> console. It shows directory structure,
> before compile and after compile. Comments preceded by //.
>
> // Packages in this directory:
> C:\myjavaprograms>dir
>  Volume in drive C has no label.
>  Volume Serial Number is 46B8-F0F9
>
>  Directory of C:\myjavaprograms
>
> 03/01/2009  09:13 PM    <DIR>          .
> 03/01/2009  09:13 PM    <DIR>          ..
> 03/01/2009  02:13 AM    <DIR>          anotherpackage
> 03/01/2009  11:14 AM    <DIR>          foodpackage
> 03/01/2009  09:13 PM               415 Hello.class
> 02/28/2009  10:48 PM               250 Hello.java
> 03/01/2009  11:34 AM    <DIR>          studentpackage
>                2 File(s)            665 bytes
>                5 Dir(s)  74,511,097,856 bytes free
>
> // Files in respective directories; before compile:
> C:\myjavaprograms>dir anotherpackage
>  Volume in drive C has no label.
>  Volume Serial Number is 46B8-F0F9
>
>  Directory of C:\myjavaprograms\anotherpackage
>
> 03/02/2009  06:32 PM    <DIR>          .
> 03/02/2009  06:32 PM    <DIR>          ..
> 03/01/2009  02:04 AM               163 DummyClass.java
>                1 File(s)            163 bytes
>                2 Dir(s)  74,511,024,128 bytes free
>
> C:\myjavaprograms>dir studentpackage
>  Volume in drive C has no label.
>  Volume Serial Number is 46B8-F0F9
>
>  Directory of C:\myjavaprograms\studentpackage
>
> 03/02/2009  06:32 PM    <DIR>          .
> 03/02/2009  06:32 PM    <DIR>          ..
> 03/01/2009  02:09 AM               948 StudentRecord.java
> 03/01/2009  01:01 AM             1,363 StudentRecordExample.java
>                2 File(s)          2,311 bytes
>                2 Dir(s)  74,511,024,128 bytes free
>
> // Compile:
> C:\myjavaprograms>"\program files\java\jdk1.6.0_11\bin\javac"
> studentpackage\*
> ava
>
> // Class files in respective directories after compile:
> C:\myjavaprograms>dir studentpackage
>  Volume in drive C has no label.
>  Volume Serial Number is 46B8-F0F9
>
>  Directory of C:\myjavaprograms\studentpackage
>
> 03/02/2009  06:35 PM    <DIR>          .
> 03/02/2009  06:35 PM    <DIR>          ..
> 03/02/2009  06:35 PM             1,038 StudentRecord.class
> 03/01/2009  02:09 AM               948 StudentRecord.java
> 03/02/2009  06:35 PM               978 StudentRecordExample.class
> 03/01/2009  01:01 AM             1,363 StudentRecordExample.java
>                4 File(s)          4,327 bytes
>                2 Dir(s)  74,510,454,784 bytes free
>
> C:\myjavaprograms>dir anotherpackage
>  Volume in drive C has no label.
>  Volume Serial Number is 46B8-F0F9
>
>  Directory of C:\myjavaprograms\anotherpackage
>
> 03/02/2009  06:35 PM    <DIR>          .
> 03/02/2009  06:35 PM    <DIR>          ..
> 03/02/2009  06:35 PM               503 DummyClass.class
> 03/01/2009  02:04 AM               163 DummyClass.java
>                2 File(s)            666 bytes
>                2 Dir(s)  74,510,454,784 bytes free
>
> On Mar 2, 5:48 pm, Anton Shaykin <[email protected]> wrote:
>
> > Well, unfortunately it is :(
>
> > On Mar 2, 9:11 am, [email protected] wrote:
>
> > > On Mar 2, 6:24 am, Anton Shaykin <[email protected]> wrote:
>
> > > > As I searched through all the threads, concerning lab 1003, I found
> > > > that many people asked this question but it's still unsolved.
> > > > So, in the exercise 2.3 I do everything like it's said, and after I
> > > > type "C:\Java Programs>javac studentpackage/*.java" I get (I copied
> > > > this error message from another thread, but I get exactly the same):
>
> > > > C:\myjavaprograms>javac studentpackage\*.java
> > > > studentpackage\StudentRecord.java:3: package anotherpackage does not
> > > > exist
> > > > import anotherpackage.*;
> > > > ^
> > > > studentpackage\StudentRecord.java:18: cannot resolve symbol
> > > > symbol  : class DummyClass
> > > > location: class studentpackage.StudentRecord
> > > >         DummyClass dummy = new DummyClass();
> > > >         ^
> > > > studentpackage\StudentRecord.java:18: cannot resolve symbol
> > > > symbol  : class DummyClass
> > > > location: class studentpackage.StudentRecord
> > > >         DummyClass dummy = new DummyClass();
> > > >                                ^
> > > > 3 errors
>
> > > > So it appears that compiler can't find anotherpackage, however it
> > > > resides in the same directory as studentpackage, and I do everything
> > > > just how it was described.
> > > > Did anyone have the same issue?
>
> > > I just completed this lab. No issue. My guess is, DummyClass.java is
> > > not inside anotherpackage.
>
> > > > What's more weird, when I type "C:\Java Programs>javac -cp .
> > > > studentpackage/*.java" it works! But how could -cp be connected with
> > > > compiler at all? It just doesn't make any sense.
>
> > > > Thank you.
>
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to