This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
compiling com.mysql.jdbc.Driver with gcj
- From: Khiraly <khiraly123 at gmx dot net>
- To: java at gcc dot gnu dot org
- Date: Sun, 09 Oct 2005 17:34:07 +0200
- Subject: compiling com.mysql.jdbc.Driver with gcj
Hi!
I wanted to compile my application to native code.
My application use mysql, so I need mysql driver to compile into the
binaries.
I have tried the following method:
1. Create a class with include mysql driver into the native code:
public class ForceInclude {
private static final Class class1 = com.mysql.jdbc.Driver.class;
ForceInclude() {
}
}
Now the compile command:
gcj-4.0 --classpath=../mysql-connector-java-3.1.10-bin.jar:. org/dcwatch/dchub/core/*.java
org/dcwatch/dchub/util/*java org/dcwatch/sql/SqlConnection.java ForceInclude.java
--main=org.dcwatch.dchub.core.Core -o faszom2.out
The result is this:
/tmp/ccINcMTs.o: In function `ForceInclude::__U3c_clinit__U3e_()':
ccqmLQg5jx:(.text+0xfc00): undefined reference to `com::mysql::jdbc::Driver::class$'
ccqmLQg5jx:(.text+0xfc12): undefined reference to `com::mysql::jdbc::Driver::class$'
collect2: ld returned 1 exit status
I have found this method on the following link:
http://www.cs.umanitoba.ca/~eclipse/6-Compiling.pdf
There are others with the same problem (no result):
http://66.249.93.104/search?q=cache:-QJ78MPiHzoJ:dbforums.com/t576436.html+gcj+com::mysql::jdbc::Driver::class%24&hl=hu&lr=lang_en|lang_hu&client=firefox
How can I include mysql driver into my native code?
Best regards,
Khiraly