Question

I am trying to use the new LiveConnect features introduced in Java 6 Update 10.

Code looks like this (copied from the applet tutorial):

 Class<?> c = Class.forName("com.sun.java.browser.plugin2.DOM");
 Method m = c.getMethod("getDocument", java.applet.Applet.class);
 Document document = (Document) m.invoke(null, this);

But all I am getting is a ClassNotFoundException for the entry-point class.

This on the Mac, 10.6, with both Firefox and Safari.

Java Plug-in 1.6.0_22
Using JRE version 1.6.0_22-b04-307-10M3261 Java HotSpot(TM) 64-Bit Server VM

Is this not implemented on the Mac? Or do I need to configure something?

All I need to do is get and set the value of form elements on the page, so I would be fine with an older (pre-6u10) API if that works better.

Was it helpful?

Solution

Found the answer in this thread:

Java 6 on the Mac does include Plugin2, but it is not the default. You can enable it in the Java Preferences by checking "Run applets in their own process".

I'll use the older API for better compatibility.

OTHER TIPS

According to the release notes http://www.oracle.com/technetwork/java/javase/index-135519.html mac is not supported. Have a look at the "Supported Platforms and Browsers" on that link... I can only see Windows, Linux and Solaris. Not too nice of them!

Look at the classes in:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/plugin.jar

which on my machine is an alias for

/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/lib/plugin.jar

The com.sun.java.browser.plugin2.DOM class does exist there.

It might be different on your machine since I installed the extra developer JDK packages while most machines will only have the JRE. The path might also be different on your computer if you haven't installed all the latest Apple Java updates. Apple made a change to the filesystem location of the JVM in their last Java update.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top