when i run the javac command it returns to the prompt (giving no message as always - inferring its compiled), and yet its not there in the directory ?? i can't see it via command line or windows explorer interface ? ?
is this s runtime error ? i tried again with a simpler program and it has worked so can anyone tell me what it's doing ?
Well, without your including the JAR files explicitly on the CLASSPATH (see HowToSetTheClasspath) this won't compile, because javac will not find any packages by the names you're importing, and for javac, that's a hard error. But you ought to see a message like
and I can't explain why you're not; maybe someone else could guess?
Anyway, you don't need those import statements, as you don't use those classes at compile time; but the jars should be on the CLASSPATH or you won't be able to run the program.
One very important fact about Java, Chris Davies, is it is case sensetive.
- Drivermanager is not a class in the JDK. However DriveManager is.
- myStmtexecuteQuery is not a method of you class, however executeQuery(String query) is a valid method of the Statement object
- printStackTRace is not a method of Exception. But printStackTrace is.
Please Chris, I know any programming language can feel a little overwhelming when you are new to the discipline, but these errors are pretty clearly listed in your stack trace if you look at it carefully.
[ May 27, 2004: Message edited by: Paul Sturrock ] [ May 27, 2004: Message edited by: Paul Sturrock ]
When figuring out what classes are available in the J2SE API, what those classes do, and even how to spell them correctly, I like to keep the J2SE API Documentation at hand for reference.
Did you find the solution to your problem?
Also, when putting together a program, large or small (but especially large), I always like to work in tiny little baby steps. I usually won't write another line of code if the previous line won't compile. This way, I've never more than about one or two compiler errors to deal with and think about, and they're most always in the same place - on the last line of code I just typed. So, I strongly suggest writing a little bit at a time, and compiling very often. [ May 27, 2004: Message edited by: Dirk Schreckmann ]
thanks, i figure out the capital 'S' in ResultSet (i wont forget that one)
but i can't see this last one. i've checked the j2se api and there seems to nothing wrong with the capitalisation on the getString method, or using the previously assigned myRs variable or using the . in myRs.getString ?? ??
webtopjdbc.java:36: cannot resolve symbol symbol : method getString (java.lang.String,java.lang.String) location: interface java.sql.ResultSet System.out.println(myRs.getString("name","job"));
One day all greenhorns will run free ...
posted 15 years ago
If you look at the documentation, you'll notice two getString methods. What arguments do they take?