Help me understand why javac will not compile the following com.apple.eawt snipet

David Durrence david_durrence at apple.com
Tue Sep 13 08:16:17 PDT 2011


Thanks for the information Jon.  Your input is appreciated and was helpful.
~~~~~~~~~~~~
David Durrence
974-6202



On Sep 12, 2011, at 5:38 PM, Jonathan Gibbons wrote:

> David,
> 
> You may have fallen victim to the mechanism used in javac to "hide" JDK internal classes in rt.jar from users who ought not to be using them.  javac uses a "symbol file" to determine what symbols in rt.jar are available for use. To disable this feature, use the hidden option -XDignore.symbol.file=true
> 
> -- Jon
> 
> 
> On 09/12/2011 05:12 PM, David Durrence wrote:
>> I am porting over a test to jtreg that uses com.apple.eawt.   Javac complains about not finding the symbol (com.apple.eawt) in the import statement (and the other invocations of this class).
>> 
>> We verified that the class is present in ../1.7.0.jdk/Contents/Home/jre/lib/rt.jar.
>> 
>> If I copy rt. jar into the source directory and invoke javac using:  javac -Xbootclasspath/p:rt. jar Test.java, the source file compiles with no problems.  If I use Java SE 6 I do not need to use the -X option.
>> 
>> Is this a feature or a bug?  What is going on?
>> 
>> 
>> // Test.java source
>> 
>> import com.apple.eawt.Application;
>> 
>> public class Test {
>> 	public static void main (String[] args) {
>> 		Application a = Application.getApplication();
>> 	}
>> }
>> 
>> javaqa7:EAWT ddurrence$ java -version
>> openjdk version "1.7.0-internal"
>> OpenJDK Runtime Environment (build 1.7.0-internal-javabuild_2011_09_12_03_02-b00)
>> OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
>> javaqa7:EAWT ddurrence$ javac Test.java
>> Test.java:1: error: package com.apple.eawt does not exist
>> import com.apple.eawt.Application;
>>                      ^
>> Test.java:5: error: cannot find symbol
>> 		Application a = Application.getApplication();
>> 		^
>>   symbol:   class Application
>>   location: class Test
>> Test.java:5: error: cannot find symbol
>> 		Application a = Application.getApplication();
>> 		                ^
>>   symbol:   variable Application
>>   location: class Test
>> 3 errors
>> javaqa7:EAWT ddurrence$ cp /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/rt.jar .
>> javaqa7:EAWT ddurrence$ javac -Xbootclasspath/p:rt.jar Test.java
>> javaqa7:EAWT ddurrence$
>> 
>> 
>> ~~~~~~~~~~~~
>> David Durrence
>> 974-6202
>> 
>> 
>> 
> 



More information about the macosx-port-dev mailing list