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

David Durrence david_durrence at apple.com
Mon Sep 12 17:12:28 PDT 2011


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