On Wed, 16 Oct 2024 14:55:34 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:

>> Currently, running `java` without any parameters will lead to an output that 
>> is a full `--help`, which is over 100 lines (on my computer at least), and 
>> it feels overwhelming. And many people might actually want to run 
>> JShell/REPL, not the `java` launcher, but it is difficult find out about 
>> JShell.
>> 
>> The proposal herein is to print a much shorter help, together with a pointer 
>> to JShell, when the launcher does not know what to do. I.e. there is nothing 
>> specified to start, and no option like `--help` is specified. In particular, 
>> on my machine, it prints:
>> 
>> $ java
>> openjdk 24-internal 2025-03-18
>> 
>> Usage: java [java options...] <application> [application arguments...]
>> 
>> Where <application> is one of:
>>   <MainClass>                to execute the main method of a compiled class
>>   -jar <JarFile>.jar         to execute the main class of a JAR archive
>>   -m <module>[/<MainClass>]  to execute the main class of a module
>>   <SourceFile>.java          to compile and execute a single-file program
>> 
>> Where key java options include:
>>   --class-path <class path>
>>       a ":"-separated list of directories and JAR archives to search for 
>> class files
>>   --module-path <module path>
>>       a ":"-separated list of directories and JAR archives to search for 
>> modules
>> 
>> For more details about this launcher:   java --help
>> For an interactive Java environment:    jshell
>> 
>> 
>> Hopefully, this may be easier both for people trying to run something, and 
>> for people that are really looking for JShell.
>> 
>> What do you think?
>> 
>> Thanks!
>
> 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'

One general comment is that it now means the java launcher has 3 usages pages, 
the default, --help, and -X.

src/java.base/share/classes/sun/launcher/resources/launcher.properties line 240:

> 238: \  <MainClass>                to execute the main method of a compiled 
> class\n\
> 239: \  -jar <JarFile>.jar         to execute the main class of a JAR 
> archive\n\
> 240: \  -m <module>[/<MainClass>]  to execute the main class of a module\n\

Did you mean to use capitals here? It will look different to the `--help` 
output where we consistently use all lowercase.

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

PR Comment: https://git.openjdk.org/jdk/pull/21411#issuecomment-2422575010
PR Review Comment: https://git.openjdk.org/jdk/pull/21411#discussion_r1806566278

Reply via email to