Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2366

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /home/gvatteka/dev/qtjambi/4.3/scripts/../doc/src/qtjambi-installation.qdoc -->
<head>
  <title>Installing Qt Jambi</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Installing Qt Jambi<br /><small></small></h1>
<p>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.</p>
<p>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.</p>
<p>Enjoy !</p>
<ul><li><a href="#installing-from-a-prebuilt-package">Installing from a Prebuilt Package</a></li>
<ul><li><a href="#manually-launching-qt-jambi-applications">Manually Launching Qt Jambi Applications</a></li>
</ul>
<li><a href="#building-qt-jambi-from-a-source-package">Building Qt Jambi from a Source Package</a></li>
<ul><li><a href="#configuring-the-system-for-qt-jambi">Configuring the System for Qt Jambi</a></li>
<li><a href="#building">Building</a></li>
<ul><li><a href="#building-and-running-the-jambi-generator">Building and Running the Jambi Generator</a></li>
<li><a href="#building-c-libraries-and-tools">Building C++ libraries and tools</a></li>
<li><a href="#generating-ui-files">Generating Ui files</a></li>
<li><a href="#building-the-java-source-files">Building the Java Source Files</a></li>
</ul>
<li><a href="#running-qt-jambi-applications">Running Qt Jambi Applications</a></li>
<li><a href="#trouble-shooting">Trouble Shooting</a></li>
<ul><li><a href="#common-problems">Common Problems</a></li>
<li><a href="#load-issues">Load Issues</a></li>
</ul>
</ul>
<li><a href="#platform-notes">Platform Notes</a></li>
<li><a href="#running-the-qt-jambi-generator">Running the Qt Jambi Generator</a></li>
</ul>
<a name="installing-from-a-prebuilt-package"></a>
<h2>Installing from a Prebuilt Package</h2>
<p>After extracting the package, you are ready to run the Launcher, which is an application that runs the examples and demos that come with Qt Jambi.</p>
<p>To run the examples and demo launcher on Windows run the</p>
<pre>    qtjambi.exe</pre>
<p>executable from the root directory. On Linux and Mac OS X run the</p>
<pre>    qtjambi.sh</pre>
<p>shell script from the Qt Jambi directory.</p>
<p>Running these files will verify the virtual machine version and set the correct environment for running Qt Jambi applications. If you later have problems running your own applications, you can examine the script, update the class path, and replace your own class with <tt>com.trolltech.launcher.Launcher</tt>.</p>
<p>When you are ready to distribute your own applications, see the <a href="qtjambi-deployment.html">deployment</tt></a> document.</p>
<a name="manually-launching-qt-jambi-applications"></a>
<h3>Manually Launching Qt Jambi Applications</h3>
<p>To manually run Qt Jambi, the <tt>CLASSPATH</tt> environment variable must include the <tt>qtjambi.jar</tt> file to get access to the library. To run the examples or launcher, the classpath must also include the Qt Jambi directory.</p>
<p>The QT_PLUGIN_PATH variable must contain the path to the <tt>plugins</tt> directory in the Qt Jambi directory. Qt Jambi will also search for plugins in .jar files to which the system property <tt>com.trolltech.qt.pluginjars</tt> contains paths.</p>
<p>Finally, Qt Jambi must be enabled to find the native libraries:</p>
<p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Platform</th><th>Comment</th></tr></thead>
<tr valign="top" class="odd"><td>Windows</td><td>Set the <tt>PATH</tt> environment variable to include the bin directory in the Qt Jambi directory.</td></tr>
<tr valign="top" class="even"><td>Linux</td><td>Set the <tt>LD_LIBRARY_PATH</tt> environment variable to include the lib directory in the Qt Jambi directory.</td></tr>
<tr valign="top" class="odd"><td>Mac OS X</td><td>Set the <tt>DYLD_LIBRARY_PATH</tt> environment variable to include the lib directory in the Qt Jambi directory.</td></tr>
</table></p>
<a name="building-qt-jambi-from-a-source-package"></a>
<h2>Building Qt Jambi from a Source Package</h2>
<p>This section describes how to build Qt Jambi from source. We first explain how to configure your system, and then we go through the procedure of building Qt Jambi from the command line. Finally, we look at some common installation problems.</p>
<a name="configuring-the-system-for-qt-jambi"></a>
<h3>Configuring the System for Qt Jambi</h3>
<p>The Jambi source package requires Qt to be installed on the system. The java version must be at least 1.5&#x2e;</p>
<p>The following table describes the environment variables necessary to install Qt Jambi. We assume that the JAMBI environment variable contains the path to the Qt Jambi directory.</p>
<p><table width="80% \header \o Variable \o Value" align="center" cellpadding="2" cellspacing="1" border="0">
<tr valign="top" class="odd"><td>QTDIR</td><td>This variable must contain the path to the directory where Qt is installed.</td></tr>
<tr valign="top" class="even"><td>JAVADIR</td><td>This variable must contain the path to the directory where Java is installed.</td></tr>
<tr valign="top" class="odd"><td>PATH</td><td>This variable must include the directory JAVADIR/bin.</td></tr>
<tr valign="top" class="even"><td><ul>
<li>LD_LIBRARY_PATH on Linux</li>
<li>DYLD_LIBRARY_PATH on Mac OS X</li>
<li>PATH on Windows</li>
</ul>
</td><td>This variable must include the directory JAMBI/lib and QTDIR/Lib</td></tr>
<tr valign="top" class="odd"><td>CLASSPATH</td><td>This variable must include the JAMBI directory.</td></tr>
</table></p>
<a name="building"></a>
<h3>Building</h3>
<p>We will now go through the procedure of building Qt Jambi step-by-step from the command line. We give shell transcripts for all commands necessary to successfully set up a working Qt Jambi environment. The transcripts are given from a Linux shell, but are essentially equal on all platforms; we will point out differences as we go along.</p>
<p>We also provide a script (build_jambi.sh) on Linux/Mac OS X that performs this procedure. The script also checks that the environment is set up correctly to build Jambi. It is located in the <tt>scripts</tt> subdirectory of the Qt Jambi directory.</p>
<a name="building-and-running-the-jambi-generator"></a>
<h4>Building and Running the Jambi Generator</h4>
<p>The Jambi Generator generates java source files that wrap the Qt C++ libraries. In order to build Jambi itself, we need the generator. So go into the directory in which it lives:</p>
<pre>    cd $JAMBI/generator</pre>
<p>Then run qmake and the make tool on your system (On windows the tool is usually <tt>gmake</tt> or <tt>nmake</tt>):</p>
<pre>    qmake
    make</pre>
