parseDouble is not available in JDK 1.1.8. If you are running your code in an Applet under, say, Internet Explorer, the Java VM from Microsoft only supports 1.1.8. This is the only reason I can think of.
To work this around, try:
double d=Double.valueOf(S).doubleValue();