When I run my server program on the server machine, there is a NoSuchMethodError.
When I run the same server program on an other machine, the error does not happened.
What is the reason ?

Thanks a lot for your interest in this question.
What can I do ?
This server program is a thread it is running with the MS VJ++ jdk.
Who is Participating?
fontaineConnect With a Mentor Commented:
I post as an answer what seems the most realistic cause of this problem, being given the
information provided. Reject if this does not help you.

You are probably using some JDK 1.1 methods and the other machine does only
understand Java code from the prior API version, 1.0. To know what version of the JDK you
are using, you can type java -version, or something similar if you are not working with
SUN's JDK. Also, I think that Microsoft has introduced some methods that are not part
of the standard Java API. If you are using them, a "pure Java" VM will throw a
"NoSuchMethodError" when trying to execute them. You should read the doc. of the
method that has thrown the exception, there sould be something that tells you since
what version of Java the method is available.
thibalAuthor Commented:
Edited text of question
thibalAuthor Commented:
Edited text of question
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

To fix the problem, you will have either the upgrade the VM of the other machine or to replace
the method by something equivalent but that only uses classes and methods from the
API version supported by the other machine.
thibalAuthor Commented:
Your answer is probably a good one because I find this server program in "Java in a nutshell".
I've got the VisualJ++ 1.0.
But I am surprised because my code is compiled without any error or warning...
thibalAuthor Commented:
I don't know what method can provocate this exception.
Have you an idea?
I see that I have mixed up the two machines: if it does not run on the server machine, it is
the VM of the server machine that is outdated compared to the code of your book. The
best analogy for your problem is the writing of applets. If you write an applet using methods
that are specific to JDK 1.1, all will compile fine if you work with a JDK 1.1 environment. If
you then try the applet in a non-JDK 1.1 browser, it will throw a NoSuchMethodError when
trying to access these methods. All methods that are part of the JDK 1.1 API can led
to this exception if the program is run on an old VM.

Example of method specific to the 1.1 API:

public byte[] getBytes(String enc); of java.lang.String

Normally, you should have in the error message the name of the method or at least a line
where the exception has occured. If you don't see these information, you should take a look
at the doc. of the VM: there is probably a flag to set before running the app.
All Courses

From novice to tech pro — start learning today.