Exception in thread "main"
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i have created a folder com. In this folder i have created the following file
I compile it using
D:\>javac com\Hello.java
But i am unable to run it. i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com\Hello
when i do D:\>java com\Hello
Please help
I compile it using
D:\>javac com\Hello.java
But i am unable to run it. i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com\Hello
when i do D:\>java com\Hello
Please help
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
java parameter is fully qualified class name not file name so correct form is
d:\>java com.Hello
d:\>java com/Hello also works but not with \.
d:\>java com.Hello
d:\>java com/Hello also works but not with \.
Angela lewis
Ranch Hand
Posts: 100
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Still getting error
D:\>java com.Hello
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello
D:\>java com.Hello
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
If you want to comple the command is javac, not java.
What operating system are you using?
This link gives more info. about compiling under different operating systems and checking your java environment settings:
http://java.sun.com/docs/books/tutorial/rmi/compiling.html
What operating system are you using?
This link gives more info. about compiling under different operating systems and checking your java environment settings:
http://java.sun.com/docs/books/tutorial/rmi/compiling.html
Angela lewis
Ranch Hand
Posts: 100
posted 21 years ago
I am compiling it using
D:\>javac com\Hello.java
and it compiles fine.
i have a problem running it
I am doing
D:\>java com.Hello
and it gives the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello
I am using windows 2000 pro
[ August 06, 2004: Message edited by: Angela lewis ]
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Originally posted by Elouise Kivineva:
If you want to comple the command is javac, not java.
What operating system are you using?
This link gives more info. about compiling under different operating systems and checking your java environment settings:
http://java.sun.com/docs/books/tutorial/rmi/compiling.html
I am compiling it using
D:\>javac com\Hello.java
and it compiles fine.
i have a problem running it
I am doing
D:\>java com.Hello
and it gives the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello
I am using windows 2000 pro
[ August 06, 2004: Message edited by: Angela lewis ]
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi,
The problem may be with your classpath, check whether you have added
.(i.e current dir)in the classpath.
Kalai Selvan T.
The problem may be with your classpath, check whether you have added
.(i.e current dir)in the classpath.
Kalai Selvan T.
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
FYI
Just try these steps
set classpath=%classpath%;.;
then run
java com.Hello
Hope this helps
cheers
Just try these steps
set classpath=%classpath%;.;
then run
java com.Hello
Hope this helps
cheers
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You need to have your .class file in a directory hierarchy that matches its package. In your case, you could manually create a directory "com" and move Hello.class there, or you could compile using the -d directory. When you use -d, the compiler will place the .class file in the proper directory hierarchy at the specified location. For example,
>javac -d . Hello.java
will result in the Hello.class being created in a newly created folder "com" located in your working directory.
>javac -d . Hello.java
will result in the Hello.class being created in a newly created folder "com" located in your working directory.
| Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad. The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |






