This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with javac

 
Paola Galass
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm not really a beginner with java, I took a class a couple of years ago at University of Milan (Italy) and enjoyed it a lot

I upgraded to windows vista. Javac used to work yesterday, but today not anymore. I've set correctly path variables (I see this message when I type path from command prompt:

[/CODE]PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem; C:\Program Files\Java\jdk1.6.0_07\bin\[/CODE])

When I try to compile a file with: [/CODE]javac MyProgramm.java[/CODE] it gives no errors. But when I try to run the same file: [/CODE]java MyProgramm[/CODE] it shows this error:
[/CODE]Exception in thread "main" jva.lang.NoClassDefFoundError: MyProgramm
Caused by: java.lang.ClassNotFoundException: MyProgramm
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)[/CODE]

It doesn't compile (no file .class created) but doesn't show any error message during compilation. It's so wired!!

Can anyone help me please? This thing is driving me crazy...
 
Paola Galass
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oups sorry, a little confusion with CODE tags. The message had to look like this:



Hi,

I'm not really a beginner with java, I took a class a couple of years ago at University of Milan (Italy) and enjoyed it a lot

I upgraded to windows vista. Javac used to work yesterday, but today not anymore. I've set correctly path variables (I see this message when I type path from command prompt:

)

When I try to compile a file with: it gives no errors. But when I try to run the same file: it shows this error:


It doesn't compile (no file .class created) but doesn't show any error message during compilation. It's so wired!!

Can anyone help me please? This thing is driving me crazy...
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Green Fairy," please check your private messages by clicking on My Private Messages. Thanks!
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing I see in your PATH is a space before the C:\Program Files\Java\jdk1.6.0_07\bin\. Try removing that space, and see if that's the problem. (You will need to open a new Command Prompt for the change to take effect.)

But it's odd there are no errors. I would expect something like "javac not recognized."
[ October 21, 2008: Message edited by: marc weber ]
 
Rasath Umar
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you have your program file (My Program.java)? Add classpath=root\....\ your java .class file path.
 
Paola Galass
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, thanks for replying. There's no space in the path, I didn't know how to change it after posting... Anyway, I'm surprised too that it gives no errors. Yesterday it worked just fine, I compiled and ran a lot of mini-programs written by me, but today... I think I'm going to reinstall java again and see what happens. It's the only solution I can think right now..
 
Ls chin
Ranch Hand
Posts: 99
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

Could you try typing this line:-

java -cp . MyProgramm

(There is a space before and after the dot). Does it work?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And try the "dir" command to see whether there is an appropriately named file with .class in your current directory. The NoClassDefFoundError means the java command can't find a file of that name.

If the javac command doesn't show any errors, then it has compiled. Have you got a package declaration in MyProgramm?
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paola,

Next time you see something wrong with your post you can use the edit () button to edit it.
 
Paola Galass
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Thanks for all your replies. Actually the problem still persists. I moved all my java files and libraries in the bin directory of JDK but no changes at all. I uninstalled and reinstalled JDK and JRE again, but no way. Sorry, but I decided to go back to xp, I have a project to finish and don't know how to solve this problem.

Thanks guys, you're amazing
Bye
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't put your own files in the bin directory. That is reserved for files for the Java Virtual Machine etc.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Campbell said, mixing your own files with Java's "inner workings" eventually leads to , followed by .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic