JDK-8138586 : Provide a unified programmatic way to invoke JDK tools
  • Type: Enhancement
  • Component: tools
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2015-09-29
  • Updated: 2016-07-20
  • Resolved: 2016-07-20
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
javax.tool.ToolProvider has static methods to get system javac and javadoc.   It'd be very useful to provide a static method to find a system tool of a given name (e.g. javap, xjc, etc) if the provider matching the given name can be found.

javax.tool.Tool interface probably would need to provide a way to specify the name of the provider.

Most JDK tools do not provide supported APIs to launch the tool programmatically.  Existing application may choose to call the internal API directly to avoid launching the tool in a separate process.  A unified way would be preferred to individual tool defining its own supported API.
Comments
OK to drop m4.
17-05-2016

Should we drop this from the m4 list?
17-05-2016

javax.tool.Tool is not ideal since it is in java.compiler module. A tool that provides the Tool service interface will require java.compiler but many tool modules do not require java.compiler. keytool is in java.base that can't have any dependence. I still like javax.tool.ToolProvider to define a method to look up any tool programmatically but this may require a new service type to be defined in java.base.
16-02-2016