### Example Output for Java Version Check Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Illustrates the typical output when verifying a Java installation, including the OpenJDK version, runtime environment, and server VM details. The exact version numbers may vary based on the installed JDK. ```text openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) ``` -------------------------------- ### Run Kotlin Examples with `run` Script Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/etc/usingrun.md These convenience scripts (`run.bat` for Windows, `run.sh` for Mac/Linux) compile and execute all Kotlin examples in the current directory, or a specific `.kt` file if provided. They require Python 3 to be installed. ```Batch run run AnExample.kt ``` ```Shell ./run.sh ./run.sh AnExample.kt ``` -------------------------------- ### Install Java JDK on Windows via Chocolatey Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Installs the Java Development Kit (JDK) on Windows using the Chocolatey package manager. Users can specify a desired JDK version like `jdk8` or `jdk11`. Chocolatey must be installed prior to running this command. ```cmd choco install jdk8 ``` -------------------------------- ### Install Default Java JDK on Ubuntu/Debian Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Updates the package list and installs the default Java Development Kit on Ubuntu or Debian-based Linux distributions using `apt-get`. This ensures all necessary Java components are available for compilation and execution. ```bash sudo apt-get update sudo apt-get install default-jdk ``` -------------------------------- ### Start Kotlin REPL Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Initiates the Kotlin Read-Eval-Print Loop (REPL) for interactive code execution. The command starts the REPL, and the subsequent output shows the Kotlin and Java versions, along with prompts for help and quitting. ```Shell kotlinc ``` -------------------------------- ### Install Java JDK on macOS via Homebrew Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Updates Homebrew and then installs the Java Development Kit using Homebrew Cask on macOS. This ensures a compatible Java version for the examples, addressing potential issues with older pre-installed Java versions. ```bash brew update brew cask install java ``` -------------------------------- ### Run Gradle Tests for Atomic Kotlin Examples Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Executes all tests for the Atomic Kotlin examples using the Gradle wrapper. This command initiates the build process and runs the defined test suite, requiring an internet connection for the first run to download dependencies. ```bash ./gradlew test ``` ```cmd gradlew test ``` -------------------------------- ### Install OpenJDK 8 on Fedora/Redhat Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Installs OpenJDK version 8 on Fedora or Redhat-based Linux distributions using `yum`. This command requires root privileges to execute successfully. ```bash su -c "yum install java-1.8.0-openjdk" ``` -------------------------------- ### Create a New Directory Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Illustrates how to create a new directory using the `mkdir` command on Mac/Linux and `md` on Windows. The command is followed by the desired directory name. ```Linux/macOS Shell mkdir books ``` ```Windows Command Prompt md books ``` -------------------------------- ### Verify Java JDK Installation Version Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Checks the currently installed Java Development Kit version. This command outputs details about the Java runtime environment, confirming a successful installation and displaying the active JDK version. ```shell java -version ``` -------------------------------- ### Run Project Tests using Gradle Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Executes all defined tests for the project using the Gradle wrapper. This command validates the correctness of the code across different operating systems. ```Shell gradlew test ``` ```Shell ./gradlew test ``` -------------------------------- ### Perform Arithmetic in Kotlin REPL Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Demonstrates performing a simple arithmetic operation directly within the Kotlin REPL, showing immediate interactive feedback of the result. ```Kotlin 42 * 11.3 ``` -------------------------------- ### List Directory Contents Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Describes how to list files and subdirectories using `ls` (Mac/Linux) or `dir` (Windows). It also shows how to use wildcards (`*`) to filter listings based on file names or extensions. ```Linux/macOS Shell ls ls *.kt ls F*.kt ``` ```Windows Command Prompt dir dir *.kt dir F*.kt ``` -------------------------------- ### Generate Project Tests with Gradle Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Generates or recreates the 'TestExamples.java' file from source code, which is used for the project's test system. This step is usually not required as the file is typically kept up-to-date in the repository. ```Shell gradlew GenerateTests ``` -------------------------------- ### Check Kotlin Compiler Version Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Verifies the installed Kotlin compiler version from the command line, displaying detailed version information. ```Shell kotlin -version ``` -------------------------------- ### Change Directory in Shell Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Explains how to navigate directories using `cd`, `cd ..`, `pushd`, and `popd` commands. `pushd` and `popd` are useful for temporarily moving to a directory and returning to the previous one. ```Shell cd cd .. pushd popd ``` -------------------------------- ### Exit Kotlin REPL Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md This command is used within the Kotlin REPL to terminate the interactive session and return to the command line. ```Kotlin :quit ``` -------------------------------- ### Remove a File Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Explains how to delete a file using `rm` on Mac/Linux and `del` on Windows. The command is followed by the name of the file to be removed. ```Linux/macOS Shell rm somefile.kt ``` ```Windows Command Prompt del somefile.kt ``` -------------------------------- ### Run Generated Tests with Gradle Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Executes the tests defined in 'TestExamples.java' using the Gradle wrapper. This can be run separately from the main 'test' command and can also be called as a regular JUnit test class. ```Shell gradlew TestExamples ``` -------------------------------- ### Remove a Directory Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Details how to remove a directory and its contents. On Mac/Linux, `rm -r` is used, while Windows uses `deltree`. The command is followed by the directory name. ```Linux/macOS Shell rm -r books ``` ```Windows Command Prompt deltree books ``` -------------------------------- ### Run Packaged Kotlin Program from Command Line Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Details how to run a Kotlin program that is part of a package. The package name must precede the program name, separated by a dot, when executing with the `kotlin` command. ```Kotlin package bar ``` ```Shell kotlin bar.FooKt ``` -------------------------------- ### View Shell Command History Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Explains how to view the history of entered commands. Mac/Linux use the `history` command, while Windows users can press the F7 key. Mac/Linux history provides numbers for referring to commands for repetition. ```Linux/macOS Shell history ``` ```Windows Command Prompt F7 ``` -------------------------------- ### Grant Execute Permission to Gradle Wrapper Script Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Applies execute permissions to the `gradlew` script on Unix-like systems (Mac/Linux). This step is necessary to resolve 'Permission denied' errors when attempting to run Gradle commands. ```bash chmod +x ./gradlew ``` -------------------------------- ### Compile Kotlin Program from Command Line Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Demonstrates how to compile a Kotlin source file (`.kt`) using the `kotlinc` command-line compiler. Successful compilation results in a `.class` file, typically named by appending 'Kt' to the source file name. ```Kotlin kotlinc HelloWorld.kt ``` -------------------------------- ### Repeat Previous Shell Commands Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Describes methods for repeating previous commands in the shell. The 'up arrow' key works across all OS. Mac/Linux also support `!!` for the last command and `!n` for the nth command. ```Linux/macOS Shell !! !n ``` -------------------------------- ### Run Compiled Kotlin Program Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/README.md Explains how to execute a compiled Kotlin program (a `.class` file) using the `kotlin` command. The program name is derived from the source file name by appending 'Kt' and omitting the '.class' extension. ```Kotlin kotlin HelloWorldKt ``` -------------------------------- ### Grant Execute Permissions to `run.sh` on Unix-like Systems Source: https://github.com/bruceeckel/atomickotlinexamples/blob/master/etc/usingrun.md On OSX or Linux, if you encounter a 'Permission denied' error when attempting to execute `run.sh`, you must grant execute permissions to the script using the `chmod` command. ```Shell chmod +x ./run.sh ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.