permaculture playing cards*
The moose likes Beginning Java and the fly likes compiling java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiling java program" Watch "compiling java program" New topic
Author

compiling java program

Smitha Ballikar
Ranch Hand

Joined: Aug 02, 2005
Posts: 99
Hi,

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??

Cheers
Smitha
Patrick van Zandbeek
Ranch Hand

Joined: Aug 17, 2005
Posts: 37
check this
JavaRanch beginner's FAQ

and more specifically this
Sun's first Java steps tutorial


u is a letter, not a word.
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
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.
Patrick van Zandbeek
Ranch Hand

Joined: Aug 17, 2005
Posts: 37
SET CLASSPATH=.;C:\fubar\Foo.jar

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...

Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compiling java program
 
Similar Threads
Heap Space Error
Tomcat installation Problem
Run Time error
class path
Set Compiler Compliance Level