1.6.0 class not found in condition not met

I have an applet that is conditionally not working with jre 1.6.0.

The error is a java.lang.NoClassDefFoundError.

My applet calls a General.class and in that General.class I cannot get a System.out.println to work on the first line of the constructor, because it seems to be jumping ahead 6 lines to execute :

if (a==0){

zzz =new com.company.Z();// error happens on this Z class

}

else{

// do not use com.company.Z class at all.

}

If "a ==0", then the Z.class's jar is available and it runs fine.

But if a is not 0, I get the java.lang.NoClassDefFoundError for Z.class because the Z.class is intentionally unavailable. Why does it run the condition part (a==0), when "a" does not equal 0.

I tried moving this "if" stmt code piece to a separate method, and that did not work.

Does the jre 1.6.0 scan ahead and load classes in conditional statements without evaluating the condition first?

And why can't I debug this with System.out.println ?

I would appreciate any "behind the scenes" incite.

Thanks, Sari

[1373 byte] By [Saria] at [2007-11-26 12:45:35]
# 1
zzz is previously declared as:Object zzz;Sari
Saria at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...
# 2
What does this mean?because the Z.class is intentionally unavailable.I think you need to post more code.
zadoka at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...
# 3

There are two types of clients for this applet (a "caller" and a "reviewer").

When the applet loads a property file indicates which type they are.

For client type (a==0) an a0.jar is downloaded to the "caller" client, along with many shared jars.

For client type (a==1) an a1.jar is downloaded to the "reviewer" client, along with the shared jars.

Inside the General.class (which both clients use), there is a call to the Z.class (which is contained inside a0.jar ONLY), which is only executed on the condition that client is of type (a==0).If the client is type (a==1), the Z.class is not available, because a0.jar has not been downloaded to its system.

hth,

Sari

Saria at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...
# 4

Correction: the property that defines the client type is actually defined in the (applet) html file. there is a "caller.html" and a "reviewer.html", that are very much the same, except for differences in their list of jars to download and also some property definitions within the html.

Sari

Saria at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...
# 5
It sounds like you have answered your own problem.You need that classes jar file. Some possible solutions:Always download that file.Have a different class handle each client type rather than one class with an if statement.
zadoka at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...
# 6

This is a dinosaur that is not extinct. Doing what you ask would require rewriting thousands of line of code. And I don't see any reason to add a class/jar (a0.jar) to the "reviewer" client, when the reviewer never uses this code - because the condition would never be met. The current code works on all previous jre versions back to 1.3.0. Something has changed. But I DO APPRECIATE YOUR ATTENTION, my dear one.

Sari

Saria at 2007-7-7 16:24:34 > top of Java-index,Desktop,Runtime Environment...