| This repository gathers Scala 3 code examples coming from various websites - mostly from the Dotty project - or written by ourself. In particular it includes build scripts (Ant files, Bash scripts, batch files, Gradle scripts, Make scripts, Maven scripts, PowerShell scripts) for experimenting with the Scala 3 language on a Windows machine. |
This document is part of a series of topics related to Scala 3 on Windows:
Ada, Akka, C++, COBOL, Component Pascal, Dafny, Dart, Deno, Docker, Erlang, Flix, Go, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, MySQL, Node.js, PowerShell, Rust, Spark, Spring, Standard ML, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.
This project depends on the following external software for the Microsoft Windows platform:
Optionally one may also install the following software:
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\as the installation directory for optional software tools (in reference to the/opt/directory on Unix).
For instance our development environment looks as follows (June 2026) 6:
C:\opt\apache-ant\ ( 40 MB) C:\opt\apache-maven\ ( 10 MB) C:\opt\bazel\ ( 47 MB) C:\opt\cfr-0.152\ ( 2 MB) C:\opt\Git\ (367 MB) C:\opt\gradle\ (138 MB) C:\opt\jacoco\ ( 10 MB) C:\opt\javafx-sdk-17.0.19\ (137 MB) C:\opt\javafx-sdk-21.0.11\ (138 MB) C:\opt\jdk-temurin-1.8.0u422-b05\ (189 MB) C:\opt\jdk-temurin-17.0.17_10\ (302 MB) C:\opt\jdk-temurin-21.0.9_10\ (327 MB) C:\opt\jitwatch-1.4.9\ ( 36 MB) C:\opt\mill\ ( 67 MB) C:\opt\msys64\ (5.5 GB) C:\opt\Python-3.11.1\ (299 MB) C:\opt\sbt\ (110 MB) C:\opt\scala-2.13.18\ ( 24 MB) C:\opt\scala-cli\ ( 95 MB) C:\opt\scala3-3.3.7\ ( 38 MB) C:\opt\scala3-3.7.4\ (131 MB) C:\opt\VSCode\ (341 MB)
:mag_right: Git for Windows provides a Bash emulation used to run
git.exefrom the command line (as well as over 250 Unix commands likeawk,diff,file,grep,more,mv,rmdir,sedandwc).
This project is organized as follows:
bin\*.bat
bin\cfr-0.152.zip
bin\3.0\{common.bat, scala.bat, scalac.bat, scaladoc.bat}
bin\3.1\{common.bat, scala.bat, scalac.bat, scaladoc.bat}
bin\3.2\{common.bat, scala.bat, scalac.bat, scaladoc.bat}
bin\dotty\
docs\
examples\{README.md, dotty-example-project, ..}
maven-plugins\{README.md, scala-maven-plugin, etc.}
myexamples\{README.md, 00_AutoParamTupling, ..}
plugin-examples\{README.md, DivideZero, ..}
rockthejvm-examples\{README.md, Enums, ..}
scala3\ (Git submodule)
semanticdb-examples\{README.md, hello, ..}
CONTRIBUTIONS.md
DEPS.md
README.md
RESOURCES.md
setenv.bat
UBUNTU_WSL.md
where
bin\ provides several utility batch files.bin\cfr-0.152.zip contains a zipped distribution of CFR.bin\3.2\ contains the batch commands for Scala 3.bin\dotty\ contains several batch files/bash scripts for building the Scala 3 software distribution on a Windows machine.docs\ contains Scala 3 related papers/articles (see file docs\README.md).examples\ contains Scala 3 examples grabbed from various websites (see file examples\README.md).maven-plugins\ presents our Maven plugin scala-maven-plugin.myexamples\ contains self-written Scala 3 examples (see file myexamples\README.md).plugin-examples\ contains Scala 3 plugin examples (see file plugin-examples\README.md).rockthejvm-examples\ contains Scala 3 code examples (see file rockthejvm-examples\README.md).scala3\ contains our fork of the scala/scala3 repository as a Github submodule.semanticdb-examples\ contains SemanticDB code examples (see file semanticdb-examples\README.md).CONTRIBUTIONS.md lists PRs and issues we reported so far.DEPS.md lists library dependencies of available Scala distributions.README.md is the Markdown document for this page.RESOURCES.md is the Markdown document presenting external resources.setenv.bat is the batch command for setting up our environment.UBUNTU_WSL.md presents a Scala 3 code examples in Ubuntu WSL.We also define a virtual drive – e.g. drive Y: – in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).
:mag_right: Inside batch file
setenv.batwe use the Windows external commandsubstto create virtual drives; for instance:> subst Y: %USERPROFILE%\workspace\dotty-examples
In the next section we give a brief description of the batch files present in this project.
We distinguish different sets of batch/bash commands:
setenv.bat – This batch command makes external tools such as maven.cmd, mill.bat and sbt.bat directly available from the command prompt (see section Project dependencies).
> setenv help Usage: setenv { <option> | <subcommand> } Options: -bash start Git bash shell instead of Windows command prompt -debug print commands executed by this script -verbose print progress messages Subcommands: help print this help message
Directory bin\ – This directory contains several utility batch files:
cleanup.bat removes the generated class files from every example directory (both in examples\ and myexamples\ directories).dirsize.bat <dir_path_1> .. prints the size in Kb/Mb/Gb of the specified directory paths.getnightly.bat downloads/installs the distribution from the latest Dotty nightly build.searchjars.bat <class_name> searches for the given class name into all Scala JAR files.timeit.bat <cmd_1> { & <cmd_2> } prints the execution time of the specified commands.touch.bat <file_path> updates the modification date of an existing file or creates a new one.
Directory bin\3.0\ - This directory contains batch files to be copied to the bin\ directory of the Scala 3 installation for versions prior to 3.0.2 in order to use the scalac.bat, scaladoc.bat and scala.bat commands on Microsoft Windows.
☛ Starting with version 3.0.2 those batch files are included in the Scala 3 software distribution (see PR#13006, itself based on PR#5444).
> dir /b c:\opt\scala3-3.3.8\bin common common.bat scala scala.bat scalac scalac.bat scaladoc scaladoc.bat
File bin\dotty\build.bat - This batch command generates the Scala 3 software distribution from the Windows command prompt.
File bin\dotty\build.sh - This bash command generates the Scala 3 software distribution from the Git Bash command prompt.
File examples\*\build.bat - Finally each example can be built/run using the build.bat command.
☛ We favor
build.batfor the following reasons:
- It matches user commands executed from the Windows command prompt.
- It provides subcommands for working with CFR, Scalafmt, JUnit and more.
- Code examples are simple (mostly one single source file).
- We don't need the
sbtmachinery (eg. library dependencies, sbt server).
> build Usage: build { <option> | <subcommand> } Options: -debug print commands executed by this script -explain set compiler option -explain -explain-types set compiler option -explain-types -main:<name> define main class name (default: Main) -print print IR after compilation phase 'lambdaLift' -scala2 use Scala 2 tools -scala3 use Scala 3 tools (default) -tasty compile both from source and TASTy files -timer print the execution time -verbose print progress messages Subcommands: clean delete generated files compile compile Java/Scala source files decompile decompile generated code with CFR doc generate HTML documentation help print this help message lint analyze Scala source files with Scalafmt run[:i] execute main class (instrumented execution: :i) test execute unit tests with JUnit Properties: (to be defined in SBT configuration file project\build.properties) main.class alternative to option -main:<name> main.args list of arguments to be passed to main class
Build tools
Code examples in directories examples\ and myexamples\ can also be built with the following tools as an alternative to the build.bat command (see examples\README.md and myexamples\README.md for more details):
| Build tool | Build file | Parent file | Usage example |
|---|---|---|---|
ant.bat |
build.xml |
build.xml |
antclean compile run |
bazel.exe |
BUILD |
n.a. | bazelrun :enum-Planet |
cmd.exe |
build.bat |
build clean run |
|
gradle.bat |
build.gradle |
common.gradle |
gradleclean build run |
make.exe |
Makefile |
Makefile.inc |
makeclean run |
mill.bat |
build.sc |
common.sc |
mill -i app |
mvn.cmd |
pom.xml |
pom.xml |
mvnclean compile test |
pwsh.exe |
build.ps1 |
- | pwsh -f build.ps1 clean run |
sbt.bat |
build.sbt |
n.a. | sbtclean compile run |
Decompiler tools
As an alternative to the standard javap.exe class decompiler one may use cfr.bat (simply extract bin\cfr-0.152.zip to c:\opt\) which prints Java source code instead of Java bytecode:
> cfr myexamples\00_AutoParamTupling\target\classes\myexamples\Main.class /* * Decompiled with CFR 0.152. */ package myexamples; import myexamples.Main$; public final class Main { public static void test01() { Main$.MODULE$.test01(); } public static void main(String[] arrstring) { Main$.MODULE$.main(arrstring); } public static void test02() { Main$.MODULE$.test02(); } }
Here is the console output from command javap.exe with option -c for the same class file:
> javap -c myexamples\00_AutoParamTupling\target\classes\myexamples\Main.class Compiled from "Main.scala" public final class myexamples.Main { public static void main(java.lang.String[]); Code: 0: getstatic #13 // Field myexamples/Main$.MODULE$:Lmyexamples/Main$; 3: aload_0 4: invokevirtual #15 // Method myexamples/Main$.main:([Ljava/lang/String;)V 7: return public static void test02(); Code: 0: getstatic #13 // Field myexamples/Main$.MODULE$:Lmyexamples/Main$; 3: invokevirtual #19 // Method myexamples/Main$.test02:()V 6: return public static void test01(); Code: 0: getstatic #13 // Field myexamples/Main$.MODULE$:Lmyexamples/Main$; 3: invokevirtual #22 // Method myexamples/Main$.test01:()V 6: return }
setenv.batWe execute command setenv.bat once to setup our development environment; it makes external tools such as bazel.exe, mvn.cmd, sbt.bat and git.exe directly available from the command prompt.
> setenv Tool versions: javac 17.0.19, scalac 2.13.18, scalac 3.3.8, scalafmt 3.7.17, ant 1.10.17, gradle 9.5.1, mvn 3.9.16, sbt 1.14.0, scala-cli 1.10.1, mill 1.0.6, bazel 8.5.0, cfr 0.152, make 4.4.1, python 3.11.1, jacoco 0.8.14, git 2.54.0, diff 3.12, bash 5.3.9(1) > where sbt scala-cli C:\opt\sbt\bin\sbt C:\opt\sbt\bin\sbt.bat C:\opt\scala-cli\scala-cli.exe
Other development tools such as javac.exe and scalac.bat are accessible through the corresponding environment variable, e.g. JAVA_HOME for javac.exe, SCALA_HOME resp. SCALA3_HOME for scalac.bat and PYTHON_HOME for python.exe.
> where javac INFO: Could not find files for the given pattern(s). > where /r %JAVA_HOME% javac C:\opt\jdk-temurin-17.0.19_10\bin\javac.exe > %JAVA_HOME%\bin\javac -version javac 17.0.16
Command setenv.bat -verbose also prints the tool paths and defined environment variables:
> setenv -verbose Tool versions: javac 17.0.19, scalac 2.13.18, scalac 3.3.8, scalafmt 3.7.12, ant 1.10.17, gradle 9.5.1, mvn 3.9.16, sbt 1.14.0, scala-cli 1.10.1, mill 1.0.6, bazel 8.5.0, cfr 0.152, make 3.81, python 3.11.1, jacoco 0.8.15, git 2.54.0, diff 3.12, bash 5.3.9(1) Tool paths: C:\opt\jdk-temurin-17.0.19_10\bin\javac.exe C:\opt\scala-2.13.18\bin\scalac.bat C:\opt\scala3-3.3.8\bin\scalac.bat %LOCALAPPDATA%\Coursier\data\bin\scalafmt.bat C:\opt\apache-ant\bin\ant.bat C:\opt\gradle\bin\gradle.bat C:\opt\mill\mill.bat C:\opt\apache-maven\bin\mvn.cmd C:\opt\sbt\bin\sbt.bat C:\opt\scala-cli\scala-cli.exe C:\opt\mill\mill.bat C:\opt\bazel\bazel.exe C:\opt\cfr-0.152\bin\cfr.bat C:\opt\make-3.81\bin\make.exe C:\opt\Python-3.11.1\python.exe C:\opt\jacoco\lib\jacococli.jar C:\opt\Git\bin\git.exe C:\opt\Git\usr\bin\diff.exe C:\opt\Git\bin\bash.exe Environment variables: "ANT_HOME=C:\opt\apache-ant" "BAZEL_HOME=c:\opt\bazel" "CFR_HOME=C:\opt\cfr-0.152" "COURSIER_DATA_DIR=%LOCALAPPDATA%\coursier\data" "COURSIER_HOME=C:\opt\coursier-2.1.7" "GIT_HOME=C:\opt\Git" "GRADLE_HOME=C:\opt\gradle" "JAVA_HOME=C:\opt\jdk-temurin-17.0.19_10" "JAVA17_HOME=C:\opt\jdk-temurin-17.0.19_10" "JAVA21_HOME=C:\opt\jdk-temurin-21.0.11_10" "JAVAFX_HOME=C:\opt\javafx-sdk-21.0.11" "MSVS_HOME=X:" "MSYS_HOME=C:\opt\msys64" "PYTHON_HOME=C:\opt\Python-3.11.1" "SBT_HOME=C:\opt\sbt" "SCALA_CLI_HOME=C:\opt\scala-cli" "SCALA_HOME=C:\opt\scala-2.13.18" "SCALA3_HOME=C:\opt\scala3-3.3.8" "SCALA3_NEXT_HOME=C:\opt\scala3-3.7.4" Path associations: I:\: => %USERPROFILE%\workspace-perso\dotty-examples
cleanup.batCommand cleanup.bat removes the output directories (ie. target\) from the example projects:
> cleanup Finished to clean up 2 subdirectories in Y:\dotty\cdsexamples Finished to clean up 16 subdirectories in Y:\dotty\examples Finished to clean up 12 subdirectories in Y:\dotty\myexamples
dirsize.bat {<dir_name>}Command dirsize.bat returns the size (in Kb, Mb or Gb) of the specified directory paths:
> dirsize examples myexamples c:\opt\scala3-3.3.8 c:\opt\jdk-temurin-17.0.19_10 Size of directory "examples" is 3.9 Mb Size of directory "myexamples" is 1.2 Mb Size of directory "c:\opt\scala3-3.3.8" is 35.7 Mb Size of directory "c:\opt\jdk-temurin-17.0.19_10" is 304.0 Mb
getnightly.batBy default command getnightly.bat downloads the library files of the latest Dotty nightly build available from the Maven Central Repository and saves them into directory out\nightly\.
> getnightly Usage: getnightly { <option> | <subcommand> } Options: -debug print commands executed by this script -timer print total execution time -verbose print download progress Subcommands: activate activate the nightly build library files download download nighty build files and quit (default) help print this help message restore restore the default Scala library files
Command getnightly.bat download with options -verbose also displays the download progress:
> getnightly -verbose download Delete directory "out\nightly" Download Scala 3 nightly files from Maven repository Downloading file scaladoc_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 4.7 Mb Downloading file scala2-library-tasty-experimental_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 3 Mb Downloading file scala3-library_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 1.2 Mb Downloading file scala3-interfaces-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 3.9 Kb Downloading file scala3-compiler_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 21.9 Mb Downloading file scala3-presentation-compiler_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 2 Mb Downloading file scala3-staging_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 41 Kb Downloading file scala3-language-server_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 149.6 Kb Downloading file tasty-core_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 94.7 Kb Downloading file scala3-library_sjs1_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 2 Mb Downloading file scala2-library-cc-tasty-experimental_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 3.1 Mb Downloading file scala3-tasty-inspector_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 17.4 Kb Downloading file scala3-sbt-bridge-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar ... 31.2 Kb Downloading file antlr4-runtime-4.7.2.jar ... 330 Kb Downloading file autolink-0.6.0.jar ... 15.7 Kb Downloading file compiler-interface-1.9.6.jar ... 110.4 Kb [...] Downloading file common ... 0 Kb Downloading file common.bat ... 0 Kb Converting file common.bat to DOS format Downloading file scala ... 1.6 Kb Downloading file scala.bat ... 1.7 Kb Converting file scala.bat to DOS format Downloading file scalac ... 2.6 Kb Downloading file scalac.bat ... 3 Kb Converting file scalac.bat to DOS format Downloading file scaladoc ... 2 Kb Downloading file scaladoc.bat ... 2.6 Kb Converting file scaladoc.bat to DOS format Finished to download 57 files to directory "%LOCALAPPDATA%\Temp\scala3-nightly" Retrieve revision for hash "457a463" from GitHub repository "lampepfl/dotty" File "%LOCALAPPDATA%\Temp\scala3-nightly\VERSION": version:=3.7.2-RC1-bin-20250528-457a463-NIGHTLY revision:=457a463 buildTime:=2025-10-21 20:45:40+02:00
Output directory %TEMP%\scala3-nightly\ contains the two subdirectories bin\ and lib\:
> dir /b %TEMP%\scala3-nightly\bin %TEMP%\scala3-nightly\lib common common.bat scala scala.bat scalac scalac.bat scaladoc scaladoc.bat antlr-runtime-4.7.2.jar autolink-0.6.0.jar [...] scala-asm-9.6.0-scala-1.jar scala-library-2.13.12.jar scala2-library-cc-tasty-experimental_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala2-library-tasty-experimental_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-compiler_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-interfaces-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-language-server_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-library_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-library_sjs1_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-presentation-compiler_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-sbt-bridge-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-staging_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scala3-tasty-inspector_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar scaladoc_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar snakeyaml-2.0.jar strftime4j-1.0.6.jar tasty-core_3-3.7.2-RC1-bin-20250528-457a463-NIGHTLY.jar
Concretely, subcommand activate switches to the nightly build version and subcommand restore restore the path to the Scala 3 installation directory.
> getnightly activate Active Scala 3 installation is 3.7.2-RC1-bin-20250528-457a463-NIGHTLY (was 3.3.7) > %SCALA3_HOME%\bin\scalac -version Scala compiler version 3.7.2-RC1 -- Copyright 2002-2025, LAMP/EPFL > getnightly restore Active Scala 3 installation is 3.3.7 > %SCALA3_HOME%\bin\scalac -version Scala compiler version 3.3.7 -- Copyright 2002-2024, LAMP/EPFL
:warning: You need write access to the Scala 3 installation directory (e.g.
C:\opt\scala3-3.3.7\in our case) in order to successfully run theactivate/resetsubcommands.
searchjars.bat <class_name>Command searchjars.bat helps us to search for class file names in the following directories: project's lib\ directory (if present), Scala's lib\ directory, Java's lib\ directory and Ivy/Maven default local directories.
> searchjars -help Usage: searchjars { <option> | <class_name> } Options: -artifact search in ~\.ivy2 and ~\.m2 directories -help print this help message -ivy search in ~\.ivy directory -java search in Java library directories -maven search in ~\.m2 directory -scala search in Scala library directories -verbose print progress messages Arguments: <class_name> class name
For instance we get the following output when passing class name System to command searchjars.bat (class file names are printed with full path and are prefixed with their containing JAR file):
> searchjars System Searching for class name System in archive files C:\opt\scala3-3.3.8\lib\*.jar jline-reader-3.19.0.jar:org/jline/reader/impl/completer/SystemCompleter.class scala-library-2.13.15.jar:scala/sys/SystemProperties$.class scala-library-2.13.15.jar:scala/sys/SystemProperties.class Searching for class name System in archive files C:\opt\scala-2.13.18\lib\*.jar jline-3.19.0.jar:org/jline/builtins/SystemRegistryImpl$CommandOutputStream.class [...] scala-library.jar:scala/sys/SystemProperties$.class scala-library.jar:scala/sys/SystemProperties.class Searching for class name System in archive files C:\opt\jdk-temurin-17.0.19_10\lib\*.jar jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystem$1.class [...] jrt-fs.jar:jdk/internal/jrtfs/SystemImage$2.class jrt-fs.jar:jdk/internal/jrtfs/SystemImage.class Searching for class name System in archive files c:\opt\javafx-sdk-17.0.19_10\lib\*.jar javafx.graphics.jar:com/sun/glass/ui/SystemClipboard.class [...] javafx.graphics.jar:com/sun/javafx/tk/TKSystemMenu.class javafx.web.jar:com/sun/webkit/FileSystem.class
Searching for an unknown class name - e.g. BinarySearch - produces the following output:
> searchjars BinarySearch Searching for class name BinarySearch in archive files C:\opt\scala3-3.3.8\lib\*.jar Searching for class name BinarySearch in archive files C:\opt\scala-2.13.18\lib\*.jar Searching for class name BinarySearch in archive files C:\opt\jdk-temurin-17.0.17_10\lib\*.jar
Searching for FileSystem with option -artifact produces the following output:
> searchjars FileSystem -artifact Searching for class name FileSystem in archive files C:\opt\scala3-3.3.8\lib\*.jar Searching for class name FileSystem in archive files C:\opt\scala-2.13.18\lib\*.jar Searching for class name FileSystem in archive files c:\opt\jdk-temurin-17.0.19_10\lib\*.jar jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystem$1.class jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystem.class jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystemProvider$1.class jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystemProvider$JrtFsLoader.class jrt-fs.jar:jdk/internal/jrtfs/JrtFileSystemProvider.class Searching for class name FileSystem in archive files c:\opt\javafx-sdk-17\lib\*.jar javafx.web.jar:com/sun/webkit/FileSystem.class Searching for class name FileSystem in archive files %USERPROFILE%\.ivy2\cache\*.jar okhttp-3.14.2.jar:okhttp3/internal/io/FileSystem$1.class okhttp-3.14.2.jar:okhttp3/internal/io/FileSystem.class ivy-2.3.0-sbt-839fad1cdc07cf6fc81364d74c323867230432ad.jar:org/apache/ivy/plugins/resolver/FileSystemResolver.class ivy-2.3.0-sbt-88d6a93d15f9b029958c1c289a8859e8dfe31a19.jar:org/apache/ivy/plugins/resolver/FileSystemResolver.class ivy-2.3.0-sbt-fa726854dd30be842ff9e6d2093df6adfe3871f5.jar:org/apache/ivy/plugins/resolver/FileSystemResolver.class Searching for class name FileSystem in archive files %USERPROFILE%\.m2\repository\*.jar commons-io-2.2.jar:org/apache/commons/io/FileSystemUtils.class commons-io-2.5.jar:org/apache/commons/io/FileSystemUtils.class commons-io-2.6.jar:org/apache/commons/io/FileSystemUtils.class ivy-2.4.0.jar:org/apache/ivy/plugins/resolver/FileSystemResolver.class sigar-1.6.4.jar:org/hyperic/sigar/FileSystem.class [...] stagemonitor-os-0.88.9.jar:org/stagemonitor/os/metrics/FileSystemMetricSet.class
timeit.bat <cmd_1> { & <cmd_i> }Batch file timeit.bat prints the execution time (hh:MM:ss format) of the specified command (possibly given with options and parameters):
> timeit dir /b .gitignore .gradle build.bat build.gradle build.sbt build.sc build.xml pom.xml project settings.gradle src target Execution time: 00:00:01 > timeit build clean compile Execution time: 00:00:08
Chaining of commands is also possible. Note that the command separator (either && or &) must be escaped if the command chain is not quoted. For instance:
> timeit build clean compile ^&^& ant run ... Execution time: 00:00:11 > timeit "build clean compile && ant run" ... Execution time: 00:00:11
:mag_right: The
&&command separator performs error checking - that is, the commands to the right of the&&command run if and only if the command to the left of&&succeeds. The&command does not perform error checking - that is, all commands run.
build.batBatch file build.bat is a basic build script consisting of ~800 lines of batch/Powershell code 7.
Running command build.bat with no option in project examples\enum-Planet generates the following output:
> build clean compile run Your weight on MERCURY (0) is 0.37775761520093526 Your weight on SATURN (5) is 1.0660155388115666 Your weight on VENUS (1) is 0.9049990998410455 Your weight on URANUS (6) is 0.9051271993894251 Your weight on EARTH (2) is 0.9999999999999999 Your weight on NEPTUNE (7) is 1.1383280724696578 Your weight on MARS (3) is 0.37873718403712886 Your weight on JUPITER (4) is 2.5305575254957406
More usage examples are presented in examples\README.md resp. myexamples\README.md
scala.batScala REPL is an interactive tool for evaluating Scala expressions. Internally, it executes a source script by wrapping it in a template and then compiling and executing the resulting program.
:warning: Batch file
scala.batis based on the bash scriptscalaavailable from the standard Scala 3 distribution. We also have submitted pull request #5444 to add that batch file to the Scala 3 distribution.
> where scala C:\opt\scala3-3.3.8\bin\scala C:\opt\scala3-3.3.8\bin\scala.bat > scala -version Scala code runner version 3.3.8 -- Copyright 2002-2026, LAMP/EPFL > scala Starting scala REPL... scala> :help The REPL has several commands available: :help print this summary :load <path> interpret lines in a file :quit exit the interpreter :type <expression> evaluate the type of the given expression :imports show import history :reset reset the repl to its initial state, forgetting all session entries scala> System.getenv().get("JAVA_HOME") val res0: String = C:\opt\jdk-temurin-17.0.19_10 scala> System.getenv().get("SCALA3_HOME") val res1: String = C:\opt\scala3-3.3.8 scala> :load myexamples/HelloWorld/src/main/scala/HelloWorld.scala // defined object HelloWorld scala> HelloWorld.main(Array()) Hello world! scala>:quit
[1] Scala 3 LTS versions ↩
The distinction between LTS and Next versions of Scala 3 is presented on the page "Long-term compatibility plans for Scala 3" posted on August 17, 2022.
In particular it makes the following statement : "We suggest end users stick to the LTS version. It will give you the best tooling support and a stable compiler. If you are migrating a bigger project from Scala 2, you should migrate it straight to the newest LTS."
[2] Java LTS versions ↩
| Java LTS Version | GA | End of life |
|---|---|---|
| 25 | September 2025 | September 2033 |
| 21 | September 2023 | September 2031 |
| 17 | September 2021 | September 2029 |
| 11 | September 2018 | September 2026 |
| 8 | March 2014 | December 2030 (1) |
[3] Using Bazel on Windows ↩
| Bazel LTS Version | GA | End of support |
|---|---|---|
| 9.1.1 | June 2026 | December 2028 |
| 8.7.0 | December 2024 | December 2027 |
| 7.7.1 | October 2024 | December 2026 |
| 7.3.1 | December 2023 | December 2026 |
| 6.6.0 | December 2022 | December 2025 |
| 5.4.1 | January 2022 | January 2024 |
BAZEL_VC to the Visual C++ Build Tools installation directory:
> set "BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC"
[4] JaCoCo and Java support ↩
| JaCoCo version | Supported Java version | Depends on ASM |
|---|---|---|
| 0.8.15 (June 2026) | 26 and 27 (experimental) | 9.10.1 |
| 0.8.14 (October 2025) | 25 and 26 (experimental) | 9.9 |
| 0.8.11 (October 2023) | 21 and 22 (experimental) | 9.6 |
| 0.8.10.2 (April 2023) | 19 and 20 | 9.5 |
| 0.8.9 (March 2023) | 19 and 20 | 9.5 |
| 0.8.8 (April 2022) | 17 and 18 | 9.2 |
| 0.8.7 (May 2021) | 15 and 16 | 9.1 |
| 0.8.6 (Sept 2020) | 14 | 8.2 |
| 0.8.5 (Oct 2019) | 13 | 7.2 |
| 0.8.4 (May 2019) | 12 | 7.1 |
| 0.8.3 (Jan 2019) | 11 | 7.0 |
| 0.8.2 (Aug 2018) | 6.3.2 | |
| 0.8.1 (March 2018) | 10 | |
| 0.8.0 (Jan 2018) | 9 | 6.0 |
[5] Updating Mill ↩
> dir /b /s c:\opt\mill c:\opt\mill\mill.bat > findstr Script c:\opt\mill\mill.bat rem Script Version: 1.0.6we download the batch file
mill-dist-1.0.6-mill.bat from the following 1.0.6 distribution page, rename it and overwrite our local file mill.bat.
> mill --version | findstr Mill Mill Build Tool version 1.0.6
[6] Scala 3 Next ↩
| Scala 3 Version | TGZ Archive size | Installation size |
|---|---|---|
| 3.3.7 LTS | 36 MB | 38.8 MB |
| 3.5.0 Next | 70 MB | 131 MB |
| 3.7.0 Next | 73 MB | 153 MB |
scala-cli (91 MB) from VIRTUSLAB is now part of the distributionlib\ now contains only 3 JAR files: .maven2\ (40 MB) is new; this application specific Maven repository contains the Maven packages Scala 3 depends on.Class-Path. We present its usage in the manifest file lib\scala.jar\META-INF\MANIFEST.MF :
Manifest-Version: 1.0 Class-Path: ../maven2/org/scala-lang/scala3-interfaces/3.5.0/scala3-in terfaces-3.5.0.jar ../maven2/org/scala-lang/scala3-compiler_3/3.5.0/s cala3-compiler_3-3.5.0.jar ../maven2/org/scala-lang/scala3-library_3/ 3.5.0/scala3-library_3-3.5.0.jar ../maven2/org/scala-lang/tasty-core_ 3/3.5.0/tasty-core_3-3.5.0.jar ../maven2/org/scala-lang/modules/scala -asm/9.7.0-scala-1/scala-asm-9.7.0-scala-1.jar ../maven2/org/scala-sb t/compiler-interface/1.9.6/compiler-interface-1.9.6.jar ../maven2/org /jline/jline-reader/3.25.1/jline-reader-3.25.1.jar ../maven2/org/jlin e/jline-terminal/3.25.1/jline-terminal-3.25.1.jar ../maven2/org/jline /jline-terminal-jna/3.25.1/jline-terminal-jna-3.25.1.jar ../maven2/or g/scala-lang/scala-library/2.13.15/scala-library-2.13.15.jar ../maven 2/org/scala-sbt/util-interface/1.9.8/util-interface-1.9.8.jar ../mave n2/org/jline/jline-native/3.25.1/jline-native-3.25.1.jar ../maven2/ne t/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
[6] Downloads ↩
0.12.9-assembly (mill)(see Footnote 5)( 64 MB)apache-ant-1.10.17-bin.zip ( 9 MB) apache-maven-3.9.16-bin.zip ( 10 MB) bazel-9.1.1-windows-x86_64.zip ( 40 MB) gradle-9.5.1-bin.zip (124 MB) jacoco-0.8.14.zip ( 4 MB) jitwatch-ui-1.4.9-shaded-win.jar ( 36 MB) msys2-x86_64-20240727.exe ( 94 MB) OpenJDK8U-jdk_x64_windows_hotspot_8u442b06.zip ( 99 MB) OpenJDK17U-jdk_x64_windows_hotspot_17.0.17_10.zip (188 MB) OpenJDK21U-jdk_x64_windows_hotspot_21.0.9_10.zip (191 MB) openjfx-17.0.19_windows-x64_bin-sdk.zip ( 39 MB) openjfx-17.0.19_windows-x64_bin-jmods.zip ( 37 MB) openjfx-21.0.11_windows-x64_bin-sdk.zip ( 39 MB) openjfx-21.0.11_windows-x64_bin-jmods.zip ( 37 MB) PortableGit-2.54.0-64-bit.7z.exe ( 60 MB) sbt-2.0.0-RC14.zip ( 17 MB) scala-2.13.18.zip ( 22 MB) scala-cli-x86_64-pc-win32.zip ( 31 MB) scala3-3.3.8.zip ( 34 MB) scala3-3.7.4.zip (123 MB)
[7] PowerShell ↩