Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

simple program, lotsa erros!

 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wohoo! It runs Thanks guys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic