Skip to main content

3D object file not found - why?!!!! Please help!

2 replies [Last post]
Joined: 2007-09-18

This has been puzzling me for a while now and I would really appreciate some help:

Here's the error message:
" jar:file:\E:\WindowsStuff\My%20Games\Tests\ThreeDTest\ThreeDTest.jar!\firstObject.obj (The filename, directory name, or volume label syntax is incorrect)"

And here's the relevant code snippet:
testGameObject = new GameObject3D(getClass().getResource("firstObject.obj").toString());

GameObject3D is a class I've written that loads a 3d .obj file, 'firstObject.obj' is inside 'ThreeDTest.jar' along with the relevant classes and is also signed(unofficially).

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-06-27

There's a couple of ways to do this for sure, and each way is picky about syntax, etc.

The best way I have found that works both in development and then later when you make a jar is:

private String m_sFilename = "ship.obj";
private URL m_urlFilename = null;

m_urlFilename = this.getClass().getResource(this.m_sFilename);

ObjectFile f = new ObjectFile();
Scene s = null;

s = f.load(this.m_urlFilename);

catch (FileNotFoundException e)

Last thing you ned to do is make sure that you add a classpath entry to your .classpath pointing to where you have the .obj such as:

It took me a couple of days of trial and error to get it working but it works perfect for me...

Hope that helps!

Joined: 2007-09-18

Problem solved!! Thank you very much :)

P.S. I didn't need that last part about the '