This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help-virgin programmer. I don't know how to enter and compile a program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help-virgin programmer. I don Watch "Help-virgin programmer. I don New topic
Author

Help-virgin programmer. I don't know how to enter and compile a program

Jermaine Hatter
Greenhorn

Joined: Feb 10, 2003
Posts: 6
I downloaded java2 sdk 1.4.1 successfully to my c drive. I wrote a sample program in the book. Where do I need to save it? I click the javac.exe and it disappears right away. It doesn't give me time to enter anything in the command prompt. Am I doing something wrong. Anybody's help would be greatly appreciated. Here is the following code that I wrote:

/*
This is a simple java program
Call this file Example.java.
*/
class Example {
// A Java program begins with a call to main ( ).
public static void main (String args[] ) {
System.out.println ("Java drives the web.");
}
}
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
hi
check out the first steps tutorial on the sun site
try the turial and if anything is unclear, then repost.
k
Jermaine Hatter
Greenhorn

Joined: Feb 10, 2003
Posts: 6
ok, I'll check it out Karl and let you know what I come up with. I appreciate your help.
Jermaine Hatter
Greenhorn

Joined: Feb 10, 2003
Posts: 6
Ok, I'm almost done with my first program. I'm not sure if this is what I want to do. I spent a long time just getting the code to compile. Now I can't see the out put because the directory I'm in is not where the bytecode is. Any help. I tried the root drive c and also the c:\j2sdk1.4.1_01 and also the c:\j2sdk1.4.1_01\bin drive in which I was able to compile the code.
Jermaine Hatter
Greenhorn

Joined: Feb 10, 2003
Posts: 6
I figured it out from the sun site. I had to set the CLASSPATH. Well as you all can see, I have a long way to go. I'm just getting my feet wet. From the looks of things, I hope I don't drown!!!
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
dont worry.
everybody started like this.
but learning it this way will never let you forget the CLASSPATH again :-)
k
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
For a simple program such as that, you do not need to set up a CLASSPATH. And once you have installed j2sdk1.4.1_01 and set your PATH ( not CLASSPATH ) to include c:\j2sdk1.4.1_01\bin you should be able to edit, compile , and execute that program in any one working directory. Stay away from c:\j2sdk1.4.1_01 it is sacred. Assuming you are using a "simple" editor of course .


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help-virgin programmer. I don't know how to enter and compile a program