Java Forum / General / June 2006
Where is javac.
george.e.sullivan@saic.com - 16 Jun 2006 03:07 GMT Ok, so I want to learn some java and I run to the library and grab "The Complete Reference, Java 2 Fifth Edition" from Osborne, copyright 2002. Ok, its a little old. I get to the code for my first Java Program, type it up in notepad and then the books wants me to do:
javac example.java
Windows complains it doesn't have a javac. So off to Sun I go for the latest Java stuff like j2sdk-1_4_2_11 and jdk-1_5_0_07 and install that. Still no javac. Has things changed since 2002 and javac is no longer used? Where is javac?
Thanks the ultimate novice :)
Lee Weiner - 16 Jun 2006 03:47 GMT >Ok, so I want to learn some java and I run to the library and grab "The >Complete Reference, Java 2 Fifth Edition" from Osborne, copyright 2002. [quoted text clipped - 7 lines] >that. Still no javac. Has things changed since 2002 and javac is no >longer used? Where is javac? Probably right where it belongs, in the bin directory under the jdk directory. The reason Windows can't find it is because you never set your PATH to include this directory. When you downloaded the jdk's, did you also look at or download the installation instructions? In order to execute the javac program from any folder, you have to modify your PC's PATH environment variable to include the jdk bin directory.
Lee Weiner lee AT leeweiner DOT org
Lionel - 16 Jun 2006 03:54 GMT >> Ok, so I want to learn some java and I run to the library and grab "The >> Complete Reference, Java 2 Fifth Edition" from Osborne, copyright 2002. [quoted text clipped - 14 lines] > from any folder, you have to modify your PC's PATH environment variable to > include the jdk bin directory. As a beginner you may be best off using an IDE that will take care of a lot of this. Maybe try Netbeans.
At the same time it is important to learn to use the commandline.
Lionel.
Luc The Perverse - 16 Jun 2006 04:19 GMT >>> Ok, so I want to learn some java and I run to the library and grab "The >>> Complete Reference, Java 2 Fifth Edition" from Osborne, copyright 2002. [quoted text clipped - 17 lines] > As a beginner you may be best off using an IDE that will take care of a > lot of this. Maybe try Netbeans. I would disagree with netbeans - I found that as a n00b it complicated my life, not simplified it.
Assuming you use windows I would suggest GEL http://www.gexperts.com/ It is free, and it does very little except give an interface and an output window. It is not perfect though, sometimes it crashes. (Never seen NetBeans do that.)
The reason I like GEL is because you can work with and compile and run single files, not having to declare some project, or build scripts etc.
Command line is fine once you get your environment variables set - and I think that is where every beginner should start. My first Java programming was on a remote linux machine through an SSH tunnel. It was fun!
-- LTP
:) Lionel - 16 Jun 2006 04:42 GMT > The reason I like GEL is because you can work with and compile and run > single files, not having to declare some project, or build scripts etc. Good point. I had forgotten that you need to create projects, this can be confusing sometimes as a new user. I haven't created a new project in a couple of years, I've just been working on the one project since Netbeans 3.x :).
> Command line is fine once you get your environment variables set - and I > think that is where every beginner should start. My first Java programming > was on a remote linux machine through an SSH tunnel. It was fun! lol 8-|
Lionel.
P.Hill - 16 Jun 2006 05:00 GMT > Good point. I had forgotten that you need to create projects, So what so confusing about creating an area to place files. Certainly a set of Chapter 1, Chapter 2 etc. projects seems like very logical constructs to me and should to a newbie once they realize they'd like to keep their first program safe before messing with their second one.
Oh yes, I don't forget to complete the installation instructions for a JDK download, you'll probably need that anyway regardless of what IDE you use.
-Paul
Lionel - 16 Jun 2006 05:06 GMT >> Good point. I had forgotten that you need to create projects, > [quoted text clipped - 3 lines] > they'd like to keep their first program safe before messing with their > second one. Well yeah. If you take your time you can figure it out. But it is often a stumbling block for newbies. They tend to get impatient and try some totally different approach.
> Oh yes, I don't forget to complete the installation instructions > for a JDK download, Huh?
> you'll probably need that anyway regardless of what > IDE you use. You can get both with Netbeans . . . I'm sure there's others that do the same.
P.Hill - 16 Jun 2006 06:00 GMT >>> Good point. I had forgotten that you need to create projects, >> [quoted text clipped - 7 lines] > a stumbling block for newbies. They tend to get impatient and try some > totally different approach. So using the command line and getting a classpath correct which is provided by an IDE (just like the IDE may provides a JDK as you point out) is supposed to be conceptually less difficult than picking a place to organize files? Hmm, I'm not convinced.
>> Oh yes, I don't forget to complete the installation instructions >> for a JDK download, > > Huh? Sorry typo. "[and] don't forget to complete the installation ..." Why? (1) Because learning to run something from the command line is a useful bit of knowledge unless all programs are just learning exercises; (2) It is good to know how to run something "by hand" even if everything is just an exercise.
>> you'll probably need that anyway regardless of what >> IDE you use.
> You can get both with Netbeans . . . I'm sure there's others that do the > same. Of course modified by the need to separately agree to the EULA for the JDK which typically requires the JDK be installed first. This is a negative to a newbie using jumping right to an IDE whatever the IDE.
whatever, -Paul
Luc The Perverse - 16 Jun 2006 12:48 GMT > So using the command line and getting a classpath correct which is > provided by an IDE (just like the IDE may provides a JDK as you point out) > is supposed to be conceptually less difficult than picking a place to > organize files? Hmm, I'm not convinced. java -cp . MyClass
Not too hard :) And yes - it took me a while the first time. But I had a book to go off of. And I DID find this easier than trying to figure out how to make netbeans work.
-- LTP
:) Oliver Wong - 16 Jun 2006 22:25 GMT >>>> Good point. I had forgotten that you need to create projects, >>> [quoted text clipped - 12 lines] > is supposed to be conceptually less difficult than picking a place to > organize files? Hmm, I'm not convinced. If you're a complete newbie, and you don't even know what the concept of compilation refers to, then I think the command line is easier. Why? Because most tutorials will provide explicit step-by-step instructions on how to compile from the command line from the three major OSes (Windows, Linux and MacOSX). Most tutorials don't bother with instructions for IDEs because there's so many of them, and even within a given product series, they vary very quickly (Eclipse 3.2 has a whole bunch of new features that Eclipse 3.1 didn't have, for example).
Plus, the command line tends to have a lot less state than an IDE. With Eclipse, for example, you have to make sure that you're in the "Java perspective". You have to hope that the perspective is reset to its default so that if you say some view is on the left hand side, it really will be on the left hand side, and not on the right hand side.
- Oliver
george.e.sullivan@saic.com - 18 Jun 2006 02:44 GMT WOW and Double WOW. I never dreamed my question would create such a thread. I am honored by all your reponses. I will take to heart your many suggestions and comments. I don't know why my one computer seemed to have trouble installing Java. Nothing...absolutely nothing... was in the bin directory and there were no "hidding" settings active for the window.
SO I tried it on another and there it was. Go figure.......
Now perhaps someone can tell me a better book to use. The first example in this current book ( see the title at the start of this thread) is coded like this:
/* Comments omitted */ class Example { // Another comment public static void main (string args[ ] ) { System.out.println("This is a simple Java Program."); } }
And this is the error I get when I run javac example.java: Exception in thread "main" java.lang.NoClassDefFoundError: example/class
I don't want to have to spend any time debugging. It just aught to work when you are learning. So what is a better book that is perhaps more up-to-date. My has a copyright of 2002. IT is sort of discouraging when even the book examples don't work. In some places in the example it was hard to tell if a space existed between some things like "main(string" or "main (string" but I got the error regardless.
Thanks again to all George Sullivan
> >>>> Good point. I had forgotten that you need to create projects, > >>> [quoted text clipped - 29 lines] > > - Oliver IchBin - 18 Jun 2006 03:41 GMT > WOW and Double WOW. I never dreamed my question would create such a > thread. I am honored by all your reponses. I will take to heart your [quoted text clipped - 63 lines] >> >> - Oliver To give you a little advice. While you are learning, start to compliment it by using Google. That is, Google the *groups*. This error is a classic first time error a person learning the language makes.
Example for this error Google:
thread "main" java.lang.NoClassDefFoundError:
You will come up with tons of other people with the same problem when they start Java.
Thanks in Advance... IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager __________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"' -William E. Taylor, Regular Guy (1952-)
Steve - 18 Jun 2006 03:52 GMT Complement: goes well with, put to good use in conjunction with, etc.
Compliment: "Gee, you look nice today!"
Sorry, but that's a pet peeve of mine.
And how about twos-compliment: "Gee, you both look nice today!"
> To give you a little advice. While you are learning, start to compliment > it by using Google. That is, Google the *groups*. This error is a > classic first time error a person learning the language makes. Luc The Perverse - 18 Jun 2006 05:04 GMT > Complement: goes well with, put to good use in conjunction with, etc. > [quoted text clipped - 3 lines] > > And how about twos-compliment: "Gee, you both look nice today!" sh.t I didn't know that - and English is supposed to be one of my strong suits.
-- LTP
:) Luc The Perverse - 18 Jun 2006 05:08 GMT > And this is the error I get when I run javac example.java: > Exception in thread "main" java.lang.NoClassDefFoundError: [quoted text clipped - 7 lines] > like "main(string" or "main (string" but I got the error > regardless. While I understand your frustration, I'm not entirely sure that I agree with you. A large portion of your time, especially while you are learning, is going to be spent on debugging.
Of course, not having the very first example work adds a new level. You can only be completely green once.
But don't give up. You won't be able to have fun with something until you achieve a certain level of comfort and familiarity. (Remember, exciting is not always the same thing as fun.)
-- LTP
:) george.e.sullivan@saic.com - 19 Jun 2006 05:08 GMT LOL!!!! You guys are too much. There is a certain perverse humor I detect with you programmer types. I hope to join your elite bunch soon. "Alrighty now" as Jim Carrey says I'll move on to the Sun Getting Started stuff and come back to the book example when I know what it is really trying to tell me. As Q says in Star Trek TNG "See you out there...."
george
> > And this is the error I get when I run javac example.java: > > Exception in thread "main" java.lang.NoClassDefFoundError: [quoted text clipped - 23 lines] > > :) Oliver Wong - 19 Jun 2006 15:01 GMT [...]
>> I don't want to have to spend any time debugging. [...]
> While I understand your frustration, I'm not entirely sure that I agree > with you. A large portion of your time, especially while you are > learning, is going to be spent on debugging. Right: if you don't like debugging, maybe you should become a lion tamer instead of a programmer. I don't think debugging happens "especially while you are learning", but rather all throughout your programming career (and beyond, if you program at home as a hobby).
- Oliver
Patricia Shanahan - 19 Jun 2006 15:25 GMT > [...] >>> [quoted text clipped - 9 lines] > "especially while you are learning", but rather all throughout your > programming career (and beyond, if you program at home as a hobby). This applies even if you become a perfect coder, and never make a mistake yourself. A big part of programming is bug fixing and extending existing programs.
Patricia
Chris Smith - 19 Jun 2006 16:22 GMT > Right: if you don't like debugging, maybe you should become a lion tamer > instead of a programmer. I don't think debugging happens "especially while > you are learning", but rather all throughout your programming career (and > beyond, if you program at home as a hobby). Oliver, I like your example of "lion tamer". I suppose that is a profession in which one is rarely tasked to go back and fix previous mistakes. :)
 Signature Chris Smith - Lead Software Developer / Technical Trainer MindIQ Corporation
