Texture loading problem

Hi,



i have the cvs checkpout from today and wanted to run the hellostates tutorial.

I have adjusted the path and everything but the texture will not load.

Any hint?



my code:

URL monkeyLoc;

  monkeyLoc=HelloStates.class.

  getClassLoader().getResource(

  "/home/sue/Privates/bilders/gambit.png");

  // Get a TextureState

  TextureState ts=display.getRenderer().createTextureState();

  // Use the TextureManager to load a texture

  Texture t =

  TextureManager.loadTexture(monkeyLoc,

  Texture.MM_LINEAR,

  Texture.FM_LINEAR);

  // Assign the texture to the TextureState

  ts.setTexture(t);



the konsole output:

4.10.2006 14:32:16 com.jme.app.BaseGame start

INFO: Application started.

04.10.2006 14:32:16 com.jme.system.PropertiesIO <init>

INFO: PropertiesIO created

04.10.2006 14:32:16 com.jme.system.PropertiesIO load

INFO: Read properties

/usr/share/themes/Human/gtk-2.0/gtkrc:70: Engine "ubuntulooks" is unsupported, ignoring

/usr/share/themes/Human/gtk-2.0/gtkrc:240: Priority specification is unsupported, ignoring

04.10.2006 14:32:19 com.jme.input.joystick.DummyJoystickInput <init>

INFO: Joystick support is disabled

04.10.2006 14:32:19 com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

04.10.2006 14:32:19 com.jme.system.PropertiesIO save

INFO: Saved properties

04.10.2006 14:32:19 com.jme.app.BaseSimpleGame initSystem

INFO: jME version 0.11 beta

04.10.2006 14:32:19 com.jme.app.BaseSimpleGame initSystem

INFO: Running on: null

Driver version: null

04.10.2006 14:32:20 com.jme.renderer.lwjgl.LWJGLRenderer <init>

INFO: LWJGLRenderer created. W:  640H: 480

04.10.2006 14:32:20 com.jme.renderer.AbstractCamera <init>

INFO: Camera created.

04.10.2006 14:32:21 com.jme.util.lwjgl.LWJGLTimer <init>

INFO: Timer resolution: 1000 ticks per second

04.10.2006 14:32:21 com.jme.scene.Node <init>

INFO: Node created.

04.10.2006 14:32:21 com.jme.scene.Node <init>

INFO: Node created.

04.10.2006 14:32:21 com.jme.scene.Node attachChild

INFO: Child (FPS label) attached to this node (FPS node)

04.10.2006 14:32:21 com.jme.scene.Node <init>

INFO: Node created.

Could not load image…  URL was null.

04.10.2006 14:32:21 com.jme.scene.Node attachChild

INFO: Child (my box) attached to this node (My root node)

04.10.2006 14:32:21 com.jme.scene.Node attachChild

INFO: Child (My sphere) attached to this node (My root node)

04.10.2006 14:32:21 com.jme.scene.Node attachChild

INFO: Child (My root node) attached to this node (rootNode)

04.10.2006 14:32:22 com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

04.10.2006 14:32:22 com.jme.app.BaseGame start

INFO: Application ending.

It can't find the image…  In your path, is bilders perhaps supposed to be builders?

I know it can'T find the url but it is supposed to find it because it is absolute path and it's the correct adress.

I used ls to test

You are trying to use an absolute fiel path for classpath resource lookup. This is not ok until you filesystem root path / is in classpath.

Instead of:

URL monkeyLoc;
  monkeyLoc=HelloStates.class.
  getClassLoader().getResource(
   "/home/sue/Privates/bilders/gambit.png");


use something like:

File file = new File("/home/sue/Privates/bilders/gambit.png");
URL monkeyLoc = file.toURL();

Jup got it.



Figured another way out but thanks for that I almost forgot that I can use File to get the URL