Page 1 of 1

I get .jav and .cla when I really want .java and .class. Ho

Posted: Wed Jan 17, 2001 10:52 pm
by Aaron
I can't get my java programs to run. For example I will go and type out the code in textpad and save as "Test.java". The syntax highlighting pops up and all appears good. I then compile and that gives me no errors. I then run and I get >>Exception in thread "main" java.lang.NoClassDefFoundError: Test<<. I get the same results using dos, but JBuilder strangly enough compiles and runs. The preceding error I recognize usually pops if the class name doesn't match the file name or the file name extension isn't exact. I checked mycomputer and it seems to have saved my files as Test~1.jav and Test~1.cla. I assume that java.exe and javac.exe will choke on those extensions, but then again Test compiled with no promblems (dos compile works too). Are the extenstions the promblem and is there a way to fix them.

If it matters my OS is win98 and java is jdk1.2.1. This computer also has installed JBuilder and J++ (if that might cause complications?). On my second computer (win98se) everything works fine.

Re: I get .jav and .cla when I really want .java and .class.

Posted: Thu Jan 18, 2001 10:21 am
by Andreas
in your dos box, go to the directory which contains your java and class files.
type
dir /x
you should now see the dos-names (8.3) and the full names of the files.
Check whether the full names are correct or not and report back here.

Andreas

Re: I get .jav and .cla when I really want .java and .class.

Posted: Thu Jan 18, 2001 5:55 pm
by Aaron
Dos didn't recognize the /x and I couldn't find /x with dir /?. Just using the regular dir command to veiw the files; however, the files were in 8.3 format and not as they should be.

Re: I get .jav and .cla when I really want .java and .class.

Posted: Thu Jan 18, 2001 9:53 pm
by Andreas
Oooops, missed the Win98 bit - I think the /x is available only in WinNT Dos box.

What happens if you run
type xxx.java
(where xxx.java stands for one of your existing .java files)

Andreas

Re: I get .jav and .cla when I really want .java and .class.

Posted: Thu Jan 18, 2001 10:37 pm
by Aaron
If I run java compile in dos it gives me no errors. Same with textpad's javac compile. But then I can't get a successfull run on the resulting class with neither textpad nor the dos prompt.

While dos and myComputer both show my files as Test~1.jav and Test~1.cla, when I type dir Test.class in dos that gives me Test~1.cla which seem that dos does recognize the file, dir Test.clas however doesn't work. So Test.class exist I just can't see it. Also on my computer that works with textpad the file are also 8.3 format, so I'm not sure if they are the promblem anymore that causing the exception in thread main no class Test found error.

I tried to reinstall the program this morning and that didn't fix the promblem. I also importing the regrestry setting from the computer that did have it working, but that didn't help either.

Re: I get .jav and .cla when I really want .java and .class.

Posted: Fri Jan 19, 2001 9:20 pm
by Mark Turnbull
Hi, I've just started doing some Java development and am experiencing the same problem. I can run my Java classes fine when they're created in and run from TextPad, but when I go to my Win '95 DOS window, the names are mangled--even a short one like 'abc.java' becomes 'abc~1.jav'. I'll try again at home on my NT machine.

The reason I was trying to run the programs in a DOS window to begin with was to be able to add some command line arguments--is there a way to do that in TextPad? If so, that would solve my problem as well.

thanks,

Mark Turnbull / Mark@Contented.com

Re: I get .jav and .cla when I really want .java and .class.

Posted: Sat Jan 20, 2001 12:28 pm
by Andreas
The "mangling" will occur if either the name is longer than 8 or the extension is longer than 3!
Andreas