LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-23-2011, 02:35 PM   #1
tootiemae
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Rep: Reputation: Disabled
Please Help


I cant run Hello.java program in Fedora

public class Hello {

public static voild main(String[] args){
String name;
name= "Erica";
Systems.out.println("hello, +name+ "!");
}
}
 
Old 09-23-2011, 02:41 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
If I may:
  1. Try using a more descriptive title than "Please Help"
  2. Please use code tags when posting source code snippets
  3. Explain what you've tried, and how it failed (i.e. Did you try running it from the command line? What did you type, exactly? What error message did it tell you?)

All that said, you appear to have at least two syntactical errors: a misspelled function definition, and a missing closing quote.

Last edited by anomie; 09-23-2011 at 02:42 PM.
 
Old 09-23-2011, 02:44 PM   #3
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by tootiemae View Post
I cant run Hello.java program in Fedora

public class Hello {

public static voild main(String[] args){
String name;
name= "Erica";
Systems.out.println("hello, +name+ "!");
}
}
Welcome to LQ.

Please use code-tags when posting code and/or data. What exactly do you mean? After correction of several errors it runs fine. Or are you not able to compile it? Keep in mind that Java also requires that the filenames have to follow this naming pattern:
classname.java

P.S.: The corrected version:
Code:
public class Hello {

 public static void main(String[] args){
  String name;
  name= "Erica";
  System.out.println("hello" +name+ "!");
 }
}

Last edited by crts; 09-23-2011 at 02:48 PM. Reason: highlighted corrected errors
 
Old 09-23-2011, 02:49 PM   #4
tootiemae
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
I cant compile the file i keep getting javac: file not found: Hello.java
 
Old 09-23-2011, 02:56 PM   #5
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by tootiemae View Post
I cant compile the file i keep getting javac: file not found: Hello.java
As I already said, you need to follow this naming scheme in java:
classname.java

In your case you will have to name your file
Hello.java

and compile it with
javac Hello.java

Keep in mind that java is case sensitive.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration