[java] new to java, having some trouble

Started by
3 comments, last by 5MinuteGaming 17 years, 8 months ago
well iv recently been trying to get into java, I am using this tut http://www.gamedev.net/reference/articles/article1360.asp, i have done the first one with good success after i posted here for some help. with the second tutorial on this though when i try to compile the samplethread that he talks about and give the code i get the error. C:\Program Files\Java\jdk1.5.0_07\bin>javac SampleThread.java SampleThread.java:25: cannot find symbol symbol : class Graphics location: class SampleThread public void paint(Graphics g) ^ 1 error i get no .class file when i do this. does anyone know what might be wrong?
Advertisement
i highly recommend starting here. you should also check out netbeans.

oh, and you need to import java.awt.Graphics, i believe.
This space for rent.
yah the jdk i downloaded had a version of netbeans with it. i tried it but didnt really like it. unless theres somthing better about it for when there are more advanced codes. thanks for the help ill check out some of the tuts of the java site
Quote:Original post by arch_angel07
yah the jdk i downloaded had a version of netbeans with it. i tried it but didnt really like it. unless theres somthing better about it for when there are more advanced codes. thanks for the help ill check out some of the tuts of the java site



The compile errors you posted above are from missing import statements. Since you are not using any class path switches in your command line (I'm assuming you have no external libraries).

I've used Eclipse for a while as an IDE (http://www.eclipse.org/downloads/) But it really doesn't matter what your IDE is. pick one, learn to use it, and save lots of time (and effort). You can pick up the details as you go along. Lastly, I agree with macdrunken, work through the tutorials out there before you give up on java.
“every idea is a responsibility”
Hi,

I can't seem to stress this enough for people just starting out with Java JCreator is a very easy to use editor and adapts well to larger projects. It's much more lightweight than NetBeans so if you're looking for a bit more than just the plain text editor its perfect for you. You can always use these editors hand-in-hand and should be able to navigate through each fairly easily so I would try each and see which one works for which projects. I would say most often I use JCreator as most of my projects don't require such advanced features as those editor provide. Usually I just want to open a .java file quickly compile and run it without leaving the editor. Also Javadocs are your friend get farmiliar with looking up things when you can't remember a function name or a class package that needs to be imported.

Hope this helps, good luck, and hope to see you around this forum more in the future!

And I concur with the previous two posters as to the reason for the compile error. Most errors with cannot find symbol have to do with import statements.

This topic is closed to new replies.

Advertisement