Package: ia32-sun-java6-bin Version: 6-03-2 Severity: normal In a similar vein to: https://bugs.launchpad.net/ubuntu/+source/sun-java6/+bug/150926
I am trying to run libjvm.so from my amd64 system. I assume there must be some workaround, hence the existance of the "ia32-sun-java6-bin" package. Though I am still at a loss how to open libjvm from my amd64 environment. Is there something like linux32 for doing this? Any tips much appreciated. x61:~/code/tests/JSXlib/unix% make build options: CFLAGS = -g -Wall -O2 -I. -I/usr/include -I/usr/lib/jvm/java-6-sun-1.6.0.03/include/ -I/usr/lib/jvm/java-6-sun-1.6.0.03/include/linux -DXP_UNIX LDFLAGS = -g -L/usr/lib -lc -ldl CC = g++ CC main.cpp CC -o main x61:~/code/tests/JSXlib/unix% ./main /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/i386/client/libjvm.so: wrong ELF class: ELFCLASS32 -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.24-rc5-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages ia32-sun-java6-bin depends on: ii debconf [debconf-2.0] 1.5.17 Debian configuration management sy ii ia32-libs 2.2 ia32 shared libraries for use on a ii libc6-i386 2.7-4 GNU C Library: 32bit shared librar ii sun-java6-jre 6-03-2 Sun Java(TM) Runtime Environment ( Versions of packages ia32-sun-java6-bin recommends: ii ia32-libs 2.2 ia32 shared libraries for use on a ii lib32asound2 1.0.15-3 ALSA library (32 bit) ii lib32gcc1 1:4.2.2-4 GCC support library (32 bit Versio -- debconf information: * shared/accepted-sun-dlj-v1-1: true shared/error-sun-dlj-v1-1: * shared/present-sun-dlj-v1-1:
#include <jni.h> #include <dlfcn.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { void *handle; handle = dlopen("/usr/lib/jvm/ia32-java-6-sun-1.6.0.03/jre/lib/i386/client/libjvm.so", RTLD_NOW); if (!handle) { fprintf(stderr, "%s\n", dlerror()); exit(EXIT_FAILURE); } dlerror(); /* Clear any existing error */ }
include config.mk SRC = main.cpp OBJ = ${SRC:.cpp=.o} all: options main options: @echo build options: @echo "CFLAGS = ${CFLAGS}" @echo "LDFLAGS = ${LDFLAGS}" @echo "CC = ${CC}" .cpp.o: @echo CC $< @${CC} -fPIC -c ${CFLAGS} $< #${OBJ}: main.h main: ${OBJ} @echo CC -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: @echo cleaning @rm -f main ${OBJ} .PHONY: all options clean dist install uninstall
# includes and libs INCS = -I. -I/usr/include -I/usr/lib/jvm/java-6-sun-1.6.0.03/include/ -I/usr/lib/jvm/java-6-sun-1.6.0.03/include/linux LIBS = -L/usr/lib -lc -ldl # debugging CFLAGS = -g -Wall -O2 ${INCS} -DXP_UNIX LDFLAGS = -g ${LIBS} # compiler and linker CC = g++