<p>Then run the generator. Default settings are fine, so no command line arguments are necessary:</p>
<p>On Linux:</p>
<pre>    ./generator</pre>
<p>On Windows:</p>
<pre>    release\generator</pre>
<p>The generator will give several warnings while running. This is normal and does not present a problem.</p>
<a name="building-c-libraries-and-tools"></a>
<h4>Building C++ libraries and tools</h4>
<p>Go back to the JAMBI directory and run <tt>qmake</tt> to generate the necessary make file. Finally, build with <tt>make</tt>:</p>
<pre>    cd ..
    qmake -r
    make</pre>
<a name="generating-ui-files"></a>
<h4>Generating Ui files</h4>
<p>We now need to build the Ui files, i.e&#x2e;, create java files from UI created with the Qt Designer:</p>
<pre>    ./bin/juic -cp .</pre>
<a name="building-the-java-source-files"></a>
<h4>Building the Java Source Files</h4>
<p>The generator and juic have now created the Java source files for Qt Jambi. These are all listed in the file <tt>java_files</tt>. The Java compiler <tt>javac</tt> can take this file as an argument and will then compile all sources.</p>
<pre>    javac @java_files</pre>
<p>Note that on some systems it might be necessary to invoke <tt>javac</tt> with the VM option -J-mx1024 to prevent the VM from running out of heap space. You may need to chose a different heap size than 1024.</p>
<a name="running-qt-jambi-applications"></a>
<h3>Running Qt Jambi Applications</h3>
<p>After building Jambi, you should add the JAMBI directory to the class path. Then Qt Jambi applications can be run, for instance the Launcher:</p>
<pre>    java com.trolltech.launcher.Launcher</pre>
<p>Note that on Mac OS X, the VM must be invoked with the -XstartOnFirstThread option.</p>
<a name="trouble-shooting"></a>
<h3>Trouble Shooting</h3>
<p>If you have trouble compiling and running Qt Jambi, we present problems that are commonly encountered in a table. This should be sufficient to solve most problems; failing that, try asking someone. The <a href="http://trolltech.com/developer/faqs/Qt%20Jambi">Jambi FAQ</tt></a> is a good place to start. In the <a href="http://lists.trolltech.com/qt-jambi-interest/">Jambi Mailing List</tt></a>, active Jambi users and the Jambi development team can be helpful with installation problems.</p>
<a name="common-problems"></a>
<h4>Common Problems</h4>
<p>In this section, we have tried to gather common problems encountered while building Qt Jambi. They are listed in a table with columns for the problem description and solution.</p>
<p><table width="80%" align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Problem</th><th>Solution</th></tr></thead>
<tr valign="top" class="odd"><td>On Linux the <tt>gcj</tt> (GNU Java Compiler) is located in <tt>/usr/bin</tt>; the path to the correct java version must be before this in the PATH. This usually results in <tt>java.lang.ClassFormatError</tt> errors.</td><td>Make sure that it is the correct java executable in the PATH.</td></tr>
<tr valign="top" class="even"><td>Environment variables are not set correctly.</td><td>Check with the <a href="qtjambi-installation#configuring-the-system-for-qt-jambi">Configuring the System for Qt Jambi</tt></a> section that your system is properly configured for Jambi.</td></tr>
<tr valign="top" class="odd"><td>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.</td><td>Build Qt with default settings</td></tr>
<tr valign="top" class="even"><td><tt>juic</tt> does not update .juic files that are modified, which can be a problem if Java sources are deleted.</td><td>Run juic with the <tt>-a</tt> option.</td></tr>
</table></p>
<a name="load-issues"></a>
<h4>Load Issues</h4>
<p>If Jambi cannot find the native libraries, you will get <tt>java.lang.UnsatisfiedLinkError</tt>'s or other load issues. The paths in the order Jambi searches for libraries are listed below.</p>
<ul>
<li>The com.trolltech.qt.library-path system property, which can be given <tt>java</tt> as command line argument.</li>
<li>The classpath (including jar files).</li>
<li>The subdirectory <tt>lib</tt> (Mac OS X and Linux) or <tt>bin</tt> (Windows) under the root of the Jambi package structure (i.e&#x2e;, the Qt Jambi directory).</li>
<li>The java.library.path system property, which is set to LD_LIBRARY_PATH on Linux, PATH on Windows, and DYLD_LIBRARY_PATH on Mac OS X.</li>
</ul>
<p>Jambi will tell which libraries fail if you run <tt>java</tt> with the <tt>-Dcom.trolltech.qt.verbose-loading=true</tt> command line argument. You can then check if the library is in one of Jambi's search paths. Note that Jambi will report on each attempt to load a library.</p>
<p>Jambi depends on a few common system libraries. Notably, Xinerama on Linux, which may be missing on older systems. Information about such missing libraries are not propagated from the operating system to Jambi; how missing libraries are reported may vary from system to system.</p>
<a name="platform-notes"></a>
<h2>Platform Notes</h2>
<p><table width="100%" align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Platform</th><th>Comment</th></tr></thead>
<tr valign="top" class="odd"><td>Mac OS X</td><td>When running a Qt Jambi application, it is necessary to pass the <tt>-XstartOnFirstThread</tt> argument to the Java executable.</td></tr>
<tr valign="top" class="even"><td>Linux / 64 bit:</td><td>Install a 32 bit virtual machine, e.g&#x2e;, on Ubuntu, install the <tt>ia32-sun-java5-bin</tt> package and put <tt>/usr/lib/jvm/ia32-java-1.5.0-sun-1.5.0.06/jre/bin</tt> into the <tt>PATH</tt> environment variable.</td></tr>
</table></p>
<a name="running-the-qt-jambi-generator"></a>
<h2>Running the Qt Jambi Generator</h2>
<p>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 <tt>path/to/Qt Jambi/generator_example</tt> directory.</p>
<p>To generate the example's Java library run the</p>
<pre>    generator_example.bat</pre>
<p>script on Windows. On Linux and Mac OS X run</p>
<pre>    generator_example.sh</pre>
<p>These scripts will generate and compile the Java source code, as well as compile the C++ side of the example. See the script files for details.</p>
<p><b>Warning:</b> The Qt Jambi generator is written to handle Qt based source code, and is not intended for mapping C++ libraries in general.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2007 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Jambi </div></td>
</tr></table></div></address></body>
</html>