RFR: 8340133: Investigate if the java launcher could give hints about JShell [v3]

Jan Lahoda jlahoda at openjdk.org
Mon Oct 21 07:12:59 UTC 2024


On Thu, 17 Oct 2024 00:03:49 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adjusting the concise help as suggested: 'using main class of a JAR archive' and '<JarFile>.jar'/'<SourceFile>.java'
>
> src/java.base/share/classes/sun/launcher/resources/launcher.properties line 49:
> 
>> 47: \    -classpath <class search path of directories and zip/jar files>\n\
>> 48: \    --class-path <class search path of directories and zip/jar files>\n\
>> 49: \                  A "{0}"-separated list of directories, JAR archives,\n\
> 
> The usual way to express this is with the word i.e. comma-separated, semi-colon-separated and colon-separated. Not sure if that is possible given the way substitution happens here. Though you could do what the manpage does i.e.
> 
> Specifies a list of directories, JAR files, and ZIP archives to search for class files.
> On Windows, semicolons (;) separate entities in this list; on other platforms it is a colon (:).

I was looking into this. I don't like the "On windows <this>, otherwise <that>" - the launcher knows where it is running, and should provide the appropriate answer. That's not that big problem, as I think we could inject the platform-specific text in a way that is localizable (basically have keys like `java.launcher.opt.concise.header.classpath.windows` and `java.launcher.opt.concise.header.classpath`, which would contain the whole text for `--class-path`, and inject the localized result into the (concise) help).

I also like a bit to show the symbol, not only say its name. So that non-native speakers don't need to think about the name to symbol mapping. That is also not that big problem - we could say `colon (":")`, or something like that.

But if I try to do this, the lines tend to get longer, and they are already quite long. The current line for the class-path in the concise help has already ~85 characters, and adjusting the line to say "semicolon" is 9 characters just for the word. I am a bit worried the lines may start to wrap in the terminal. (And I don't want to introduce new lines, as that undermines the very purpose of this change: make the concise help short.)

Moreover, the standard help in JDK 23 is printing things like:

    --module-path <module path>...
                  A : separated list of elements, each element is a file path
                  to a module or a directory containing modules. Each module is either
                  a modular JAR or an exploded-module directory.


So, overall, I would say that using the symbol is least problematic.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21411#discussion_r1808220518


More information about the core-libs-dev mailing list