javac won't compile class files in same directory - Solution
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 1
- Joined: Fri Dec 02, 2005 8:53 am
- Location: Florida
javac won't compile class files in same directory - Solution
I recently experienced a problem where the Java compiler no longer would compile two java files that were in the same directory with each other. I started getting "cannot find symbol" errors when I compiled files that compiled earlier without errors
I uninstalling and reinstalling the JDK several times to no avail. I then searched the Windows registry for all entries with Java and found entries that pointed to files in non-existent folders in the c:\ProgramFiles\java directory. These files were QuickTime files.
I recalled that I had recently updated QuickTime. I went to the Windows Control Panel and uninstalled QuickTime. The Java compiler auto-magically started working again.
Apparently the errant registry keys tend to confuse the java compiler.
I later found some obscure references dating back to 2001 on Sun's developer forum hinting that QuickTime might be implicated in this issue but nothing definite.
I would be interested in hearing if uninstalling QuickTime resolves the problem for other users. If so, please reply to this topic. Hope this helps...
I uninstalling and reinstalling the JDK several times to no avail. I then searched the Windows registry for all entries with Java and found entries that pointed to files in non-existent folders in the c:\ProgramFiles\java directory. These files were QuickTime files.
I recalled that I had recently updated QuickTime. I went to the Windows Control Panel and uninstalled QuickTime. The Java compiler auto-magically started working again.
Apparently the errant registry keys tend to confuse the java compiler.
I later found some obscure references dating back to 2001 on Sun's developer forum hinting that QuickTime might be implicated in this issue but nothing definite.
I would be interested in hearing if uninstalling QuickTime resolves the problem for other users. If so, please reply to this topic. Hope this helps...
I have had this problem with several of the computers i've installed textpad/java sdk on. I never knew that the problem was quicktime!
I just installed sdk and TP4 on my new computer and got the same errors i always get. Per your advice I uninstalled quicktime and everything works now. Strange.
I tried reinstalling quicktime because i need to use it with itunes, but then my textpad stopped working.
Any way to run them simultaneously? Have you narrowed down the problem key/file yet?
I'll fool around with it and see what I come up with. Thanks!
~Cresecendo
I just installed sdk and TP4 on my new computer and got the same errors i always get. Per your advice I uninstalled quicktime and everything works now. Strange.
I tried reinstalling quicktime because i need to use it with itunes, but then my textpad stopped working.
Any way to run them simultaneously? Have you narrowed down the problem key/file yet?
I'll fool around with it and see what I come up with. Thanks!
~Cresecendo
QuickTime 7 seems to be the culprit
I have just discovered a similar problem. I installed the Sun JDK 1.5 update 6 and then TextPad 4.73 to a PC with the lastest version of QuickTime 7 installed. I got this error when I tried to run a java application after compliling it successfully:
"Exception in thread "main" java.lang.NoClassDefFoundError: 'file name'"
After I uninstalled QT 7, I was able to run the java app with no problems. I was also able to run it after I installed QT 6.5.
"Exception in thread "main" java.lang.NoClassDefFoundError: 'file name'"
After I uninstalled QT 7, I was able to run the java app with no problems. I was also able to run it after I installed QT 6.5.
Quicktime (and other apps I believe) set the environment variable CLASSPATH to point somewhere in their install folder, forgetting (or ignoring) you should always include the current dir (.) in the CLASSPATH. So when you try to run your classes the java interpreter goes looking for them in whatever folder Quicktime set the CLASSPATH variable to and nowhere else. Uninstalling Quicktime is overkill, just fix (or delete) the CLASSPATH variable.
The gory details on what the CLASSPATH is and why you (don't) need it are as ususal found in the documentation that everyone should download along with the java SDK.
How classe are found
Setting the CLASSPATH
The gory details on what the CLASSPATH is and why you (don't) need it are as ususal found in the documentation that everyone should download along with the java SDK.
How classe are found
Setting the CLASSPATH
QuickTime 7 uninstall not necessary after all
agnul,
I appreciate the additional info. While I agree that in an ideal world I should have downloaded and read the java documentation you so kindly pointed out, I work as a PC support tech for a community college where I am expected to supports dozens of different applications on hundreds of PCs and I just don't have time to get fully up to speed on all of them. That why I find forums such as this one, where experts are willing to share their hard-won knowledge, so invaluable.
I sent a "bug report" to TextPad tech support and got a reply from Steven MacDonald, quoted below my signature at the end of this message. The workaround he gave me works, al least in my case. All I needed to do was add the semicolon to the beginning of the CLASSPATH environment variable. (I encountered the same workaround when searching this forum earlier, but didn't realize it applied to my situation.)
I did report the bug to Apple, as Steven requested.
--
William Ansley
----------------------------------------------------------------------
If you run a java application from the Command Prompt, you will get the same error, so this is not a TextPad problem.
When you install QuickTime 7 it messes up the Classpath, which you can find under: Start/Settings/Control Panel. Double click System. Click the Advanced tab and then the Environment Variables button.
I suggest that you install QuickTime 6.5 and then check that the Java
functions are working correctly. Then go to the Classpath setting for the
JDK, as described above, and insert a ;(semi colon) at the start of the
path. You should then be able to install QuickTime 7, without it causing
any problems.
If you are successful, please report the problem to Apple.
I appreciate the additional info. While I agree that in an ideal world I should have downloaded and read the java documentation you so kindly pointed out, I work as a PC support tech for a community college where I am expected to supports dozens of different applications on hundreds of PCs and I just don't have time to get fully up to speed on all of them. That why I find forums such as this one, where experts are willing to share their hard-won knowledge, so invaluable.
I sent a "bug report" to TextPad tech support and got a reply from Steven MacDonald, quoted below my signature at the end of this message. The workaround he gave me works, al least in my case. All I needed to do was add the semicolon to the beginning of the CLASSPATH environment variable. (I encountered the same workaround when searching this forum earlier, but didn't realize it applied to my situation.)
I did report the bug to Apple, as Steven requested.
--
William Ansley
----------------------------------------------------------------------
If you run a java application from the Command Prompt, you will get the same error, so this is not a TextPad problem.
When you install QuickTime 7 it messes up the Classpath, which you can find under: Start/Settings/Control Panel. Double click System. Click the Advanced tab and then the Environment Variables button.
I suggest that you install QuickTime 6.5 and then check that the Java
functions are working correctly. Then go to the Classpath setting for the
JDK, as described above, and insert a ;(semi colon) at the start of the
path. You should then be able to install QuickTime 7, without it causing
any problems.
If you are successful, please report the problem to Apple.
Ahhh!
Ok, I am having the same problem as described above, but none of the solutions are working for me.
Here's my situation.
- I have the JDK and TextPad installed
- I have written some .java files and compiled them successfully
- The .class files are in the same directory as the .java files
- I have tried putting semicolons in front of my CLASSPATH and Path variables, both in the User Environment Variables and the System Environment Variables. I've tried various combinations.
- I have Quicktime, but would like to keep it if I can, since I use ITunes
- Under TextPad > Configure > Preferences > Compile Java I have Parameters set to "$File" and Initial Folder set to "$FileDir"
Still, when I try to compile any class that uses another class, I get 'class not found' errors (or something to that effect).
Anyone got any ideas?
(Just for reference, if it helps. This is what my CLASSPATH and Path variables are set to at the moment, after trying several combinations of semicolons.)
USER VARIABLES:
CLASSPATH
Path
SYSTEM VARIABLES:
CLASSPATH
Path
Here's my situation.
- I have the JDK and TextPad installed
- I have written some .java files and compiled them successfully
- The .class files are in the same directory as the .java files
- I have tried putting semicolons in front of my CLASSPATH and Path variables, both in the User Environment Variables and the System Environment Variables. I've tried various combinations.
- I have Quicktime, but would like to keep it if I can, since I use ITunes
- Under TextPad > Configure > Preferences > Compile Java I have Parameters set to "$File" and Initial Folder set to "$FileDir"
Still, when I try to compile any class that uses another class, I get 'class not found' errors (or something to that effect).
Anyone got any ideas?
(Just for reference, if it helps. This is what my CLASSPATH and Path variables are set to at the moment, after trying several combinations of semicolons.)
USER VARIABLES:
CLASSPATH
Code: Select all
%CLASSPATH%
Code: Select all
C:\Program Files\Java\jdk1.5.0_01\bin
CLASSPATH
Code: Select all
C:\Program Files\Java\jre1.5.0_04\lib\ext\QTJava.zip
Code: Select all
C:\PROGRAM FILES\THINKPAD\UTILITIES;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\WINDOWS\Downloaded Program Files;%SystemDrive%\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\VDMSound;C:\Program Files\Java\jdk1.5.0_01\bin;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\QuickTime\QTSystem\