Need strategy for deploying a Java-OpenGL program on the web

Hi Everybody,
I’m new to this forum, so excuse my errors. I’m Joe Capowski from Chapel Hill, NC and I write
software for neuroscience. I’m stuck on an issue and need some strategic help, please.

I need to deploy a Java program (applet or application – don’t care which) on the internet, so that users
can see 3D views of neurons and rotate them with a mouse. I’ve successfully deployed a number of
Java applets that don’t use openGL, but I can’t figure out how to use openGL with an applet. Additionally,
I’ve written many Java applications that use openGL, but have never figured out how to put them on the web
for others to use.

Which path should I take, applet or application? If applet, how do I use openGL with it? If application,
how do I deploy it?

I program with the NetBeans IDE, version 6.1, which comes equipped with the
necessary JOGL bindings that allow me to access openGL methods from the Java language.

Any ideas?

would recommend that you try java web start.

hi capowski,

please take a look at the JNLPAppletLauncher:
https://jogl-demos.dev.java.net/applettest.html

this can be seen as “best practice” for applet/webstart JOGL deployment.

we currently don’t have a runnable sample in the NetBeans OpenGL Pack which demonstrates this but you should find the sources for the test jogl applet in the official JOGL demos.
http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1-rc8/jogl-demos-src.zip

To enable java webstart with the demos contained in the opengl pack, replace the “nbproject/build-jogl-template-impl.xml” with https://netbeans-opengl-pack.dev.java.net/files/documents/6933/90926/build-jogl-template-impl.xml and add the following code to your “build.xml”


    <!--

    This is a predefined jnlp target to trigger the jogl-template specific
    patches to the file generated by netbeans webstart support.

    -->
    <target name="jnlp" depends="-jogl-template-jnlp">
    </target>

After that you can just use netbeans build-in webstart support, by opening your projects properties (right click on the root node in the “Projects” window) and check “Enable Web Start” in the “Application/Web Start” category.

hi, I happened to have the same exact problem as the original poster on this thread.

I followed the instructions (using the SimpleJOGL demo) and it doesn’t work… (but the regular application does work).

I’m using the latest Netbeans (6.1 beta downloaded just now) and the latest jogl pack .nbm (also just downloaded and installed) on Ubuntu.

Can you help me figure out what I am doing? It seems like there is a java.library.path error-- but isn’t the point of the opengl pack to resolve the libraries automatically? Here’s the automatically created launch.jnlp file:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:/home/angus/NetBeansProjects/SimpleJOGL/dist" href="launch.jnlp">
    <information>
        <title>SimpleJOGL</title>
        <vendor>angus</vendor>
        <homepage href=""/>
        <description>SimpleJOGL</description>
        <description kind="short">SimpleJOGL</description>
    </information>
    <resources>
        <j2se version="1.5+"/>
        <jar href="SimpleJOGL.jar" main="true" download="eager"/>
        
        <extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp" />
    </resources>
    <application-desc main-class="org.yourorghere.SimpleJOGL">
    </application-desc>
</jnlp>

here’s the error I get:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.javaws.Launcher.executeApplication(Launcher.java:1272)
	at com.sun.javaws.Launcher.executeMainClass(Launcher.java:1218)
	at com.sun.javaws.Launcher.doLaunchApp(Launcher.java:1065)
	at com.sun.javaws.Launcher.run(Launcher.java:105)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: no jogl in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
	at java.lang.System.loadLibrary(System.java:1030)
	at com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189)
	at com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49)
	at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:80)
	at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103)
	at com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49)
	at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:111)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.opengl.impl.NativeLibLoader.loadCore(NativeLibLoader.java:109)
	at com.sun.opengl.impl.x11.X11GLDrawableFactory.<clinit>(X11GLDrawableFactory.java:101)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:111)
	at javax.media.opengl.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:520)
	at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:131)
	at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:90)
	at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:83)
	at org.yourorghere.SimpleJOGL.main(SimpleJOGL.java:22)
	... 9 more

I’m using the build-jogl-template-impl.xml file downloaded from cylab’s posting just above this, and I have modified my build.xml to include the jnlp target.

Thanks in advance for your help!

-sj

That’s strange. Can you please check your dist directory, if it contains a jogl.jar or some natives (.so). If the patch works correctly, there should be only the SimpleJOGL.jar and no jars under libs. Please also check, if you have jogl jars and .so files in your JREs folder (ext/lib, bin - some tutorials on the web suggest to put it there, which unfortunately causes this problems) and if yes, remove them. At last, open your Java control panel and remove all entries in the Internet/JWS cache (at least the ones related to jogl).

Edit: If you haven’t already, please make a clean build after enabling the webstart option for your project to get rid of the redundant files in dist.