This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I imported the source in Eclipse as an existing project, but when I try to run the game, it throws the following errors:
Exception in thread "Thread-3" java.lang.IllegalArgumentException: input == null!
I would appreciate any help anyone can provide to teach me how to properly run this code.
Also if anyone knows a good tutorial on how to start making games in Java, I would appreciate it. I am currently just using the first couple links off of a google search to try to teach myself.
You have got well-written code there, which protects itself from having nulls passed to it. And you have passed it a null. Please inspect the code round the line number shown, and where it was called from. Then you can find where the null comes from.
I copied the images and other resources for the game into the main game package and then deleted the / on "/icons.png" and now it is working...I don't know why it was set up like this and why it had to be changed...but at least it works now
Except now none of the other resources work, because I need to find the slashes (/) in front of the resource names and delete them
Can anyone explain how to properly set/call the path to my resources in java/eclipse?
Go to "Run->Run configurations..." (in case of debug "Run->Debug configurations...")
Open Run (Debug) configuration which you use
Open "Classpath" tab
Select "User Entries" and click "Advanced..." on the right
In the opened window select "Add folder", point to your src/test/resources
Thanks for your help
Joined: Aug 05, 2005
Charles Olson wrote:Sorry if the solutions seem "obvious" to you...obviously they don't seem so to me
I didn't say the solution was obvious, I said the problem was.
The original error was
Exception in thread "Thread-3" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1348)
The code you posted later
showed that that exception would be thrown when the input variable is null. That's how I knew what the problem was.
Maybe how I knew that you needed to look at how the method was called from line 118 of Game.java was not quite so obvious. I'll explain.
If you go back to the stack trace, you will see from the second line that the exception was thrown from line 1348 of ImageIO.java (that's what the bit in brackets mean). Go to the next line and you see that the read method was called from line 118 of Game.java. Keep following the stack trace like that and you will find the path that was followed by the code. Learning how to read stack traces is a very useful for debugging.
For anyone looking at this, in the source code I got I followed the above instructions but pointed the folder just at res not src/test/resources. Question though, could anyone explain to me what this step is even doing?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Minicraft - 2D Java Game - Help for Beginner