| Author |
Problem with Hello World
|
Terry Wynn
Greenhorn
Joined: Dec 18, 2009
Posts: 17
|
|
Just getting started. I got the following:
C:\Jplan>javac hello.java
C:\Jplan>java hello.java
Exception in thread "main" java.lang.NoClassDefFoundError: hello/java
Caused by: java.lang.ClassNotFoundException: hello.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
Could not find the main class: hello.java. Program will exit.
So I can compile, but not execute.
The startup at the Cattle Drive indicates that I need to set my CLASSPATH to
.;C\Jplan
I believe I have.
Although I don't know how to check that.
Thanks in advance for the help.
Program is
public class hello
{
public static void main( String[] args )
{
System.out.println("hello world!");
}
}
located in c:\Jplan\hello.java
|
 |
W. Joe Smith
Ranch Hand
Joined: Feb 10, 2009
Posts: 710
|
|
Rather than running it with:
C:\Jplan>java hello.java
Use:
C:\Jplan>java hello
|
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
|
 |
Terry Wynn
Greenhorn
Joined: Dec 18, 2009
Posts: 17
|
|
Whoopsie.
Thank you very much. Works fine.
Sorry to be THIS stupid. I am sure none of you did anything like this in the beginning.
|
 |
W. Joe Smith
Ranch Hand
Joined: Feb 10, 2009
Posts: 710
|
|
Terry Wynn wrote:Whoopsie.
Thank you very much. Works fine.
Sorry to be THIS stupid. I am sure none of you did anything like this in the beginning.
To be honest, I've been studying Java for about a year now and I STILL do that sometimes. I will stare at the command line for about 5 seconds wondering what happened, then proceed to laugh at myself.
|
 |
 |
|
|
subject: Problem with Hello World
|
|
|