I compiled a HelloWorld example using QtJambi. But on running it, it said "failed to unpack native libraries. The complete error was :

daud@daud-laptop:~$ java -d32 com.trolltech.examples.tutorial.HelloWorld
Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.trolltech.qt.QtJambiObject.<clinit>(QtJambiObject.java:60)
	at com.trolltech.examples.tutorial.HelloWorld.main(HelloWorld.java:58)
Caused by: java.lang.RuntimeException: Loading library failed, progress so far:
Unpacking .jar file: 'qtjambi-linux32-gcc-4.6.3.jar'
Checking Archive 'qtjambi-linux32-gcc-4.6.3.jar'

	at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:431)
	at com.trolltech.qt.internal.NativeLibraryManager.loadQtLibrary(NativeLibraryManager.java:355)
	at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:145)
	at com.trolltech.qt.Utilities.loadQtLibrary(Utilities.java:141)
	at com.trolltech.qt.QtJambi_LibraryInitializer.<clinit>(QtJambi_LibraryInitializer.java:56)
	... 2 more
Caused by: java.lang.RuntimeException: Failed to unpack native libraries, progress so far:
Unpacking .jar file: 'qtjambi-linux32-gcc-4.6.3.jar'
Checking Archive 'qtjambi-linux32-gcc-4.6.3.jar'

	at com.trolltech.qt.internal.NativeLibraryManager.unpack(NativeLibraryManager.java:368)
	at com.trolltech.qt.internal.NativeLibraryManager.loadLibrary_helper(NativeLibraryManager.java:437)
	at com.trolltech.qt.internal.NativeLibraryManager.loadNativeLibrary(NativeLibraryManager.java:426)
	... 6 more
Caused by: java.lang.NoClassDefFoundError: com/trolltech/qt/internal/OSInfo
	at com.trolltech.qt.internal.NativeLibraryManager$XMLHandler.startElement(NativeLibraryManager.java:241)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1317)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
	at com.trolltech.qt.internal.NativeLibraryManager.readDeploySpec(NativeLibraryManager.java:506)
	at com.trolltech.qt.internal.NativeLibraryManager.unpackDeploymentSpec(NativeLibraryManager.java:524)
	at com.trolltech.qt.internal.NativeLibraryManager.unpack_helper(NativeLibraryManager.java:392)
	at com.trolltech.qt.internal.NativeLibraryManager.unpack(NativeLibraryManager.java:363)
	... 8 more
Caused by: java.lang.ClassNotFoundException: com.trolltech.qt.internal.OSInfo
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	... 28 more

That its not able to find the native libraries may mean that I have to include the path to JNI libraries in some environment variable. What should I do ?

Thats a big error :O Out of curiosity did you do any research on the net? I found this after a couple of minutes:

package com.trolltech.examples.tutorial;

import com.trolltech.qt.gui.*;

To use Qt Jambi classes, you need to import at least the gui package, which includes the QApplication class.
QApplication manages various application-wide resources and is needed to run a Qt Jambi application.
The gui package contain GUI related classes, such as widgets, which is a user interface object that can process user input and draw graphics.

Assuming that you would want more info following this then follow this link; all should become clear :P

http://doc.qt.nokia.com/qtjambi-4.4/html/com/trolltech/qt/qtjambi-tutorial1.html

Thats a big error :O Out of curiosity did you do any research on the net? I found this after a couple of minutes:

package com.trolltech.examples.tutorial;

import com.trolltech.qt.gui.*;

To use Qt Jambi classes, you need to import at least the gui package, which includes the QApplication class.
QApplication manages various application-wide resources and is needed to run a Qt Jambi application.
The gui package contain GUI related classes, such as widgets, which is a user interface object that can process user input and draw graphics.

Assuming that you would want more info following this then follow this link; all should become clear :P

http://doc.qt.nokia.com/qtjambi-4.4/html/com/trolltech/qt/qtjambi-tutorial1.html

I have included the gui package in my source file (it wouldn't have compiled otherwise). My program (or rather the example from the Qt examples) compiled properly, but was giving the errors on executing it.

The problem was that I was not including qthambi-utils-4.6.3.jar in my CLASSPATH. We have to include all the jar files present in the qtjambi-linux32-community-4.6.3 package in the CLASSPATH. Plus, we have to export the CLASSPATH. Plus, we have to set the CLASSPATH and export it in the .bashrc file of ur home folder (in Ubuntu. In Fedora, there is the .bash_profile or .profile file in which this has to written). It worked then. Also, remember to open a new terminal after u have made changes to the .bashrc file

Thanks a lot for taking time to search the web !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.