I have installed jsd1.4.1.Now I have written a java program.Where do I save it ? from which path I should compile.Do i need to set the classpath or it already gets set when i install the jsdk??
You never need to set the CLASSPATH variable, ever.
When you compile or run (javac command and java command respectively) the default classpath is the current directory. Do nothing and everything will probably work. Set the CLASSPATH and it will probaby break. Why? A common error is to leave out the current directory, ".", hence, a endless parade of CLASSPATH questions from those starting to use Java.
Now, if you have additional class folders and jars (jars are treated like folders containing classes in a sense) you supply them as follows.
javac -classpath ... java -classpath ...
Sometimes what you need to run is more than you need to compile, so they aren't always the same. Most intro programs need nothing at all. They use the current directory plus the built-in Java classes.
P.S. The ranch intro contains no information about the default classpath, it should.
taken from reading through the javaranch faq under setting the classpath in windows. Not very verbose about default classpath but the dot is definitely there...
That's good but I was referring to the lack of mention of what the default classpath is. I'm sure people follow that advice and add the dot and probably foo.jar along with it IMO it should state that the default value is the current directory. [ August 23, 2005: Message edited by: Rick O'Shay ]
Post by:autobot
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
a bit of art, as a gift, that will fit in a stocking