Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class.forName(..) throws exception in Java 5 applet--okay when run as Java 6 applet or Java 5/6 application [SOLVED]



On 29 Feb 2008, at 14:22, Andre-John Mas wrote:
Hi,

Are you trying to load one of your classes and are you sure the class file is not corrupted?

Andre



Many thanks for the response. Yes, I am.

Furthermore, I have now solved the problem. There is a bug in Java 5 (<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6320113>), whose workaround is to disable the caching of applets. However, on the Mac, this isn't straight forward to accomplish, at least if you're still using Mac OS Tiger, since the Java Preferences utility appears to be broken--click General > Settings... > View Applets... and uncheck Enable Caching, and you'll see what I mean. Instead, you need to edit your ~/Library/Caches/Java/deployment.properties file by hand, and add the following entry:

deployment.javapi.cache.enabled=false

Then restart the browser, and the problem has gone away.

* * * Please could somebody check whether the Java Preferences utility is broken on Leopard as well. * * *

Cheers,

Rob

On 29-Feb-08, at 08:37 , Rob Dickens wrote:

Hm.. also occurs on Solaris (jdk1.5.0_11).

On 28 Feb 2008, at 17:54, Rob Dickens wrote:

Dear java-devs,

Has anyone else seen this? The class in question is loaded using a URLClassLoader (and is not in the class path).

java.lang.ClassFormatError: Truncated class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)


Am still on Mac OS 10.4.11 (Tiger), btw. Have just installed Java 5 Release 6, but that didn't fix it.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Class.forName(..) throws exception in Java 5 applet--okay when run as Java 6 applet or Java 5/6 application (From: Rob Dickens <email@hidden>)
 >Re: Class.forName(..) throws exception in Java 5 applet--okay when run as Java 6 applet or Java 5/6 application (From: Rob Dickens <email@hidden>)
 >Re: Class.forName(..) throws exception in Java 5 applet--okay when run as Java 6 applet or Java 5/6 application (From: Andre-John Mas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.