Curious tutorial Q

I've been messing about with the jME tutorials a bit and I'm curious about something. The tutorial code I'm using is from the CVS, which I update and compile on a regular basis. My jdk version is 1.5.0_06-b05. I use jGRASP, http://www.jgrasp.org as the IDE and set all my classpath and lib paths on a "per project" basis. BTW, if you're not using jGRASP, you're missing out on some very cool code analysis and debugging tools. I highly recommend it!



Anyway, here's my observation using HelloStates.java as an example;



If I compile HelloWord.java "as is" from the source and run it, it works perfectly.



If I change line 99 from "l.setDiffuse(ColorRGBA.red)" to "l.setDiffuse(ColorRGBA.blue)", recompile and run, the light color stays red.



If I comment out line 33 "package jmetest.TutorialGuide" to "//package jmetest.TutorialGuide", recompile and run, the light color changes to blue, and the texturing on the cube disappears!



[EDIT]

Hmm, changing line 52 to

Well, if I change the colour, the change is instantanious here. Since you're runing from CVS, you shouldn't have any jars from the jME project itself (only LWJGL, JOrbis, etc) on the classpath. Maybe you have those somewhere, and the HelloStates in that jar package gets run instead. That would explain why it works if you change the package name.



But I'm confused… I also don't see "…/data/images/Monkey.tga" in CVS or in the wiki. It's already ""jmetest/data/images/Monkey.tga"

Hi llama… Well, I think I know what I did. I had created a separate directory and copied the originial tutorial files into it so I wouldn't modify the originals. I then copied the "data" directory from the CVS into the same tree, one level up, ie; …/data and changed the code to look there for images, etc. That's were the "monkeyLoc=HelloStates.class.getClassLoader().getResource("…/data/images/Monkey.tga");" line came from.



Evidently something in the "package jmetest.TutorialGuide" doesn't like the new directory structure…



Using jGRASP allows me to set the classpath and lib paths for each project so I'm using the jars are in the CVS tree. I know I don't have any other jme related jars anywhere else.



Thanks for your feedback tho'. I'm really enjoying Java and the jME in particular. Cheers!  :slight_smile:

Most IDE require the directories you use to mirror the package structure. Having 2 copies of the same file floating around could lead to the issues you have (the wrong one will end up being used). Most IDEs will give an error though these days if you have such a conflict.

True enough.  :slight_smile:



I've got another Q… what is the relavance of "package jmetest.TutorialGuide"? I've seen it used in Python and I can understand the "import" directives in Java but "package" is just not clicking with me. 

Well that's really a Java beginners question. I suggest getting a good book for Java beginners, or finding some good tutorials online. Maybe you can open a topic in the Offtopic forum asking for some good ones.

Thx for the advice but I do have several good books on the subject.  :slight_smile:



"Packages are directory structures used to organize classes and interfaces" to quote from one.



I'll continue to work it out until I get a handle on it…  8)

Well a book should be able to explain it better than me, that's why I suggested it :slight_smile:

:smiley: