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 ?
cheers
chris
One day all greenhorns will run free ...
Ernest Friedman-Hill
author and iconoclast
Marshal
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.
Chris Davies
Ranch Hand
Joined: Feb 26, 2003
Posts: 110
posted
0
cheers
i had the jars in the classpath which control panel/system/environment variables )is set at the following (i'm on win2k pro and j2se sdk 1.4.0_02 )-
i can't figure it out as curly brackets seem to be in place?
cheers
chris
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
i can't figure it out as curly brackets seem to be in place?
When interpretting compiler error messages, the most important (and correct) ones are usually the first to appear. So, let's just look at the first one, and fix it first.
What does the first error message say is expected? Do you have an idea where this missing item should go? [ May 27, 2004: Message edited by: Dirk Schreckmann ]
the following is now my problem. i have classpaths set in environment variables as well as setting it from the classpath - when i just try using the javac webtopjdbc i get the same error.
i also tried setting the classpath at the command prompt using
set classpath=.;%classpath%
but still the same error as below
this compilation is akiller
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
What do your import statements look like? Did you import java.sql.Connection?
Chris Davies
Ranch Hand
Joined: Feb 26, 2003
Posts: 110
posted
0
i've now imported the following 3 packages and am now getting 7 errors as below (at least they're going down)
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 ]
thanks. i always look for major difficulties and tend to be oblvious to the syntax.
thanks also to the sherrif - i've put ijess in action on my amazon wish list - looks interesting
i've only one left and its the following i'll investigate the synatx for accessing the system, unless you can see anything obvious
webtopjdbc.java:32: cannot resolve symbol symbol : class Resultset location: class webtopjdbc Resultset myRs = myStmt.executeQuery("SELECT * from tour_all.employee");
I'm sure I just said something about Java being case sensetive...
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
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 ]
Chris Davies
Ranch Hand
Joined: Feb 26, 2003
Posts: 110
posted
0
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 ?? ??