JDK-4758537 : javac should access classes on the endorsed standards path
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.0,1.4.1
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: generic,sparc
  • Submitted: 2002-10-05
  • Updated: 2017-05-16
  • Resolved: 2003-11-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b28Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
See
    http://java.sun.com/j2se/1.4/docs/guide/standards/
for a new path from which java loads classes.  Javac doesn't load classes
from there (it should).  Once it does there should be a way to specify 
and override the location for cross compiling.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b28 tiger-beta
14-06-2004

PUBLIC COMMENTS ...
10-06-2004

EVALUATION It would have been nice if the folks who came up with this endorsed standards path had consulted us early on to get this in 1.4. As it stands, we cannot make such a major change to the compiler until a dot release, i.e. 1.5. ###@###.### 2002-10-17 We will examine the java.endorsed.dirs system property, and add the -endorseddirs cross-compilation flag, analagous to the existing -extdirs. The search path will be the same as java's ###@###.### 2003-10-03 After further analysis, there were other path-related options where the behavior of java and javac were not maximally compatible. The scope of the bug fix has been explanded to also implement those. Here is the specification for the full set of changes: 4758537: Maximize compatibility of path searching options between javac and java Release: tiger Type: feature Manager: jerry.driscoll Engineer: martin.buchholz State: approved Decision: approved Problem Many users of Java use the "javac" command to compile to .class files, then use the "java" command to execute those .class files. For consistent semantics, and to minimize runtime surprises, it is best for both commands to use similar algorithms for finding class files. "java" has these options for specifying the bootclasspath: -Xbootclasspath/p:<path> -Xbootclasspath:<path> -Xbootclasspath/a:<path> Rather embarrassingly, "javac" supports -Xbootclasspath/p:<path>, but not -Xbootclasspath/a:<path> or -Xbootclasspath:<path>. (although -bootclasspath <path> is mostly equivalent to -Xbootclasspath:<path>) The semantics of the command "java -Xbootclasspath/p:<path> -Xbootclasspath:<path>" is surprisingly and subtly different from "javac -Xbootclasspath/p:<path> -bootclasspath <path>" "java" ignores its first argument, "javac" does not. "java" supports the system property java.ext.dirs to modify the endorsed standards path. From the command line that looks like "java -Djava.endorsed.dirs=<dirs>" However, "javac" has no options to modify the endorsed standards path. Both "java" and "javac" allow users to specify the extensions dirs. However, users need to specify different options, as follows: "java -Djava.ext.dirs=<dirs>" "javac -extdirs <dirs>" As a convenience to the user, it would be good for "javac" to also recognize the specific flag -Djava.ext.dirs=<dirs>, and similarly -Djava.endorsed.dirs=<dirs>. This proposal does not suggest recognizing any other flags of the form -Dfoo=bar. Requestors Neal Gafter Martin Buchholz Solution Add new "javac" command line flags, and modify slightly the behavior of -bootclasspath. -Xbootclasspath/a:<path> This new non-standard option appends to the bootclasspath, analagous to java's -Xbootclasspath/a:<path> -Xbootclasspath:<path> This new non-standard option is merely a command-line alias for -bootclasspath <path>, (equivalent in every way) for compatibility with "java". -endorseddirs <dirs> This new standard option specifies the endorsed standards path. The name of the option is consistent with the existing -extdirs <dirs> option. Note: a previous version of this proposal suggested the name "-endorsedpath", but "-endorseddirs" is more consistent. The endorsed standards path is a list of directories, like -extdirs, not a list of directories and jar files, like -bootclasspath <path>. -Djava.endorsed.dirs=<dirs> This new non-standard option is merely a command line alias for -endorseddirs <dirs> (equivalent in every way) -Djava.ext.dirs=<dirs> This new non-standard option is merely a command line alias for -extdirs <dirs> (equivalent in every way) Any use of the -Xbootclasspath: or -bootclasspath options cancels any previously specified -Xbootclasspath/p: or -Xbootclasspath/a: options, just like java. This proposal expresses no opinion on whether java's behavior is a good idea, merely that javac should slavishly copy it. #---------------------------------------------------------------- # The search order for classes used by both java and javac will be: # # -Xbootclasspath/p:<path> # -endorseddirs <dirs> or -Djava.endorsed.dirs=<dirs> (search for jar/zip only) # -bootclasspath <path> or -Xbootclasspath:<path> # -Xbootclasspath/a:<path> # -extdirs <dirs> or -Djava.ext.dirs=<dirs> (search for jar/zip only) # -classpath <path>, -cp <path>, env CLASSPATH=<path> #---------------------------------------------------------------- The following are clarifications only, and are *not* changes in behavior proposed here: #---------------------------------------------------------------- # Peculiarities of the class file search: # - Empty elements of the (user) classpath default to ".", # while empty elements of other paths are ignored. # - Only for the user classpath is an empty string value equivalent to "." #---------------------------------------------------------------- The "user classpath" is the path specified by the -classpath flag, or its alias -cp, or if neither of those is specified, the CLASSPATH environment variable, or if that is also not specified, the default value "." If multiple logically equivalent options are specified, the last specified option wins. For example, both -Djava.endorsed.dirs=/foo -endorseddirs /bar -endorseddirs /foo -Djava.endorsed.dirs=/bar are equivalent to -endorseddirs /bar Interface summary exported external option javac -endorseddirs <dirs> javac -Xbootclasspath/a:<path> javac -Xbootclasspath:<path> javac -Djava.ext.dirs=<dirs> javac -Djava.endorsed.dirs=<dirs> javac -Xbootclasspath/p:<path> Specification javac -X will document (among others) these options: -Xbootclasspath/p:<path> Prepend to the bootstrap class path -Xbootclasspath/a:<path> Append to the bootstrap class path -Xbootclasspath:<path> Override location of bootstrap class files -Djava.ext.dirs=<dirs> Override location of installed extensions -Djava.endorsed.dirs=<dirs>Override location of endorsed standards javac -help will document (among others) these options: -classpath <path> Specify where to find user class files -cp <path> Specify where to find user class files -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards ###@###.### 2003-10-31
31-10-2003