Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Determining if Java3D is installed from Applet?  (Read 1368 times)
0 Members and 1 Guest are viewing this topic.
Offline Corysia

Senior Newbie





« Posted 2003-02-21 19:48:16 »

Is this possible to do?  Over the last few days I've been trying to write an applet that will report the version of Java3D installed on the client's machine.  If Java3D is installed, everything works fine.

But I'm unable to gracefully handle the case where Java3D is not installed.  I've tried catching a ClassNotFoundException around creating a VirtualUniverse, but that doesn't work because I throw a ClassDefNotFound before I even enter my init() code.

I've tried dymanically loading the class, but that doesn't work due to the sandbox.
:-/
Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #1 - Posted 2003-02-23 17:59:02 »

trying dumping out the system properties, you might find there is a system property setup to describe the j3d install.

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #2 - Posted 2003-02-23 18:35:57 »

Maybe first check if class VirtualUniverse is available. If so,  ask VirtualUniverse.getProperties().

This will tell you all about version etc..

Later on, you can get more details from a Canvas3D.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
            Map vuMap = VirtualUniverse.getProperties();
        
            Log.logger.fine("version = " +
                           vuMap.get("j3d.version"));
            Log.logger.fine("vendor = " +
                           vuMap.get("j3d.vendor"));
            Log.logger.fine("specification.version = " +
                           vuMap.get("j3d.specification.version"));
            Log.logger.fine("specification.vendor = " +
                           vuMap.get("j3d.specification.vendor"));
            Log.logger.fine("renderer = " +
                           vuMap.get("j3d.renderer") + "\n");

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Play the free demo of Revenge of the Titans!
Offline Corysia

Senior Newbie





« Reply #3 - Posted 2003-02-23 22:21:40 »

Unfortunately, that doesn't work.  That code fragment is exactly what I was trying to do.  But it throws this exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
java.lang.NoClassDefFoundError: javax/media/j3d/GraphicsConfigTemplate3D
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
      at java.lang.Class.getConstructor0(Class.java:1762)
      at java.lang.Class.newInstance0(Class.java:276)
      at java.lang.Class.newInstance(Class.java:259)
      at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
      at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1775)
      at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
      at sun.applet.AppletPanel.run(AppletPanel.java:292)
      at java.lang.Thread.run(Thread.java:536)


As you can see from the stacktrace, there's no point in there when I'm actually in my applet.  This is all the applet loading framework.  It's trying to ensure all the classes are there before it starts the applet.

Another way I tried was to do this:
1  
2  
3  
4  
5  
6  
try {
  Class.forName("javax.media.j3d.VirtualUniverse");
}
catch (ClassNotFoundException e) {
  myApplet.textArea.append("Java3D does not appear to be installed!" + newline);
}


This won't work because of the sandbox.  I get an AccessControlException.

Finally, there are only a few system properties that can be read by the applet.  Again, this is due to security.  Sun talks about this at http://java.sun.com/docs/books/tutorial/applet/practical/properties.html where there's a niftly applet that show's what you can get.

I may have to resort to several applets that load each extension I want to test for and say "Did that work?" on each one of them.  It's very cheesy and not as nice as a single applet that would give a single report.
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #4 - Posted 2003-02-24 08:39:18 »

Quote
1  
2  
3  
4  
5  
6  
try {
  Class.forName("javax.media.j3d.VirtualUniverse");
}
catch (ClassNotFoundException e) {
  myApplet.textArea.append("Java3D does not appear to be installed!" + newline);
}


This won't work because of the sandbox.  I get an AccessControlException.


Ouch, I wasn't aware an applet can't do that. So my method doesn't seem to be appropriate.


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Pops

Senior Newbie




I love YaBB 1G - SP1!


« Reply #5 - Posted 2003-02-24 13:25:53 »

Try this one:

this.getClass().getClassLoader().loadClass("javax.media.j3d.VirtualUniverse")
Offline Corysia

Senior Newbie





« Reply #6 - Posted 2003-02-24 14:10:12 »

No, that's also invoking the ClassLoader.  Applets are forbidden to do that.
Offline Breakfast

Senior Member




for great justice!


« Reply #7 - Posted 2003-02-28 08:59:17 »

This page just suggests you go to a test applet first: http://jdraw3d.herinean.com/ perhaps you'll have to do similar?
Offline alexz

Senior Newbie




Java games rock!


« Reply #8 - Posted 2003-02-28 18:18:29 »

Quote
No, that's also invoking the ClassLoader.  Applets are forbidden to do that.


AFAIK Class.forName("javax.media.j3d.VirtualUniverse") should work in an applet...  at least it did... Cool
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (131 views)
2013-05-17 21:29:12

alaslipknot (140 views)
2013-05-16 21:24:48

gouessej (170 views)
2013-05-16 00:53:38

gouessej (164 views)
2013-05-16 00:17:58

theagentd (174 views)
2013-05-15 15:01:13

theagentd (159 views)
2013-05-15 15:00:54

StreetDoggy (203 views)
2013-05-14 15:56:26

kutucuk (227 views)
2013-05-12 17:10:36

kutucuk (227 views)
2013-05-12 15:36:09

UnluckyDevil (230 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.147 seconds with 21 queries.