^---- I say how you can set the main class. You can also press shift-F6 to run the currently opened file.
ahh shift F6. I tried Fn F6 before as well when it wasnât working. Now i now. Thanks for the tipsâŚ
Or you simply set the main class (or which you only have one in a normal project, for a tutorial project you might have multiple though).
thats good to know too because sometimes when you are troubleshooting, you are not thinking of all of thatâŚ
I would spend hours, days, months or even years and would never guessed heâs problem was wrong main classâŚ
Well this is why we are sometimes quick to dismiss issues - we have all kinds of experience with how people sabotage themselves
Standard debug procedure that will save you years and years on your life:
âGee, I made a change in the code but nothing happened in my app.â
âI think Iâll add a System.out.println(âKilroy was here.â) to even see if itâs running.â
âHmmm⌠no println.â (looks for cause of not actually running new code)
I donât know how many times Iâve helped developers with this exact same problem⌠from newbs up to senior devs, custom apps, Java, C++, whatever, all the way up to enterprise deployments. âI changed this code but nothing happenedâŚâ They think Iâm amazing or something but it seems kind of obvious to me at the time. But in this case, I know enough about JME to wonder âWhere else would the color blue come from?â There really could only be one answer (and ATI drivers arenât it).
Anyway, I call it âKilroy debuggingâ and it has saved my life many times.
After a couple of reading on WIkipedia, I understood why âKilroy debuggingâ.
thatâs not fair fellas. I clicked on the green button and that buttonâs responsibility is to run the program. Therefore, it didnât do what it was intended to do. The fact that i had to go and right click which is an additional step, by the way, was unknown to me. I typically donât do that with any IDEâŚ
Any other IDE, the button used to run the program, will run the program in which it is intended to run so perhaps that issue should be addressed in this environment as far as a usability concern for newbies like myself.
And for the record, I do include System.out.println(âstatementsâ) in my code when Iâm troubleshooting but the issue was I didnât understand why it wasnât accepting my changes. Please understand I am brand new to this jmonkey environment as well as graphic design so donât take shots at me while I am trying to learnâŚ
In a normal game or program, you only have 1 main class. However, since now youâre doing tutorials, every class can be the main class. I always do this:
Tutorial - Shift - F6
My Game - F6
It did run the program. It ran the main class configured for the project. If you change the main class configured for the project to your new main class then it will run that.
I wasnât taking shots. As I said, this is such a very common occurrence that there is a technique for finding it. And how many people read this thread and didnât figure it out even though all of the evidence was there?
Took me several posts, too.
Kool. its OK. maybe I was being sensitive because I was frustrated as to why it wasnât working and staying up late trying to fix itâŚ
No worries. Iâm just happy its working nowâŚ
To be fair, the tutorial specifically says that youâre supposed to right-click and run the file
I saw at the bottom of the code, build and run the file. The only places I saw to right click was when you have to navigate to add the librariesâŚPerhaps I missed itâŚ
First tutorial, âHello SimpleApplicationâ â
Right-click the HelloJME3 class and choose Run. If a jME3 settings dialog pops up, confirm the default settings.
You should see a simple window displaying a 3D cube.
Press the WASD keys and move the mouse to navigate around.
Look at the FPS text and object count information in the bottom left. You will use this information during development, and you will remove it for the release. (To read the numbers correctly, consider that the 14 lines of text counts as 14 objects with 914 vertices.)
Press Escape to close the application.
Congratulations! Now letâs find out how it works!