Cannot find symbol variable:rootNode class:mygame.Main

Hi i have a nooby question like all of my questions i am getting a"Cannot find symbol

variable:rootNode

class:mygame.Main



rootNode.attachChild(box1);

^…^



Im pretty sure that this is how you attach the Child to the scene and i keep getting this exception when i am trying to attach my box to the scene. It works fine in a simple application and i feel the reason it wont work in a application is because since the simple application implements these things automatically that i need to import something. I have tried to import"import com.jme3.scene.Node and also scene.Spitial and it did nothing i also tried a public static void Node(String[] args) {

Node rootNode = new Node();

Thanks in advance

Use SimpleApplication. Otherwise you have to write a bunch of code to do the stuff that SimpleApplication is doing for you. It’s not about “what to import”. It’s about a lot of code to make your life easier that is missing when you don’t use it.

okay how do i go about making a backround of the scene say blue instead of black? Also how do i go about changing the introduction window from jme3 to a custom color. Since im able to use simpleapplication i can really start adding some things i have allready added my directonal light to a new code and plan on making some custom controls i may need some help here and there but im serious about my idea and learning so bare with me and withing the next year i should have something to show you! Oh and thanks Paul for all your help!

@gray561 please start a new thread if you need help with a different topic than the one stated in the topic header. A lot of new users such as yourself come to this forum with similar questions. By keeping different topics separated, you ensure that the developers’ helpful answers are relevant to the terms that new users will the searching for.

Okay ill try my best.:slight_smile:

Can you implement things like directonal sinlight in the SimpleApplication? Because i have a yello directonal light set up to my game and it will not show up in the dialog box. The sunlight code is here i have no errors at all



DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(1,2,1).normalizeLocal());

sun.setColor(ColorRGBA.Yellow);

rootNode.addLight(sun);



like i said here the node is attached and everything but i donot see the light i am still wondering about the backround of my scene ass well. Thanks!

Are you using a material that is affected by light? Which material?



Have you run through the JME tutorials?

Im not sure if it is affected by light i thought that this would light the map with a distinct light source i guess i am wrong? Yes i have gone through some of the jme tuts i got up to a point. I just got to a point in the tuts were i wanted to just go at things i am learning though. I guess ill go through the whole jme class and then come back when i know more. right now im at the point in my mind that i can code but i have trouble putting it together…its kinda like i understand the abc’s but not the words. Thanks ill go over those and reply later!

Hi i am going over the tutorials and i keep getting this problem i copy the code to my jme and i build and run the code the window opens i press run i see a black screen then the display closes? This does this on the hello assets and hello node examples. I was just wondering how i can get this to work thanks!

Were there any errors in the log?

any errors in th log, not a single one it completes successfully everytime. it seems almost like if i surpass 2mbs i get this error its quite odd

Hey just letting you guys know i am still getting this problem and i have no idea what the problem is theres no errors or anything the jme window loads i press ok to start the program and the display closes as if i pressed Esc so i have no idea

Hey guys along with the other question i have another its about the jmonkeyengine well sorta…Okay so i have my main class which includes my simple application and my simpleInitApp for my objects and models ect i then have a second main class which is for my geomap terrain code i have two because i cannot extend the Main class twice. I get no errors in my codes i build the file and run the application that i called Basicgame1 it loads i get a window press okay it loads up my models and objects are there but there is no geomap? do i have to attach the terrain to the simple application… i have no idea whats going on… ill post the code if asked thanks!

You should not have two main classes. You should break your application up into logical objects… not just random ones that all need the same stuff.



For example, you could have a Main class that extends application and a GeoTerrain class that does your geomap terrain code and is provided the other stuff it needs to do its job… or returns a node that the main application should use. I don’t know enough about it to advise further and anyway, there are any number of ways to skin this particular cat.



I feel it necessary to point out that this kind of logical break down of an object oriented program is such a fundamental concept in development that I fear you will not get very far unless you start somewhat smaller and learn these very basic concepts. If feels like you are doing the Nietzsche equivalent of trying to fly before you’ve even figured out what your legs and arms are for, let alone crawling then walking.



I strongly encourage you to sit down with more general Java books or tutorials and work through some examples until things click. It will save you years of time later.

I would love to learn rather than trying to fly with my floaty ;). I just don’t know were to start i am very confused and i know that if i learn i can exeed your thoughts of what i can do :). I have looked at some tutorials as i have said but 1 the codes are not working with me and 2 i feel im in the purgitory of programming if you will i am starting to learn the basic concepts but am stuck at that point…I will take your advice and come back when i comprehend the basics and then we may have something to go by. Again Paul you have been of great help to me and have been very understanding and patient these are things a really admire in a person and am very glad that you are willing to help me along the way and not just leave me behind. Thankyou!

Everyone has to start somewhere. I don’t think any of use were born fully understanding how to program in Java. :slight_smile:



I have not been through this series personally, but usually JavaWorld is pretty good: http://www.javaworld.com/javaworld/jw-04-2001/jw-0406-java101.html



It’s a seven part series that seems pretty comprehensive on Object Oriented concepts in Java.

  • Part 1: Learn how to declare classes and create objects
  • Part 2: Declare and access fields and methods
  • Part 3: Composition: Build objects from other objects
  • Part 4: Inheritance: Build objects in layers
  • Part 5: The root of all classes
  • Part 6: Use interfaces for safe multiple inheritance and a great deal more
  • Part 7: Learn about Java’s many shapes and find out how to accommodate generalities in your class hierarchies



    Go through all seven of those and try the examples they build. Going through the few I looked at, I already see it might encourage some questionable idioms but you shouldn’t worry too much about that at this stage. The details will work themselves out later.



    I’m sure there may be other good articles but those were the first I pulled up on a google search for “Java object oriented programming” that looked somewhat appropriate.