![]() |
Home · Examples |
Qt Jambi is available both in prebuilt and source packages for Linux, Mac OS X, and Windows. Java 1.5 or later is required to install Qt Jambi.
The procedure of installing is different depending on whether you have downloaded a source or prebuilt package. This installation guide has separate sections for each approach.
Enjoy !
To run the examples and demo launcher on Windows run:
qtjambi.exeOn Linux and Mac OS X run:
qtjambi.shRunning these files will verify the virtual machine version and set the correct environment for running Qt Jambi applications.
When you are ready to distribute your own applications, see the deployment document. An alternative way of loading the native libraries is to rely on Java's standard method of loading native libraries. This is done by specifying either the JVM system property -Djava.library.path=[path_to_libraries] or including the paths in the following environment variable: Manually Launching Qt Jambi Applications
To manually launch applications, you need to include the following .jar files in your classpath:
All three files live in the in the Qt Jambi installation directory. We give an example for each operating system bellow:// Linux
java -cp qtjambi-4.4.0_01.jar:qtjambi-linux32-gcc-4.4.0_01.jar:qtjambi-examples-4.4.0_01.jar com.trolltech.launcher.Launcher
// Mac OS X
java -XstartOnFirstThread -cp qtjambi-4.4.0_01.jar:qtjambi-macosx-gcc-4.4.0_01.jar:qtjambi-examples-4.4.0_01.jar com.trolltech.launcher.Launcher
// Windows
java -cp qtjambi-4.4.0_01.jar;qtjambi-win32-msvc2005-4.4.0_01.jar;qtjambi-examples-4.4.0_01.jar com.trolltech.launcher.Launcher
Note: When running a Qt Jambi application on Mac, it is necessary to pass the -XstartOnFirstThread argument to the Java executable.Alternate way of loading native libraries
As described in the previous section, Jambi loads the native libraries from the platform archive (when it is included in the classpath).
Windows | Set the PATH environment variable to include the bin directory in the Qt Jambi directory. |
Linux | Set the LD_LIBRARY_PATH environment variable to include the lib directory in the Qt Jambi directory. |
Mac OS X | Set the DYLD_LIBRARY_PATH environment variable to include the lib directory in the Qt Jambi directory. |
Some of Qt's functionality is loaded via native plugins. This includes for instance support for JPEG images. The plugins are located in the plugins directory in the Qt Jambi installation directory.
Qt Jambi searches for the plugins from the directories in the QT_PLUGIN_PATH environment variable (when the platform archive is not used). So you should set QT_PLUGIN_PATH to the plugins directory.
You are then ready to run Qt Jambi applications. An example of how to run the launcher manually is illustrated below:
java -cp qtjambi-4.4.0_01.jar:qtjambi-examples-4.4.0_01.jar com.trolltech.launcher.Launcher
Note that a Qt Jambi source package also requires a Qt source package. To avoid potential binary incompatibilities, it is highly recommended that you rebuild Qt before building Qt Jambi. On Mac OS X, Qt must be configured without frameworks (by running the configure script with the --no-framework option).Configuring the System for Qt Jambi
In addition to the Qt source package, you will need JDK 1.5 or higher and the build utility ant.Building Qt for Qt Jambi
The first step is to build Qt for Qt Jambi. A normal Qt build will normally work, but there are a few exceptions. For more details on building Qt on any given system see the Qt installation guides.
All | Some features in Qt are turned on or off for Qt Jambi by configuring with -D QT_JAMBI_BUILD. Qt Jambi also has no need for the Qt 3 support library so it is recommended to compile with -no-qt3support. |
Mac OS X | Qt Jambi only supports Qt configured with -no-framework and because of compatibility it is recommended to configure Qt against the 10.4 SDK, -sdk /Developer/SDKs/MacOSX10.4u.sdk |
Linux | Sun's Java Virtual Machine has a bug preventing it from using MMX and SSE instructions. For deployment against 1.5 Java runtimes, configure Qt with the options -no-mmx -no-sse -no-sse2 -no-3dnow to avoid problems. In addition, because Qt Jambi requires both the Qt headers and the libraries to be located relative to QTDIR, Qt should be configured with -prefix $PWD, hence not installed. |
Windows (MSVC 2005 or newer) | -plugin-manifests is required for plugins to load properly. |
QTDIR | This variable must contain the path to the directory where Qt is installed. |
JAVA_HOME | This variable must contain the path to the directory where Java is installed. |
> antin the Qt Jambi directory. Please note that Qt Jambi requires the ant-trax module of ant which is optional in some linux distributions. Running ant will automatically go through the following = steps:
> ant -projecthelpFor a description of the various build configurations, one can do:
> ant help
On Linux the gcj (GNU Java Compiler) is located in /usr/bin; the path to the correct java version must be before this in the PATH. This usually results in java.lang.ClassFormatError errors. | Make sure that it is the correct java executable in the PATH. |
Environment variables are not set correctly. | Check with the Configuring the System for Qt Jambi section that your system is properly configured for Jambi. |
Qt Jambi uses the Qt Header files to generate the mapping from c++ to java. Unless Qt was built with default settings, you may get link problems for bindings that are not in the native libraries. | Build Qt with default settings |
juic does not update .jui files that are not modified, which can be a problem if Java sources are deleted. | Run juic with the -a option. |
Qt Jambi expects that Qt was built with debugging turned off. If Qt was built with debugging, the libraries will not be found. | Run Qt Jambi with the com.trolltech.qt.debug system property. |
Qt Jambi tries to use the wrong compiler | This can happen on Windows systems with both the MSVC and MinGW compilers installed.You can set the QMAKESPEC variable. Please see the qmake documentation for details. |
Mac OS X | When running a Qt Jambi application, it is necessary to pass the -XstartOnFirstThread argument to the Java executable. Also, if you have a source package, you have to build Qt with the --no-framework option. |
Linux / 64 bit: | Install a 32 bit virtual machine, e.g., on Ubuntu, install the ia32-sun-java5-bin package and put /usr/lib/jvm/ia32-java-1.5.0-sun-1.5.0.06/jre/bin into the PATH environment variable. |
You will find more information in the Qt Designer document. To build the generator example from the source package simply do:Running the Qt Jambi Generator
The generator is a Qt application which can be used to map C++ based Qt APIs onto equivalent Java APIs. The Qt Jambi package provides an example on how to use the Qt Jambi Generator, located in the path/to/Qt Jambi/generator_example directory. ant -f build_generator_example.xml
Warning: The Qt Jambi generator is written to handle Qt based source code, and is not intended for mapping C++ libraries in general.
Copyright © 2008 Nokia
Trademarks