After I compile, the computer is picking up the 'previous' version all the time and i can't figure out why. I am saving them as .java and then when i need to save, i click 'Save As' and then write over the existing file. but I only get what i had previously. any thoughts? thank you, Judith
Secure that you are saving to the same folder, and verify that your not saving the file as SomeJavaClass.java.txt. Sometimes the txt is automatic. If this is the case when you save enclose the java file name in " " i.e. "SomeJavaClass.java".
When you verify your files being saved double check the modified date...
I feel like jerk!!! I can't even practice java because I can't get the stuff to even load in the compiler. I have spent hours with not one thing accomplished. I put quotes around the file name like you said, but i still get the No Class Def Found error. the thing is, I'll work on a program for an hour or so, (where i type in exactly the same thing as i am typing now) and it will at run so I can fix or edit. then outta nowhere i'll run into the Def not found error. i have saved it ever which way i can. i added to the classpath just in case.. this is only the 3rd week and i have spent hours doing this, with absoutley nothing coming out of it. i have to have this class in order teach. i have never seen anything this.. please help..
On my older computer I ran into problems like you've described. We'll definately be able to give better advice when we get some more details from you like Junilu mentioned, but here are some gruling steps that I took in the past to make it work. It is to note that some of these steps might not have been necessary, but just something else to try.
I always used the 'Notepad' in windows for editing. I always performed the initial save using quotations around the file name ie "SomeClassFileName.java" I never used the 'save as' from the menu. If I ever used the 'save as' from the menu (which I never did ;-) then I would notice that there was no quotations around the file name and would replace them. I used windows for no other reason than that is what I had to work with. If it appeared that my changes to my class file did nothing, I did the following: I would make sure that I didn't have heavy programs running in the background. I would open a *new* explore from start and trace the file structure until I found my .java and .class files. I would then secure the creation time was what I would expect. I would delete the class file which should be replaced when compiling new source file. I would empty the recycling bin if I deleted the file, and before recompiling source. If this did not resolve I would close the current command prompt and open a new one for compiling and then running. I would use the fully qualified command pathe for javac and java to secure that this was not and issue ie C:\j2sdk1.4.2_06\bin\javac ...
Basically I peformed a lot of stuff that when I look back now I think, why in the heck did I do that. The answere was that I had to eliminate anything which I could conseive as a potential problem. It was crude, rude but it allowed me to keep focused on Java where I felt I was spinning my wheels resolving technical set up issues.
I wish I would have known about all of the friendly people here at javaranch who will probably give a better solution then what I have , but then I wouldn't be able to share my story here today :roll: , or would i???........
I was having alot of trouble off of the desktop, so i have been saving my java text source files in my zip drive. This ran good for a couple of days. The second gentleman with his story, sounds exactly like me. I have even put the source file right in with the bin.. i have moved and deleted..etc.. at the command prompt, I type in G: then i set the classpath then no matter what i type.. i get the class def error.. i have recopied the program from scratch just to get it to load up..(before any editing was done to it) I was saving the files..with notepad..or Notepad++.. and i was using "Save As". I went to my instructor today and asked him about this and he said to save them without using the .txt and just click ALL FILES. so i did that..(copied the orginal program..etc..) still didn't work. my java directory is C:\Temp\Sun\AppServer\bin this was for a day or two, picking up the zip drive programs..but within an hour, it would quit. i am putting in the classpath. i am sure it is wrong by now..lol my project is due on friday and i am super worried.. there goes 3.8 in the Masters..lol thanks for you help CLASSPATH =C:\Temp\Sun\AppServer\jdk\bin;".";G:\;.\;
I changed my name once already..i was using a nickname, and changed it to my real name..so i am confused by that also..lol ?? if anyone lives near hawiiai ..email me!!! man..
I save my files on my zip drive. drive G: I type in javac Mysourcefile.java. My classpath is listed above. to get this to work, i had a copy of the source file in the bin, on the desktop and on the zip at the same time the class file is on the zip. this is all i know how to do at this point. thank you, Judith p.s thanks for the info on the name change.
So you save your files on your zip drive. drive G: in the root directory. In other words, your file is in the directory
G:\Mysourcefile.java
Right?
Then you go to the G:\ directory and type in
G:\>javac Mysourcefile.java
Right?
Where do you see your Mysourcefile.class file? In G:\Mysourcefile.class or in G:\somedirectory\Mysourcefile.class ??
Your classpath is listed above as. CLASSPATH =C:\Temp\Sun\AppServer\jdk\bin;".";G:\;.\;
I think you don't need the '.\' in your classpath and you don't need the '...\jdk\bin' directory in your classpath either (although you do need it in your PATH).
to get this to work, i had a copy of the source file in the bin,
I think it is a bad idea to put your source files in the jdk\bin directory.
on the desktop
As far as you've told us, there is nothing pointing to your desktop, so this is extraneous.
and on the zip at the same time
This is good.
this is all i know how to do at this point.
We'd like to help you get beyond this point. But we need specifics. Like, for example, you didn't mention that your source files ended with '.txt' Details are very important since we can't see your files/file system. [ February 03, 2005: Message edited by: Marilyn de Queiroz ]
Post by:autobot
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, that will fit in a stocking