Ubuntu 22.04にkotlin バージョンを確認する方法
環境
Ubuntu 22.04.1 LTS
openjdk 11.0.16 2022-07-19
Kotlin version 1.7.20-release-201
操作方法
1. kotlinバージョンを確認します
# kotlin -version
Kotlin version 1.7.20-release-201 (JRE 11.0.16+8-post-Ubuntu-0ubuntu122.04)
# kotlin -version
Kotlin version 1.7.20-release-201 (JRE 11.0.16+8-post-Ubuntu-0ubuntu122.04)
# kotlin -version Kotlin version 1.7.20-release-201 (JRE 11.0.16+8-post-Ubuntu-0ubuntu122.04)
2.ヘルプを確認します
# kotlin -h
kotlin: run Kotlin programs, scripts or REPL.
Usage: kotlin <options> <command> [<arguments>]
where possible options include:
-howtorun <value> How to run the supplied command with arguments,
valid values: guess (default), classfile, jar, script (or .<script filename extension>)
-classpath (-cp) <path> Paths where to find user class files
-Dname=value Set a system JVM property
-J<option> Pass an option directly to JVM
-no-stdlib Don't include Kotlin standard library into classpath
-no-reflect Don't include Kotlin reflection implementation into classpath
-compiler-path Kotlin compiler classpath for compiling script or expression or running REPL
If not specified, try to find the compiler in the environment
-X<flag>[=value] Pass -X argument to the compiler
-version Display Kotlin version
-help (-h) Print a synopsis of options
and command is interpreted according to the -howtorun option argument
or, in case of guess, according to the following rules:
foo.Bar Runs the 'main' function from the class with the given qualified name
(compiler arguments are ignored)
app.jar Runs the given JAR file as 'java -jar' would do
(compiler arguments are ignored and no Kotlin stdlib is added to the classpath)
script.kts Compiles and runs the given script, passing <arguments> to it
-expression (-e) '2+2' Evaluates the expression and prints the result, passing <arguments> to it
<no command> Runs Kotlin REPL
arguments are passed to the main function when running class or jar file, and for standard script definitions
as the 'args' parameter when running script or expression
# kotlin -h
kotlin: run Kotlin programs, scripts or REPL.
Usage: kotlin <options> <command> [<arguments>]
where possible options include:
-howtorun <value> How to run the supplied command with arguments,
valid values: guess (default), classfile, jar, script (or .<script filename extension>)
-classpath (-cp) <path> Paths where to find user class files
-Dname=value Set a system JVM property
-J<option> Pass an option directly to JVM
-no-stdlib Don't include Kotlin standard library into classpath
-no-reflect Don't include Kotlin reflection implementation into classpath
-compiler-path Kotlin compiler classpath for compiling script or expression or running REPL
If not specified, try to find the compiler in the environment
-X<flag>[=value] Pass -X argument to the compiler
-version Display Kotlin version
-help (-h) Print a synopsis of options
and command is interpreted according to the -howtorun option argument
or, in case of guess, according to the following rules:
foo.Bar Runs the 'main' function from the class with the given qualified name
(compiler arguments are ignored)
app.jar Runs the given JAR file as 'java -jar' would do
(compiler arguments are ignored and no Kotlin stdlib is added to the classpath)
script.kts Compiles and runs the given script, passing <arguments> to it
-expression (-e) '2+2' Evaluates the expression and prints the result, passing <arguments> to it
<no command> Runs Kotlin REPL
arguments are passed to the main function when running class or jar file, and for standard script definitions
as the 'args' parameter when running script or expression
# kotlin -h kotlin: run Kotlin programs, scripts or REPL. Usage: kotlin <options> <command> [<arguments>] where possible options include: -howtorun <value> How to run the supplied command with arguments, valid values: guess (default), classfile, jar, script (or .<script filename extension>) -classpath (-cp) <path> Paths where to find user class files -Dname=value Set a system JVM property -J<option> Pass an option directly to JVM -no-stdlib Don't include Kotlin standard library into classpath -no-reflect Don't include Kotlin reflection implementation into classpath -compiler-path Kotlin compiler classpath for compiling script or expression or running REPL If not specified, try to find the compiler in the environment -X<flag>[=value] Pass -X argument to the compiler -version Display Kotlin version -help (-h) Print a synopsis of options and command is interpreted according to the -howtorun option argument or, in case of guess, according to the following rules: foo.Bar Runs the 'main' function from the class with the given qualified name (compiler arguments are ignored) app.jar Runs the given JAR file as 'java -jar' would do (compiler arguments are ignored and no Kotlin stdlib is added to the classpath) script.kts Compiles and runs the given script, passing <arguments> to it -expression (-e) '2+2' Evaluates the expression and prints the result, passing <arguments> to it <no command> Runs Kotlin REPL arguments are passed to the main function when running class or jar file, and for standard script definitions as the 'args' parameter when running script or expression