|  | |  |
02-12-2007, 08:13 AM
|
#16 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| listen, I am kinda stuck and confused so, why dont you send me a simple "hello world" java file and class file and let me see if it works with me. my e-mail is: virus0010010@hotmail.com
thank you |
| |
02-12-2007, 09:30 AM
|
#17 (permalink)
| | Newbie
Join Date: Jun 2002 Location: Denmark
Posts: 1,726
| Thats actualy a very simple one: Code: class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
} And you'll compile it with Which produces the filename.class file, then you can run it with the If this produces errors like Quote: |
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
| Try executing it with the CLASSPATH argument ie If that produces errors, please show them as they appear. |
| |
02-12-2007, 12:09 PM
|
#18 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| ok. It worked. But it didn't give me that command in the book. What does it mean (java -cp . filename)?
I know what (java filename) means but not what you told me???? |
| |
02-12-2007, 12:32 PM
|
#19 (permalink)
| | Newbie
Join Date: Jun 2002 Location: Denmark
Posts: 1,726
| The -cp tells it to override the CLASSPATH variabel, and use whatever you've provided instead, in this case . or current dir. |
| |
02-12-2007, 04:44 PM
|
#20 (permalink)
| | Java fanboy
Join Date: Aug 2003
Posts: 1,175
| As you can guess, the problem is with your CLASSPATH environmental variable. What's it's current value? |
| |
02-15-2007, 09:44 AM
|
#21 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| its "." like you told me to do so.
Even though the -cp command works, i still want to run my program in a normal way. |
| |
02-15-2007, 04:42 PM
|
#22 (permalink)
| | Java fanboy
Join Date: Aug 2003
Posts: 1,175
| Here's what I want you to do, I want you to give it another shot and then copy and paste everything here.
Also, I want you to run the following command: Copy and paste the results from that too.
I still think somehow your classpath variable is getting misconfigured. I don't know how, but we should be able to figure out. |
| |
02-16-2007, 02:24 AM
|
#23 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| you cant copy any thing from the command prompt. but when i added the echo %CLASSPATH% command, it gave me "." the same thing that i added.
And I gave it another shot but nothing happend. I still got: exeption in thread "main" java.lane.noclassdeffounderror. |
| |
02-16-2007, 03:08 AM
|
#24 (permalink)
| | Java fanboy
Join Date: Aug 2003
Posts: 1,175
| You can right-click on the command prompt, and then choose "Mark". You can then highlight the text in the window. Then, after you've highlighted everything, press Enter. You've now copied everything visible in the window.
And just to make sure (because I've seen it happen before with other people), you didn't include the quotes when you set the CLASSPATH variable, it's just the period, right? |
| |
02-16-2007, 08:17 AM
|
#25 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| C:\Documents and Settings\w>cd \myjava
C:\myjava>echo %CLASSPATH%
"."
C:\myjava>java Saluton
Exception in thread "main" java.lang.NoClassDefFoundError: Saluton
C:\myjava>
this is all that I get. And what do you meen by quotes? I had addded just what you told me to which is "." |
| |
02-16-2007, 09:37 AM
|
#26 (permalink)
| | Newbie
Join Date: Jun 2002 Location: Denmark
Posts: 1,726
| remove the quotes surrounding the . right now the CLASSPATH is pointing to a folder named "." instead of the current folder which dosn't contain any quotes. |
| |
02-16-2007, 09:46 AM
|
#27 (permalink)
| | Recruit
Join Date: Feb 2007
Posts: 13
| OW MY GOD!! It finally worked.
thank you'll for all your help. I hope I can come back to you for any more trouble I get along the way. |
| | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -8. The time now is 01:02 AM. |
Copyright © 2000-2008, Milano Interactive Web Hosting provided by Portal 360 Web Hosting |  | |