MozillaZine

standalone XULRunner app cannot find the JVM

Discussion of third-party/unofficial Firefox/Thunderbird/SeaMonkey builds.
jbilcke
 
Posts: 4
Joined: December 16th, 2009, 8:27 am

Post Posted December 16th, 2009, 9:03 am

hi, I'm experiencing some problems with a java applet and XUL.

first, some information on my setup:
- linux ubuntu 64 bits
- java 1.6.0_16 (jre, and jdk, installed from the package manager)

but let's start from the beginning :

I first tried my code in a 'basic' xulrunner application, ie. only a directory structure with an application.ini, no makefile, booted from the command line with the xulrunner executable installed in my linux system: It worked! I could see my java applet (put in an HTML page..) inside the xulrunner app: yeepee!

Then, I tried to use the mozilla build scripts to build a standalone application :
after hours of head scratching and js/css/xul/xml coding,
I installed:
- xulrunner-1.9.1.5 (standard package, and the dev package)
- hg clone from mozilla 1.9.1 stable, which I use to get the mozilla build files (you know.. this 'client?mk' which I couldn't find anywhere, other than the mozilla repository. am I doing it wrong? I guess.. not too much, because it seems to work, but I'm not sure)
I put in my mozconfig:
Code: Select all
# Options for client.mk.
mk_add_options MOZ_BUILD_PROJECTS="myapp"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../myappbase/obj-@CONFIG_GUESS@

#mk_add_options MOZ_MAKE_FLAGS=-j2

# Global options
ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --enable-logging
ac_add_options --disable-tests
ac_cv_visibility_pragma=no

# myapp options
ac_add_app_options myapp --enable-application=myapp
ac_add_app_options myapp --with-libxul-sdk=/usr/lib/xulrunner-devel-1.9.1.5

#java ---- I tried with and without these options
ac_add_options --with-java-include-path=/usr/lib/jvm/java-6-sun/include
ac_add_options --with-java-bin-path=/usr/lib/jvm/java-6-sun/bin

I ran it with a "make -f client.mk build", and my standalone application got compiled,
with a basic XUL UI (buttons, tabs) working too: yeepee!

But now, when I try to embed my Java Applet inside a XUL panel, things get worse..

Here how I load the applet from XUL (I took inspiration from a tutorial explaining it form flash, and my old html code) :


Code: Select all
<html:object classid="java:NiceVisualEffect.class" type="application/x-java-applet" archive="effects.jar">
...
</html:object>



Here is the error:

Code: Select all
Didn't find JVM under /home/jbilcke/checkouts/git/myapp/myappbase/obj-x86_64-unknown-linux-gnu/myapp/dist/bin/xulrunner/plugins
myapp-bin: ../../../../src/plugin/solaris/plugin2/common/JavaVM.c:104: InitializeJVM: Assertion `foundJVM' failed.


I tried various things, but the error is always the same :
- This "plugins" folder already contains a libjavaplugin.so, and sure, a JVM is installed in my machine!
- I tried to manually copy additionnal files inside this "obj-x86_64-unknown-linux-gnu/myapp/dist/bin/xulrunner/plugins" directory:
I made a copy of : libnpjp2.so, libjavaplugin_jni.so
(they were inside my JRE library, installed in the system)
and I tried to copy them in this "obj-x86_64-unknown-linux-gnu/myapp/dist/bin/xulrunner/plugins",
but without success.
- I tried some options in the mozconfig (java dir..)
- I tried to modify the java settings path, through the chrome user preferences : no success too

In fact this is always the same error message (no JVM found inside xulrunner/plugins)

anyone experienced the same issues?
thanks in advance for your help!

jbilcke
 
Posts: 4
Joined: December 16th, 2009, 8:27 am

Post Posted December 21st, 2009, 8:56 am

I somehow isolated the bug a bit.

If I have a simple xulrunner app, with an application.ini:

if I run :
/usr/lib/xulrunner-1.9.1.5/xulrunner application.ini
my application works (the JVM is found, my JAVA applet loads and run, I see the graphics!)

But if I do:

cp -RL /usr/lib/xulrunner-1.9.1.5/ TEST
TEST/xulrunner application.ini

everything is OK except the JAVA applet :

"Didn't find JVM under /home/jbilcke/myapp/TEST/plugins
xulrunner-bin: ../../../../src/plugin/solaris/plugin2/common/JavaVM.c:104: InitializeJVM: Assertion `foundJVM' failed.
Aborted"

(the application crash)

very disturbing.. I don't get it.
Are some absolute path to the JVM hidden somewhere ?

tqft

User avatar
 
Posts: 1231
Joined: April 22nd, 2003, 11:57 pm

Post Posted December 23rd, 2009, 2:00 pm

Maybe an absolute path, maybe not - some trciks to try that occassionally work for me.

Is your xul runner app install (as in make install)? Looks like it might be but if not system may not be finding bits it needs.

Running linux? Run ldconfig (with root privileges) can help
" ldconfig creates, updates, and removes the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib). "

It might be a relative path to the JVM that isn't there when you try from the TEST dir.

jbilcke
 
Posts: 4
Joined: December 16th, 2009, 8:27 am

Post Posted December 23rd, 2009, 3:46 pm

thanks for your suggestions, you're right, my xul runner app is not installed (this is more or less a constraint that we have on our project: try to package as much as possible, if not everything, so it should be able to run on an usb key, by example)

I managed to make my applet working, with this "trick" found on a mailing list :

load the .xul page containing my applet with the FILE protocol: "file://.../mypage.xul" instead of "chrome://../mypage.xul"

still, the immediate downside is that if I do calls to XPCOM from my JS code, in a XUL page loaded in this FILE context, the code is blocked for security reasons, with an "error <file://> forbidden!" in the error console, else the user need to manually authorize it (and click on a dialog button each time the application starts)

So I will look again at this JVM path thing, and hope I will back with a clean solution so it might help others!

Return to Third Party/Unofficial Builds


Who is online

Users browsing this forum: No registered users and 1 guest