Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, December 2006
JAR creation


Message 1 in thread

Hello,

I think it's not related to Qt Jambi but I didn't find any solution, 
sorry to spam the list.

My program is working in eclipse without any problem. So, I created a 
JAR file from Eclipse (with a main class).

In a console, I export LD_LIBRARY_PATH, and try to launch the JAR file :
 > java -cp /path_to_qtjambi/qtjambi.jar:. -jar program.jar

and I have an error :
 > java.langNoClassDefFoundError : com.trolltech.gui.QWidget
 > ....

I try to launch it without the jar :
 > java -cp /path_to_qtjambi/qtjambi.jar:. org.program.MainClass
and it's working.

Any idea ? How to create a good JAR file ?

Thanks,
Nicolas

PS : sorry, maybe it's a really stupid question...


Message 2 in thread

Hi, Nicolas.

Nicolas Arnaud-Cormos wrote:

> In a console, I export LD_LIBRARY_PATH, and try to launch the JAR file :
> > java -cp /path_to_qtjambi/qtjambi.jar:. -jar program.jar


I think you need to set the Class-Path attribute of your manifest file 
to include the .jar-file:

    http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html

I haven't used Eclipse for deployment before, so I'm not sure how you 
get it to create the correct manifest-file, but it might work if you set 
a dependency on the external qtjambi.jar file in your build path?

If you want to do this manually instead, you can simply unpack the 
jar-file Eclipse has made (jar xf <filename>), edit the 
META-INF/MANIFEST.MF file to set the correct class path, and then bundle 
the program again (jar cfm <jarfile> META-INF/MANIFEST.MF 
<all-files-to-bundle-separated-by-spaces>)

Hope this helps!

-- Eskil


Message 3 in thread

Hi,

You can not use both -cp and -jar.

Use java -cp /path_to_qtjambi/qtjambi.jar:program.jar:. com.my.class

Tom

Nicolas Arnaud-Cormos schrieb:
> Hello,
> 
> I think it's not related to Qt Jambi but I didn't find any solution,
> sorry to spam the list.
> 
> My program is working in eclipse without any problem. So, I created a
> JAR file from Eclipse (with a main class).
> 
> In a console, I export LD_LIBRARY_PATH, and try to launch the JAR file :
>> java -cp /path_to_qtjambi/qtjambi.jar:. -jar program.jar
> 
> and I have an error :
>> java.langNoClassDefFoundError : com.trolltech.gui.QWidget
>> ....
> 
> I try to launch it without the jar :
>> java -cp /path_to_qtjambi/qtjambi.jar:. org.program.MainClass
> and it's working.
> 
> Any idea ? How to create a good JAR file ?
> 
> Thanks,
> Nicolas
> 
> PS : sorry, maybe it's a really stupid question...


Message 4 in thread

Hello,

it's just a guess, but I'd assume that you simply need the
executable jar, and that the they'll have the qt-jambi jar in
their default classpath.

Hm...

-Lenny

Tom Schindl schrieb:
> Hi,
> 
> You can not use both -cp and -jar.
> 
> Use java -cp /path_to_qtjambi/qtjambi.jar:program.jar:. com.my.class
> 
> Tom
> 
> Nicolas Arnaud-Cormos schrieb:
>> Hello,
>>
>> I think it's not related to Qt Jambi but I didn't find any solution,
>> sorry to spam the list.
>>
>> My program is working in eclipse without any problem. So, I created a
>> JAR file from Eclipse (with a main class).
>>
>> In a console, I export LD_LIBRARY_PATH, and try to launch the JAR file :
>>> java -cp /path_to_qtjambi/qtjambi.jar:. -jar program.jar
>> and I have an error :
>>> java.langNoClassDefFoundError : com.trolltech.gui.QWidget
>>> ....
>> I try to launch it without the jar :
>>> java -cp /path_to_qtjambi/qtjambi.jar:. org.program.MainClass
>> and it's working.
>>
>> Any idea ? How to create a good JAR file ?
>>
>> Thanks,
>> Nicolas
>>
>> PS : sorry, maybe it's a really stupid question...
> 
> 
> 


Message 5 in thread

Hi tom,

> You can not use both -cp and -jar.
> 
> Use java -cp /path_to_qtjambi/qtjambi.jar:program.jar:. com.my.class

You are right, thank you.
It's working now.

Nicolas