JDK-7123582 : (launcher) display the -version and -XshowSettings
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-12-21
  • Updated: 2012-04-21
  • Resolved: 2012-04-21
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.
JDK 7 JDK 8
7u6Fixed 8 b21Fixed
Description
The launcher is not capable of showing the version info, when used in conjunction
with -XshowSettings, for ex: java -XshowSettings -version, in this case
it should show both the information and exit with a 0 value.

Comments
SUGGESTED FIX as suggested by Sean. v245-sus $hg diff bin/java.c diff --git a/src/share/bin/java.c b/src/share/bin/java.c --- a/src/share/bin/java.c +++ b/src/share/bin/java.c @@ -382,6 +382,11 @@ JavaMain(void * _args) exit(1); } + if (showSettings != NULL) { + ShowSettings(env, showSettings); + CHECK_EXCEPTION_LEAVE(1); + } + if (printVersion || showVersion) { PrintJavaVersion(env, showVersion); CHECK_EXCEPTION_LEAVE(0); @@ -390,10 +395,6 @@ JavaMain(void * _args) } } - if (showSettings != NULL) { - ShowSettings(env, showSettings); - CHECK_EXCEPTION_LEAVE(1); - } /* If the user specified neither a class name nor a JAR file */ if (printXUsage || printUsage || what == 0 || mode == LM_UNKNOWN) { PrintUsage(env, printXUsage); v245-sus $ For the test as suggested by ksrini iff --git a/test/tools/launcher/Settings.java b/test/tools/launcher/Settings.java --- a/test/tools/launcher/Settings.java +++ b/test/tools/launcher/Settings.java @@ -25,7 +25,7 @@ import java.io.IOException; /* * @test - * @bug 6994753 + * @bug 6994753 #SEANSCR# * @summary tests -XshowSettings options * @compile -XDignore.symbol.file Settings.java TestHelper.java * @run main Settings @@ -129,6 +129,17 @@ public class Settings { checkNoContains(tr, LOCALE_SETTINGS); checkContains(tr, "Unrecognized option: -XshowSettingsBadOption"); } + + static void runTest#SEANSCR#() throws IOException { + TestHelper.TestResult tr = null; + tr = TestHelper.doExec(TestHelper.javaCmd, "-XshowSettings", "-version"); + if (!tr.isOK()) { + System.out.println(tr.status); + throw new RuntimeException("test fails"); + } + containsAllOptions(tr); + } + public static void main(String... args) { try { runTestOptionAll(); @@ -137,6 +148,7 @@ public class Settings { runTestOptionProperty(); runTestOptionLocale(); runTestBadOptions(); + runTest#SEANSCR#(); } catch (IOException ioe) { throw new RuntimeException(ioe); }
21-12-2011

EVALUATION Yes this is useful to quickly see the settings and version info. and needs to be done. The fix is simply a question of altering the sequence of how these are called internally.
21-12-2011