javac won't compile class files in same directory - Solution

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
carlowenby
Posts: 1
Joined: Fri Dec 02, 2005 8:53 am
Location: Florida

javac won't compile class files in same directory - Solution

Post by carlowenby »

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...
crescendo
Posts: 1
Joined: Thu Jan 19, 2006 4:53 pm

Post by crescendo »

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
wansley
Posts: 3
Joined: Wed Jan 25, 2006 8:53 pm

QuickTime 7 seems to be the culprit

Post by wansley »

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.
agnul
Posts: 21
Joined: Tue Feb 10, 2004 9:42 am
Location: Italy

Post by agnul »

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.

:arrow: How classe are found
:arrow: Setting the CLASSPATH
wansley
Posts: 3
Joined: Wed Jan 25, 2006 8:53 pm

QuickTime 7 uninstall not necessary after all

Post by wansley »

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.
agnul
Posts: 21
Joined: Tue Feb 10, 2004 9:42 am
Location: Italy

Post by agnul »

Time to update the FAQ maybe? :wink:

(It seems to me that 90% of the problems people have with Java on this board and almost everywhere I hang out can be traced to a CLASSPATH thing...)
lopecki
Posts: 1
Joined: Thu Feb 09, 2006 5:13 pm

Post by lopecki »

Wansley, many thanks for finding out what the problem was! After inserting a semicolon at the beginning of the classpath variable, I can now compile my Java code! :D
Cosafina
Posts: 1
Joined: Sat Mar 04, 2006 2:00 am

Post by Cosafina »

I'd like to try this, because I too need quick time for my iTunes, but where can I get 6.5 from? Apple only seem to be offering QT7.
sgware
Posts: 4
Joined: Thu Apr 06, 2006 8:19 am

Ahhh!

Post by sgware »

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

Code: Select all

%CLASSPATH%
Path

Code: Select all

C:\Program Files\Java\jdk1.5.0_01\bin
SYSTEM VARIABLES:

CLASSPATH

Code: Select all

C:\Program Files\Java\jre1.5.0_04\lib\ext\QTJava.zip
Path

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\
sgware
Posts: 4
Joined: Thu Apr 06, 2006 8:19 am

Post by sgware »

Nevermind! Now I feel dumb. It actually wasn't a problem with my CLASSPATH... it was a problem with how I was defining the package... *doh*
Post Reply