When I upgraded from j2sdk 10 to version 11, all of my programs which accessed a public class in another file in the same folder stopped working. When compiling the main file, I get a compile time error saying "variable not found" followed by the public class in the other file. In order to get my programs to work, I have to copy all of the code, minus the public keyword, into the main file, defeating the purpose of having multiple files.
Not easily discouraged, I tried again on another computer. In fact, I tried on no less than 6 computers with varying degrees of success and failure.
2 or 3 did the same thing as my own, I got a compile time error.
2 or 3 others compiled fine, but when I went to run the program, I got a run time error saying no class path def found, even though I had successfully compiled and a class file was physically in the folder.
And then the freaky one. One computer worked. Flawlessly.
Did something about inheritance change in J2SDK 1.4.2_11? Am I doing something wrong? I installed all of these in the same way on all of the computers.
I don't see anything like that in the 1.4.2 release notes. You don't mention what JDK/JRE versions the other computers are running. These symptoms could be caused by something as simple as the CLASSPATH being different between the computers. Did you compare environments? Can you give us a very small example of code (i.e. two bare classes in seperate files) which exhibits these symptoms?
Use Code Tags to preserve your formatting. I compiled your code under 1.4.2_08 and 1.4.2_11 and saw no difference:
So there doesn't appear to be any difference between these versions. Are you certain you are compiling under the same version of Java (run "java -version")? Are you certain the environments of the systems are identical (check PATH and CLASSPATH). Are you sure you are running with current class files? Blank out the CLASSPATH and erase all existing class files to make sure. [ April 14, 2006: Message edited by: Joe Ess ]
@joe: Why should he compile the classes under the same version? The given classes should compile as well with a JDK-1.1 - compiler.
When I take two classes:
and compile both with 1.4 - then compile only the 1.5-Version, the Version1_4.class is found, and nothing is recompiled. Running classes of different compile-versions has never been a problem for me (how would I handle foreign jar-files else?)
Originally posted by Stefan Wagner: . . .and nothing is recompiled.
That's why I told him to blank out the classpath and erase existing class files. Eric thinks something changed between JDK versions AND he's seeing different behavior on different computers. I don't see any difference between JDK versions, and there's nothing unusual in the code. I think he's got environment issues (i.e. bad class in the classpath).
subject: J2SDK 1.4.2_11 Won't inherit from other files