Discussion:
qtjava (kdebindings-3.5.4-1mdv2007.0.src.rpm)
Rafael Lopez
2006-10-11 05:55:10 UTC
Permalink
Hello,

I have the following problem with qtjava: on my suse 10.0 (and 10.1), using
the suse packages, I can get my own programs to compile fine with gcj and
then run. However, on mandriva 2007.0, using the source rpm for kdebindings,
then building them, then installing them to have qtjava.jar, it just fails
to link (if I try to compile and link) or compiles without errors but fails
to run (both with gcj and javac/java).

The code used to test is the one on
http://www.valdyas.org/fading/index.cgi/hacking/gcj.html

Logs are below:
Compiles with gcj but won't run:
[***@localhost ~]$ export CLASSPATH=/usr/lib64/java/qtjava.jar
[***@localhost ~]$ gcj -C -classpath ${CLASSPATH} Hello.java
[***@localhost ~]$ gij -classpath ${CLASSPATH} Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
at gnu.java.lang.MainThread.run(libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: Hello not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib64/java/qtjava.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at gnu.java.lang.MainThread.run(libgcj.so.7)
[***@localhost ~]$

Compiles with javac (1.5.0-8) but won't run:

[***@localhost ~]$ javac -cp ${CLASSPATH} Hello.java
[***@localhost ~]$ java Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
[***@localhost ~]$

Won't compile+link (gcj):

[***@localhost ~]$ gcj -fjni -classpath ${CLASSPATH}
/usr/lib64/java/qtjava.jar Hello.java --main=Hello -o hello
org/kde/qt/Invocation.java: In class 'org.kde.qt.Invocation':
org/kde/qt/Invocation.java: In method
'org.kde.qt.Invocation.fromQtTypeSignature(java.lang.String)':
org/kde/qt/Invocation.java:43: error: verification failed at PC=199: String,
int, or float constant expected
org/kde/qt/Invocation.java:43: error: verification failed at PC=205:
incompatible type on stack
org/kde/qt/Invocation.java:43: error: verification failed at PC=219: String,
int, or float constant expected
org/kde/qt/Invocation.java:43: error: verification failed at PC=225:
incompatible type on stack
org/kde/qt/Invocation.java:66: error: expected type 'java.lang.Object' but
stack contains 'int'
org/kde/qt/Invocation.java:68: error: expected type 'java.lang.Object' but
stack contains 'byte'
org/kde/qt/Invocation.java:66: confused by earlier errors, bailing out
[***@localhost ~]$



RL
Kevin Krammer
2006-10-11 07:43:41 UTC
Permalink
Post by Rafael Lopez
Hello,
I have the following problem with qtjava: on my suse 10.0 (and 10.1), using
the suse packages, I can get my own programs to compile fine with gcj and
then run. However, on mandriva 2007.0, using the source rpm for
kdebindings, then building them, then installing them to have qtjava.jar,
it just fails to link (if I try to compile and link) or compiles without
errors but fails to run (both with gcj and javac/java).
The code used to test is the one on
http://www.valdyas.org/fading/index.cgi/hacking/gcj.html
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
at gnu.java.lang.MainThread.run(libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: Hello not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:/usr/lib64/java/qtjava.jar],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at gnu.java.lang.MainThread.run(libgcj.so.7)
Maybe you need to explicitly add the current directory or "." to the classpath

Cheers,
Kevin
--
Kevin Krammer, KDE developer
KDE user support, developer mentoring
Rafael Lopez
2006-10-11 18:04:26 UTC
Permalink
----- Original Message -----
From: "Kevin Krammer" <***@gmx.at>
To: <kde-***@kde.org>
Sent: Wednesday, October 11, 2006 9:43 AM
Subject: Re: [Kde-java] qtjava (kdebindings-3.5.4-1mdv2007.0.src.rpm)

I tried with . in the classpath, with no luck. However, while recompiling
everything, I caught the following, which happens to be in the file that
gives errors when trying to compile+link (Invocation.java):

Invocation.java:369: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Class for a varargs call
cast to java.lang.Class[] for a non-varargs call and to suppress this
warning
method = onThis.getClass().getMethod(methodName,
null);
^
Invocation.java:372: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Class for a varargs call
cast to java.lang.Class[] for a non-varargs call and to suppress this
warning
method =
onThis.getClass().getDeclaredMethod(methodName, null);

^
Invocation.java:385: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Object for a varargs call
cast to java.lang.Object[] for a non-varargs call and to suppress this
warning
Object result = method.invoke(onThis, null);
^
Invocation.java:406: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Class for a varargs call
cast to java.lang.Class[] for a non-varargs call and to suppress this
warning
method = onThis.getClass().getMethod(methodName,
null);
^
Invocation.java:409: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Class for a varargs call
cast to java.lang.Class[] for a non-varargs call and to suppress this
warning
method =
onThis.getClass().getDeclaredMethod(methodName, null);

^
Invocation.java:422: warning: non-varargs call of varargs method with
inexact argument type for last parameter;
cast to java.lang.Object for a varargs call
cast to java.lang.Object[] for a non-varargs call and to suppress this
warning
Object result = method.invoke(onThis, null);
_______________________________________________
Kde-java mailing list
https://mail.kde.org/mailman/listinfo/kde-java
Polina Goltsman
2006-10-12 08:11:26 UTC
Permalink
Dear Rafael

I use javac/java in my project.
Post by Rafael Lopez
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
I have the same problem with one of my projects when I've tried to include
commons-logging in the classpath.
I got the error - my main class was not found. (Despite it works perfectly
in my IDE)
I made it work by packaging all classes in jar file and including classpath
into manifest. E.g. ...

Manifest-Version: 1.0
...
Class-Path: /usr/kde/3.5/lib/java/qtjava.jar

My program worked, but when I try to run your example I get
java.lang.NoClassDefFoundError : org/kde/qt/QMainWindow

Cheers
Polly

Loading...