Timo Stamm - 19 Jun 2006 18:33 GMT Chris Smith schrieb:
>> Right: if you don't like debugging, maybe you should become a lion tamer >> instead of a programmer. I don't think debugging happens "especially while [quoted text clipped - 4 lines] > profession in which one is rarely tasked to go back and fix previous > mistakes. :) There is one detail where the analogy lacks: The lions get eaten if something goes wrong :(
Oliver Wong - 19 Jun 2006 19:21 GMT >> Right: if you don't like debugging, maybe you should become a lion >> tamer >> instead of a programmer. [...]
> Oliver, I like your example of "lion tamer". I suppose that is a > profession in which one is rarely tasked to go back and fix previous > mistakes. :) Actually, as I was writing the reply, I was picturing http://www.urielw.com/refs/montyvgc.htm (except replace "accountant" with "programmer").
- Oliver
Juha Laiho - 18 Jun 2006 10:21 GMT "george.e.sullivan@saic.com" <george.e.sullivan@saic.com> said:
>Now perhaps someone can tell me a better book to use. [to learn Java from the start]
I've found The Java Tutorial pretty nice. For what you seem to be doing at the moment, see: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html
This seems to cover pretty much the steps you've found problematic so far, with suggestions on what to do on certain trouble spots (javac or java not found, NoClassDefFound errors, ...).
And the tutorial goes pretty far, for "desktop java"; what it doesn't cover is servlets and other web server-side issues, but then, once you get the hang of Java in general, those shouldn't be that hard to pick up (if that is what you want to do).
 Signature Wolf a.k.a. Juha Laiho Espoo, Finland (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++ "...cancel my subscription to the resurrection!" (Jim Morrison)
IchBin - 16 Jun 2006 05:49 GMT >> The reason I like GEL is because you can work with and compile and run >> single files, not having to declare some project, or build scripts etc. [quoted text clipped - 12 lines] > > Lionel. But with GEL you can create Projects if you want to ...
Thanks in Advance... IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager __________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"' -William E. Taylor, Regular Guy (1952-)
IchBin - 16 Jun 2006 05:47 GMT >>>> Ok, so I want to learn some java and I run to the library and grab "The >>>> Complete Reference, Java 2 Fifth Edition" from Osborne, copyright 2002. [quoted text clipped - 35 lines] > > :) Yes, as LTP has mention GEL. I agree with him and I also use it. I use it for the same reason. For quick stuff but I use Eclipse and Netbeans on everything else.
Thanks in Advance... IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager __________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"' -William E. Taylor, Regular Guy (1952-)
海风 - 16 Jun 2006 10:03 GMT Ecllipse is a better choice also . first it is free. and easier this is important to a freshman.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|