The LiveConnect/Plug-in SDK
Where to start?
This document gives an overview of what you'll find in the Netscape LiveConnect/Plug-in SDK, and hopefully can answer a few questions you may have about getting started.
Check out the LiveConnect/Plug-in SDK download page.
The SDK has roughly the following directory structure:
sdk sdk/bin sdk/bin/Platform -- platform specific binaries sdk/bin/Platform/javah -- tools sdk/include/ -- headers: npapi.h, jri.h, etc. sdk/common/ -- glue files: npunix.c npwin.cpp npmac.cpp sdk/doc/ -- same as eng/mozilla/3.0/handbook/plugins sdk/classes/ -- zip files for each platform sdk/examples/ -- example code sdk/examples/Framework/ -- C++ framework code used by the examples sdk/examples/SomeExample -- one of the examples, listed below sdk/examples/SomeExample/src -- all source sdk/examples/SomeExample/test -- html & stuff sdk/examples/SomeExample/win -- win-specific (project/make files) sdk/examples/SomeExample/mac -- mac-specific (project files) sdk/examples/SomeExample/unix -- makefiles for all unix versions
where Platform is something like SunOS2.4 or Win32. The examples are:
Note that if you're downloading the SDK for a specific platform you'll get a subset of these examples. On the CD you'll get them all.
Also be sure to read the release notes.
If you're upgrading an existing plug-in to 3.0b5 from 3.0b4 or an earlier version, look at the latest changes document. It will give you a step-by-step guide to updating your plug-in.
Start by looking at an example plug-in, build it and test it out. The Simple example is a good one to start with because it works on all platforms. It demonstrates what's involved in developing a cross-platform plug-in that does both the traditional plug-in functionality and is LiveConnect-enabled (i.e. can be controlled by Java and JavaScript).
The important thing to keep in mind is that Java provides the central point of integration for these technologies. Plug-ins access features of the Navigator through the standard Plug-in API, and by calling into Java. Java can access new features provided by plug-ins by calling native methods they provide that exports these features. JavaScript can control plug-ins by invoking the Java native operations that are exported by the plug-in.
When you get tired of the Simple plug-in, try CharFlipper example. It demonstrates a more sophisticated LiveConnected plug-in that rotates through a set characters specified by a source file. It also uses the example C++ plug-in framework. CharFlipper works for Mac and Windows.
You can also check out the plug-in "templates" -- these are empty projects that work for Windows (Visual C++ 4.0), Macintosh (Metrowerks CW9), and Unix (various makefiles). Start with one of these to create a new plug-in.