Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 1502 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

JGO Kernel


Medals: 85
Projects: 22


Coder, Trainee Pixel Artist, Game Reviewer


« 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!
Legends of Yore - The Casual Retro Roguelike
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.

 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (75 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!