Page 1 of 2 12 LastLast
Results 1 to 20 of 25
  1. #1
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default Add 3D applet to html page

    I want to put a 3D applet into a html page, without download the plugin.
    like: Lissajous figures, a 3D java applet

    I don't know the source code of that program, but it is java3D and don't have special attributes on the source.

    I think the applet load some libraries from internet.

    Does someone know how I can add a 3D applet into a html page.

    Thanks,
    Dennis

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    The browser needs a JVM to run any applets in an html page.

  3. #3
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    I think IE have a JVM in it.
    And I can run not-3D applets at IE.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Are there any error messages in the browser's Java console?

  5. #5
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    When I run my applet on IE i got this error on the browser's Java console:
    Java Code:
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/media/j3d/Canvas3D
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: javax/media/j3d/Canvas3D
    	at java.lang.Class.getDeclaredConstructors0(Native Method)
    	at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    	at java.lang.Class.getConstructor0(Unknown Source)
    	at java.lang.Class.newInstance0(Unknown Source)
    	at java.lang.Class.newInstance(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	... 14 more
    Caused by: java.io.FileNotFoundException: D:\workspace\3d\2\1\bin\javax\media\j3d\Canvas3D.class (The system cannot find the path specified)
    	at java.io.FileInputStream.open(Native Method)
    	at java.io.FileInputStream.<init>(Unknown Source)
    	at java.io.FileInputStream.<init>(Unknown Source)
    	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	... 17 more
    Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/media/j3d/Canvas3D

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Where is the javax.media package defined? Is the jar file with those classes available to the browser?

    What classes does your applet use?


    When I scan the physics.jar file used by the link you provided I see it uses the following classes:
    #Searching C:\Temp\physics.jar for Lissajous
    Lissajous
    java/applet/Applet
    java/awt/BorderLayout
    java/awt/Button
    java/awt/Checkbox
    java/awt/Color
    java/awt/Component
    java/awt/Container
    java/awt/Dimension
    java/awt/event/ActionListener
    java/awt/event/AdjustmentListener
    java/awt/event/ItemListener
    java/awt/event/MouseEvent
    java/awt/event/MouseListener
    java/awt/event/MouseMotionListener
    java/awt/GridBagConstraints
    java/awt/GridBagLayout
    java/awt/Image
    java/awt/Insets
    java/awt/Label
    java/awt/Panel
    java/awt/Scrollbar
    java/lang/String
    java/lang/StringBuffer
    java/util/EventObject
    timeBase
    java/awt/Button
    java/awt/Component
    java/lang/InterruptedException
    java/lang/Math
    java/lang/Object
    java/lang/Runnable
    java/lang/System
    java/lang/Thread
    Lissajous
    View
    java/awt/Canvas
    java/awt/Color
    java/awt/Component
    java/awt/Dimension
    java/awt/Graphics
    java/lang/Math
    java/lang/String
    java/lang/StringBuffer
    View

    # Found 35 classes.

  7. #7
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    :o That Lissajous file is not a official java3D applet.

    I use the original libraries "j3dcore.jar", "j3dutils.jar", "vecmath.jar".
    but it is possible to create an applet with that 3 libraries (without downloading the java3D plugin).

    At the java 3d site on the following page: https://java3d.dev.java.net/applets/FourByFour.html

    That's a working java 3D applet

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Sorry, I don't know about the java3D plugin.
    You can have more than one jar file on the <APPLET tag's archive= attribute

  9. #9
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    I've allready tried to add all librarie jars to the applet tag, but that won't work.

    A 3D program works as JFrame, when I export all classes (changes JFrame classes) and 3D libraries to an jar and put the .dll files in the same directory of the jar file the jar file works, but when I do the same with the applet:
    Put all classes with the .dll file and unpacked 3D libraries in a folder and create a .html page for that applet and run it, i got that error.

    Do you or someone else know why it works as JFrame but not as applet?

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    tried to add all librarie jars to the applet tag, but that won't work.
    What errors do you get?

  11. #11
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    When I add:
    Java Code:
    <applet code="java3DTest.class"
            width="800" height="500"
            archive="http://download.java.net/media/java3d/webstart/test/j3d-examples.jar,
                     http://download.java.net/media/applet-launcher/applet-launcher.jar,
                     http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dcore.jar,
                     http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dutils.jar,
                     http://download.java.net/media/java3d/webstart/release/vecmath/latest/vecmath.jar,
                     http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
                     http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">
        <param name="codebase_lookup" value="false">
        <param name="subapplet.classname" value="org.jdesktop.j3d.examples.four_by_four.FourByFour">
        <param name="subapplet.displayname" value="Java 3D Four by Four Applet">
        <param name="jnlpNumExtensions" value="1">
        <param name="jnlpExtension1" value="http://download.java.net/media/java3d/webstart/release/java3d-latest.jnlp">
        <param name="progressbar" value="true">
        <param name="noddraw.check" value="true">
    </applet>
    Then I got the error:
    Java Code:
    load: class java3DTest.class not found.
    java.lang.ClassNotFoundException: java3DTest.class
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: java3DTest.class
    but I don't know why it can't find the java3DTest.class

  12. #12
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Dennis View Post
    I've allready tried to add all librarie jars to the applet tag, but that won't work.

    A 3D program works as JFrame, when I export all classes (changes JFrame classes) and 3D libraries to an jar and put the .dll files in the same directory of the jar file the jar file works, but when I do the same with the applet:
    Put all classes with the .dll file and unpacked 3D libraries in a folder and create a .html page for that applet and run it, i got that error.

    Do you or someone else know why it works as JFrame but not as applet?
    How did you add them to the "Applet" Tag. Show that HTML extract. Hopefully using either the ARCHIVE tag, properly.

    APPLET - Java Applet and The APPLET Tag and Deploying With the Applet Tag (The Java™ Tutorials > Deployment > Applets)

    Or by using "CODEBASE" and having all classes "unarchived" in the same place

    Or with JNLP

    Java Network Launch Protocol (The Java™ Tutorials > Deployment > Deployment In-Depth)

  13. #13
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    class java3DTest.class not found.
    Remove the .class from code="java3DTest.class"

  14. #14
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    Then I get the same error

  15. #15
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Can you please post the full text of the error message?
    I don't think you would get the same error message without the .class.
    The message should be:
    java.lang.ClassNotFoundException: java3DTest

    Look in the jar file and verify that the java3DTest.class file is there with no path.

    I get the following error message:
    load: class WayPointsApplet not found.
    java.lang.ClassNotFoundException: WayPointsApplet
    with the following HTML:
    <P><APPLET CODE="WayPointsApplet" NAME=WayPointsApplet WIDTH=380 HEIGHT=320 ALIGN=bottom archive="WayPoints.jar">

  16. #16
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    Java Code:
    Exception: java.lang.ClassNotFoundException: java3DTest.class
    java.lang.SecurityException: trusted loader attempted to load sandboxed resource from file:/D:/workspace/3d/2/1/bin/file.jar
    	at com.sun.deploy.security.CPCallbackHandler$ParentCallback.check(Unknown Source)
    	at com.sun.deploy.security.CPCallbackHandler$ParentCallback.access$1400(Unknown Source)
    	at com.sun.deploy.security.CPCallbackHandler$ChildElement.checkResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
    	at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.SecurityException: trusted loader attempted to load sandboxed resource from file:/D:/workspace/3d/2/1/bin/file.jar
    is the error I get when I set it in a .jar file and with the all needed 3d libraries set as archive for applet in html page

  17. #17
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    Sorry, I need more info.
    What does the <APPLET tag look like? I think the .class at the end of the code= can be wrong.
    Where is the html file loaded into the browser from?
    Where are all the jar files and html located?

  18. #18
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    My have create a not-3D applet before and that works, but now it is a 3D applet it can't find the class.

    All librarie and needed jar files are located ad the java3d.dev.java.net, the html file is located local.

  19. #19
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    What does the <APPLET tag look like?

    jar files are located ad the java3d.dev.java.net
    Can you put ALL of the files in the same folder? jar and html

  20. #20
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    Now I add to the html page:
    Java Code:
    <applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
            width=800 height=400
            archive="j3d-examples.jar,
    		 zip.zip,
                     http://download.java.net/media/applet-launcher/applet-launcher.jar,
                     http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dcore.jar,
                     http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dutils.jar,
                     http://download.java.net/media/java3d/webstart/release/vecmath/latest/vecmath.jar,
                     http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
                     http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">
        <param name="codebase_lookup" value="false">
        <param name="subapplet.classname" value="lesson01.lesson01">
        <param name="subapplet.displayname" value="lesson01">
        <param name="jnlpNumExtensions" value="1">
        <param name="jnlpExtension1" value="http://download.java.net/media/java3d/webstart/release/java3d-latest.jnlp">
        <param name="progressbar" value="true">
        <param name="noddraw.check" value="true">
    </applet>
    than I got the message on the progressbar of the JNLP appletlauncher:
    Java Code:
    Error: Unable to start lesson01.lesson01
    But now it don't give a "cannot find" error

Page 1 of 2 12 LastLast

Similar Threads

  1. redirect to html page
    By simo_mon in forum Java Servlet
    Replies: 3
    Last Post: 02-12-2009, 05:18 PM
  2. Replies: 0
    Last Post: 03-10-2008, 02:36 PM
  3. How to view applet from html page.
    By jwzumwalt in forum Java Applets
    Replies: 2
    Last Post: 11-24-2007, 04:21 AM
  4. HTML page
    By bbq in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 03:46 AM
  5. Create a Applet in the page HTML
    By Daniel in forum Java Applets
    Replies: 2
    Last Post: 07-04-2007, 07:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •