9. Using wx4j in Your Own Application

This section describes how to use wx4j in your own application.

9.1. Compiling Against wx4j

To compile against wx4j, all you need to do is add wx4j.jar in your class path. wx4j.jar is the same on all platforms.

9.2. Running Your Application

wx4j.jar must be in the class path of your application at runtime. wx4j also requires a native library that gets loaded automatically at runtime. Each platform handles loading native libraries different and is described below.

9.2.1. Running on Linux

The native library on Linux is named libwx4j.so. The LD_LIBRARY_PATH environment variable must be modified to include the directory where libwx4j.so is located.

9.2.2. Running on Windows

The native library on Windows is named wx4j.dll. The search path for native libraries is the same as for executables: it must be in the current working directory or in one of the directories specified by the PATH environment variable. If you build wx4j yourself with Visual C++ .NET, you will need to distribute msvcr70.dll with your application.

9.2.3. Running on Mac OS X

As with all applications on Mac OS X, your application must be packaged as a bundle. The native library on Mac OS X is named libwx4j.jnilib. The library should be placed inside your bundle in the Contents/Resources/Java directory, along with wx4j.jar. The OS X program launcher automatically looks in this directory for native libraries.

Mention wx4j.rsrc file, and Java stub...

9.3. Using Java Web Start

Set up resources in your JNLP file as follows:

    <j2se version="1.2+ 1.3+ 1.4+"/>
    <jar href="wx4j-samples.jar" download="eager" />
    <jar href="wx4j.jar" dowload="eager" />
  <resources os="Linux" arch="i386">
    <nativelib href="wx4j-linux.jar" />
  <resources os="Windows">
    <nativelib href="wx4j-win32.jar" />
    <property name="org.wxwindows.load_msvcr70" value="yes"/>
  <resources os="Mac OS X" arch="ppc">
    <nativelib href="wx4j-macosx.jar" />