On Tue, 22 Oct 2024 11:06:44 GMT, Jan Lahoda <[email protected]> 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` executable, 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 executable 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: >> >> 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 source-file program >> >> Where key java options include: >> --class-path <class path> >> where <class path> is a list of directories and JAR archives to search >> for class files, separated by ":" >> --module-path <module path> >> where <module path> is a list of directories and JAR archives to search >> for modules, separated by ":" >> >> For additional help on usage: 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: > > Cleaning up the concise message: > - using 2 spaces instead of 4, > - rewording the "for more use --help" part of the message as suggested to > avoid the word "launcher". > > The file separator is a secondary concern and could be moved to the end of > > the sentence: > > ``` > > Where key java options include: > > --class-path <class path> > > a list of directories and JAR archives to search for class files, > > separated by ":" > > --module-path <module path> > > a list of directories and JAR archives to search for modules, > > separated by ":" > > ``` > > I agree with this comment. I also have another observation - it is not super > obvious that "a list of directiories ..." is a description for what a or is. > You kind of guess that being the case (what else can it be?) but something > like: > > ``` > --class-path <class path> > where <class path> is a list of directories and JAR archives to > search for class files, separated by ":" > ``` > > Seems more crystal clear? > > (Btw, the reason I like moving `:` at the end is that you want users to > quickly graps what is - and this trick does that: "a class path is a list of > directories and jars" - whether they're `:` or `#!?` separated, that's a > second-order concern at this point (as we're still defining the term). Ok: https://github.com/openjdk/jdk/pull/21411/commits/f1f7cc8006dcd2bdefe5bbc90936c6ccbdf044ab (text in the description updated) I checked, and the default line length for `cmd` on Windows 10 appears to be 120 characters. the longest line is now 108 characters long. So, we are nearing the hard-limit for the text. I also start to wonder if adding the text for these options lights its weight, and whether it wouldn't be better to just skip the options, leading to a leaner, shorter help. ------------- PR Comment: https://git.openjdk.org/jdk/pull/21411#issuecomment-2437683715
