Mail Archives: cygwin/1999/02/23/09:24:31
I reproduced your problem description exactly, and it looks like a bug in javac. At the Bug Parade site there
were two reports of this problem:
http://developer.java.sun.com/developer/bugParade/bugs/4064185.html
http://developer.java.sun.com/developer/bugParade/bugs/4111087.html
Apparently the old version of javac is comparing paths based on strings, which don't match in the direction of
the slashes. In JDK 1.2 they compare paths based on real data structures built from the strings.
A workaround I've been using is to create a single top-level class in the default package, placed at the top
of the source tree:
src/Main.java # imports test.TimerAction and defines main()
src/test/TimerAction.java
/*
* Main.java
*/
import test.TimerAction;
class Main {
public static void main(String[] argv) {
}
class MainTimerAction implements TimerAction {
public void action() {
}
}
}
Then when you cd to the src/ directory and type "javac Main.java", javac uses its internal magic to track down
all the other files it needs to compile:
bash-2.01$ pwd
//d/java/timer/src
bash-2.01$ ls -R
Main.java test
test:
TimerAction.java
bash-2.01$ javac Main.java
bash-2.01$ ls -R
Main$MainTimerAction.class Main.java
Main.class test
test:
TimerAction.class TimerAction.java
When you switch to JDK 1.2, you can throw away that stupid Main.java class.
--Andrew Mickish
http://www.andrew.cmu.edu/~am2q/
John Collins wrote:
> When I try to compile a java file, bash is apparently munging the filename
> that the java compiler sees. I've attached a very simple .java file for
> test purposes. Here's what I see when I use the jdk1.1.7 compiler from Sun:
> - If I comment out the package statement and compile the file in the
> default package, it works fine.
> - If I put the file in a relative directory named "test", and then compile
> with javac test/TimerAction.java, I get an error message from javac like:
>
> test/TimerAction.java:15: Public interface test.TimerAction must be defined
> in a file called "TimerAction.java".
>
> I don't get this error if I compile under an NT shell. I also don't get the
> error if I compile with the jdk1.2 compiler. This error is preventing me
> from using make on NT to build my system. For the current project,
> switching to 1.2 isn't an option yet, and many project members do not have
> access to a unix system.
>
> Did I forget to set some option somewhere? Is this a known problem? Thanks
> for your help.
>
> John Collins
> KeyTech LLC, Eagan, MN
>
> -------------------------------------------------------------------------------------
> Name: TimerAction.java
> TimerAction.java Type: Visual Cafe File (application/x-unknown-content-type-VisualCafeFile.Document)
> Encoding: quoted-printable
>
> Part 1.3Type: Plain Text (text/plain)
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -