DL wrote:
Hello,
I am teaching a java course. When some of my students tried
to run a very simple java program that displays a JFrame, it
appeared that even though the program was compiled OK
on all machines in the lab (running windows 2000), a couple of
the machines did not display the Frame at all.
There wasn't any error message printed in the console window
where we started the program. They just didn't display the frame.
(even though most of the machines running the same program
did display the frame correctly).
Do you have any suggestion in how to trace and resolve such
a problem.
Hmm, the classic "works on my machine" problem.
First, determine that the problem does not lie with the code created on
those machines. Copy the class files from a known working machine and
attempt to run them.
Next, the issue is likely environmental. Use the "env" command to
determine the environments on each machine. Pay attention in particular
to the PATH and the CLASSPATH. Also, determine which version of java is
in use on each machine. Try giving the full path to java.exe on the
machines that do not work.
Failing that, start printing out things within the code, or if you
prefer, use a debugger. Unfortunately the debugger will require
enviromental changes that may mask the issue.
Ray