the getResource() (or getResourceAsStream()) method will look for the named resource in any folders specified in your classpath. so, what i have done is put my resource folder in my classpath and any resources i'm accessing are named off of my resource folder.
java.net.URL url = super.getClass().getClassLoader().getResource("$CLASSPATH/resource"); try this. sean > -----Original Message----- > From: Chris Forrester [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 19, 2002 8:07 PM > To: [EMAIL PROTECTED] > Subject: [JAVA3D] Help on the final few things please? 'nix developers > feedback appreciated. > > > Hey All.. I'm almost totally done my demo > http://www.geocities.com/Psionic1981 > > and i need pointers on a few things which others have requested: > > (1) File path vs. URL > > I want to make the game playable on 'nix boxes, and a few > have suggested > that a URL ("oos/...") resource is the way to go, rather than > hard filenames > ("c:\oos\...") > > so i need to know how to get which directory the file is > loading up from. > examples from javaworld point to using > URL myPath = > this.getClass().getClassLoader().getSystemResource(this.getCla > ss().getName()); > > but doing this through forte's build and the jar compiled version just > doesn't work - the URL returned is null. What's going wrong > here? Better > than that... anyone have any code? I'm just basically looking > for the path > to the jar so that i can go to the (appPath)/meshes/ > directory and load all > the graphics. > > (2) Missing Swing components when config app executed from jar. > > For my configuration swing applet, I can run the program fine > in forte, yet > when executing from a packaged jar, i'm getting a > java.lang.NoClassDefFoundError: > org/netbeans/lib/awtextra/AbsoluteLayout > > which is the layout i'm using in my gui app, to precisely > control what goes > where. I was under the assumption that jars and forte dev > shared the exact > same classpaths... what am i missing here? > > > These are all that are left to hammer out > (java.lang.outofmemory errors when > players > 5 nonwithstanding). 2 player games have run for a > few days without > a single crash. > > ------------------------ > > Chris Forrester > > http://www.geocities.com/Psionic81 > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > ============================================================== > ============= > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body > of the message "signoff JAVA3D-INTEREST". For general help, > send email to > [EMAIL PROTECTED] and include in the body of the message "help". > ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".