# help with Java

This topic is 3343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello i am new to java and just got "java for dummies, 4th edition" and i seem to be having trouble with my compiler? It won't compile or execute. Im using JCreator on Windows Vista. Heres what i get when i try to execute the sample code hopefully some one understands this?
java.lang.NoClassDefFoundError: MortgageText
Caused by: java.lang.ClassNotFoundException: MortgageText
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:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
Could not find the main class: MortgageText.  Program will exit.


i even tried compiling strait from the compiler "javac" but i had the same error message. i also know that i have JDK 6, and the JDK API Documentation... so please help...Before i go outside...and write code in the dirt with some random stick... and twitch while i do it... very wierd.......( lol ) -merry christmass ya'll

##### Share on other sites
I've only taken one class on java, but it sounds to me like it can't find the class "MortgageText" which the main method is supposed to be in.

##### Share on other sites
this is a common error when doing java prog. Have you googled?
it's good for a beginner to start java prog from command prompt & tutorial here.
Post the code as well if possible.

##### Share on other sites
Make sure you're in the same directory as the MortgageText.java class and try:

javac MortgageText.java

then

java -cp . MortgageText

Regards
elFarto

##### Share on other sites
i tried looking on the java website(beginner page) for troubleshooting; they had the same problem but not really, you see they had something like this

java.lang.NoClassDefFoundError: MortgageText\class

but i don't type in cmd: "java MortgageText.class", i type "java MortgageText" and still get

java.lang.NoClassDefFoundError: MortgageText

so that didn't really help...

it compiled fine without anything poping up..but i couldn't find the class file(usually in the "BIN folder?").. can't find it in search either.

i tried doing "java -cp . MortgageText" but i had the same error.

could it be something wrong with the compiler since there seems to be no MortgageText.class?

##### Share on other sites
ok i figured it out it isn't java at all... its windows "Vista". T guess i have to run as administrater every time i start cmd, or i guess JCreater...

man i wish i had Ubuntu on this computer or XP.

thanks for the replies. Just another Vista problem...

##### Share on other sites
For what it's worth you might want to look into eclipse. I put it on my Vista machine and it worked without any problems. It's a great IDE and it's free. I've never tried JCreator, so I cant speak to it.

On the other hand I had some issues with java on Ubuntu (the exact exception you were getting in fact). Turns out the GNU jvm was the default and it took some tinkering before I could get it to default to sun's jvm.

Sometimes you just run into problems regardless of the OS. Glad to hear you got it fixed.