Right, my current directory is in my classpath for both machines.  But
javac in windows sees the .java files and compiles them,, the Linux
javac does not.   Your example below is consistent with mine on Linux.
Question why I get differing behavior on the windows machine.

John
On 11/24/01, 11:04:27PM -0500, [EMAIL PROTECTED] wrote:
> On Sat, 24 Nov 2001, John P. Verel wrote:
> 
> > I may have not stated the question correctly.
> 
> No, I understood. I may have not stated the answer clearly.
> 
> > I have two files, foo1.java and foo2.java foo2.java imports foo1.  On my
> > Windows machine, I can simply execute javac foo2.java and javac compiles
> > foo1.java and foo2.java.  Same jdk on Linux does not.  In neither case do I
> > have a classpath set.  On my windows machine, I have a dot at the end of the
> > path search to denote the current address.  I had expected the Linux version to
> > automatically find foo1.java compile it and import the class file into foo2,
> > but that is not happening.
> >
> > If I compile foo1.java first, then compile foo2, all works fine.
> 
> Then . is in your classpath :)
> 
> 
> [cgalpin@kanga jdktest]$ rpm -q jdk
> jdk-1.3.1-fcs
> [cgalpin@kanga jdktest]$ echo $CLASSPATH
> 
> [cgalpin@kanga jdktest]$ cat foo*.java
> 
> class foo1
> {
>     void bark()
>     {
>         System.out.println("woof");
>     }
> }
> 
> import foo1;
> 
> class foo2
> {
>     public static void main(String []args)
>     {
>         System.out.println("sit");
>         new foo1().bark();
>     }
> }
> [cgalpin@kanga jdktest]$ !rm
> rm *~ *.class
> rm: cannot remove `*~': No such file or directory
> rm: cannot remove `*.class': No such file or directory
> [cgalpin@kanga jdktest]$ javac foo2.java
> foo2.java:2: cannot resolve symbol
> symbol: class foo1
> import foo1;
> ^
> foo2.java:9: cannot resolve symbol
> symbol  : class foo1
> location: class foo2
>         new foo1().bark();
>             ^
> 2 errors
> [cgalpin@kanga jdktest]$  javac -classpath . foo2.java
> [cgalpin@kanga jdktest]$ java foo2
> sit
> woof
> [cgalpin@kanga jdktest]$export CLASSPATH=.
> [cgalpin@kanga jdktest]$ rm *.class
> [cgalpin@kanga jdktest]$ javac foo2.java
> [cgalpin@kanga jdktest]$  java foo2
> sit
> woof
> [cgalpin@kanga jdktest]$
> 
> 
> Ok, so if you put the directory you are developing in your classpath
> (since you are not using a package it is the current dir) javac is able to
> find foo1. Obviously it's in your classpath on the windows box.
> 
> hth
> charles
> 
> 
> 
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list

-- 
John P. Verel
Living Proof That Low Tech Beats High Tech!



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to