Apress / java-game-dev-LibGDX

Source Code for Java Game Development with LibGDX by Lee Stemkoski
Other
102 stars 74 forks source link

Chapter3 ClassNotFoundException #2

Open Xombie404 opened 3 years ago

Xombie404 commented 3 years ago

If someone following along with Ch.3 on page 69, isn't using blueJ, they have are highly likely to run into this error, The solution I found was instead of the line:

Class theClass = Class.forName(className);

they should instead use

Class theClass = Class.forName("com.mygdx.game." + className);

I just wanted to make sure any people who struggle with this issue will be able to find a solution quicker than I did.

This worked for me, since I'm using Eclipse

mevanmaele commented 3 years ago

Same problem and solution using Visual Studio Code and the Maven packages for LibGDX.

marc9323 commented 2 years ago

ditto for android studio... just prefixed with package and was fine

Jdevsecops0x00 commented 1 year ago

@Xombie404 you have saved me today. I was struggling for hours now until I came across this. I'm using IntelliJ, but can I get a little clarification as to why this happens???....

Xombie404 commented 1 year ago

@Jdevsecops0x00 I forget the context for this, just got an email saying people replied to this, I tried looking around for my book and can't find it, I think it had something to do with bluej simplifying something my IDE wasn't simplifying involving packages. Its been so long and to be honest I think I just intuited what is essentially a bandaid on something I don't understand about java. I'm sorry I can't be more helpful, I'll keep looking for the book, but I ultimately settled on using godot later on and have been doing way better learning gamedev so far. Good luck friend