Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help Beginner Java Programmer

Status
Not open for further replies.

LiveEvol

Programmer
May 9, 2007
9
when I try to execute an Hello World Script i get this error.
HelloApp.java:10: cannot find symbol
symbol : method print1n<java.lang.String>
location: class java.io.PrintStream
System.out.print1n("Hello, World");
^
1 error
 
it's print[!]l[/!]n, not 1n.

and have you imported the class java.io.*??

[monkey][snake] <.
 
how do you import class java.io.
and is the red highlight a I
 
and now that i have that fixed and wont show the words "Hello World".
 
Hi

Hmm... Sorry to ask, but how new you are to Java ? You know that running [tt]javac HelloApp.java[/tt] does only compile the class, do you ? And after compiling you runned [tt]java HelloApp[/tt], right ?

Feherke.
 
I'm completely new to Java. And no I didn't know running javac HelloApp.java only compiles the class which means what by the way. When i ran java HelloApp.java it cam with this error.
Exception in thread "main" java.lang.NoClassDefFoundError: HelloApp/java
 
i went out and bought Java for Dummies and I'm a bit confused but we've been blessed with a brain so ill probably figure it out.
 
Hi

LiveEvol said:
no I didn't know running javac HelloApp.java only compiles the class which means what by the way
Java does not run the code you write directly. It translates it to so called bytecode, which is much faster to run. So [tt]javac[/tt] is the compiler and [tt]java[/tt] is the runner.
LiveEvol said:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloApp/java
In case of beginners this mostly means your class was not declared [tt]public[/tt]. Pay attention to scope modifiers :
Code:
[b]public[/b] class HelloApp {
  [b]public static[/b] void main(String[] args)
  {
    System.out.println("Hello World");
  }
}

Feherke.
 
Thanks all for your help IF i run into any more problems ill surely let you know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top