- Last Updated on 26 September 2013
The LiveConnect technology is both implemented in browser side as well as in Java side. For the Java side, it is implemented in the plugin.jar library which can be found under either following locations:
- JRE_Home\lib (for example: c:\Program Files\Java\jdk1.7.0_03\jre\lib\plugin.jar)
- JDK_Home\jre\lib (for example: c:\Program Files\Java\jre7\lib\plugin.jar)
So when compiling source code which is using LiveConnect, remember to include the plugin.jar file to the classpath. But when running Java program, there is no need to include the plugin.jar file because it is already available as a part of Java runtime environment.
LiveConnect API allows developers to:
- Access any Java objects and its members if exposed via the applet.
The following table summarizes methods of the JSObject class:
static JSObject getWindow(Applet applet)
Object call(String methodName, Object args)
Object eval(java.lang.String s)
Object getMember(String name)
void setMember(String name, Object value)
void removeMember(String name)
void setSlot(int index, Object value)
Object getSlot(int index)
Data type conversion
From Java data type
byte, character, short, int, long, float and double.
Return values from call() and eval() are always converted to Object in Java.
Source code of Java applet:
For more information about how LiveConnect is applied in real life scenario, read the following articles:
LiveConnect specification: http://jdk6.java.net/plugin2/liveconnect/
LiveConnect Javadoc: http://jdk6.java.net/nonav/plugin2/liveconnect/jsobject-javadoc/