This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes simple program, lotsa erros! 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 "simple program, lotsa erros!" Watch "simple program, lotsa erros!" New topic
Author

simple program, lotsa erros!

Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
For one of my classes I have to write a simple program displaying some contact information using the system.out.print command, and I got a bunch of errors when I tried to compile that I can't seem to work out. Is there anyone that might be able to help me figure out whats wrong? I would be eternally grateful Theres the image of the error messages below (I just blottted out the phone #), plus the text for the program...


//Brandi Love
//Computer Science I, Section 113
//Programming Assignment #2, part 1

public class DisplayInfo
{
public static void main(String[] args)
{
System.out.print("Brandi Love\n Marist College MSC# 11668\n 3399 North Road\n Poughkeepsie, NY 12601\n\n 845-575-**** Brandi.Love@marist.edu");
}
}

[ September 19, 2003: Message edited by: Brandi Love ]
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Is the System.out.println line is in 2 lines or in a single line?
If it is in 2 lines like this,

It is going to give some trouble. Try it in a single line

Note: You forgot to blot out the phone number in the code!


Mani
Quaerendo Invenietis
Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
Okay, so I did put it into one line and lo and behold, it compiled Now though, I'm trying to run it and it doesn't want to work. Heres the error its giving me...

[ September 19, 2003: Message edited by: Brandi Love ]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Brandi, you need to specify the classpath on your computer. It just so happens that we've seen this many times and you can find this in out FAQ's here. Its not your program, it just wants to know where you've installed all you java classes. if you have any problems setting the classpath, post again. You may have some trouble if it is a school lab computer(permissions).
Jamie
[ September 19, 2003: Message edited by: Jamie Robertson ]
Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
If you can't specify the class path in your system variables you can state it at command line in the jvm. For example java -classpath . DisplayInfo. This would set your classpath to your current working directory which is what you want you you execute this class. I hope this helps you out.
Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
Wohoo! It runs Thanks guys.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: simple program, lotsa erros!
 
Similar Threads
removing newline and tabs from a string
amount of digits entered(without a tokenizer)....
So confused on creating an array
# of lines in a file?
getting answer to pop up in dialog box...