Skip to content

Commit 3efb08f

Browse files
committed
More refinements to the wording.
Signed-off-by: Dean Wampler <[email protected]>
1 parent 83a59a3 commit 3efb08f

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

README.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,29 @@ The `master` branch and the `3.X.Y` tag releases are for the third edition. The
1515

1616
> [!WARNING]
1717
> Scala 3 is evolving, as are the tools that support it. I try to keep the `main` branch up to date with the latest versions, including changing the examples as required to handle new and changed features (see, e.g., [issue #131](https://github.com/deanwampler/programming-scala-book-code-examples/issues/131)). Hence, sometimes an example (or how to run it) will be different from what you see in the book. So, if you are reading the book and want the examples exactly as they appear there, with the same tool versions used at that time, then grab the [`3.0.0-final`](https://github.com/deanwampler/programming-scala-book-code-examples/tree/3.0.0-final) release.
18-
>
19-
> In particular, running a scala program on the command line has changed as of 3.5.0. So, for example, at the top of page 12 of the book, change this command for running a program at the shell prompt:
20-
>
21-
> ```
22-
> $ cp="target/scala-3.0.0/classes/"
23-
> $ scala -classpath $cp progscala3.introscala.Hello2 Hello Scala World!
24-
> ```
25-
> to this:
26-
> ```
27-
> $ cp="target/scala-3.5.0/classes/" # Note the book has "3.0.0"
28-
> $ scala -classpath $cp --main-class progscala3.introscala.Hello2 -- Hello Scala World!
29-
> ```
30-
> Note the required `--main-class` (or `-M`) flag before the &ldquo;`main`&rdquo; class `progscala3.introscala.Hello2` and the `--` to separate `scala` command arguments from your programs' arguments. Use these changes for all subsequent examples in the book that use the `scala` command to run code.
31-
>
32-
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt. So, for example, the following still works as documented in the book:
33-
> ```
34-
> runMain progscala3.introscala.Hello2 Hello Scala World!
35-
> ```
36-
> (Use of `sbt` is discussed further below.)
18+
19+
In particular, running a `scala` command-line program has changed as of version 3.5.0. So, for example, at the top of page 12 of the book, this command is shown for running a program at the shell prompt:
20+
21+
```
22+
$ cp="target/scala-3.0.0/classes/"
23+
$ scala -classpath $cp progscala3.introscala.Hello2 Hello Scala World!
24+
```
25+
26+
Instead, use the following, where the latest Scala version (at the time of this writing...) is `3.7.4`:
27+
28+
```
29+
$ cp="target/scala-3.7.4/classes/"
30+
$ scala -classpath $cp --main-class progscala3.introscala.Hello2 -- Hello Scala World!
31+
```
32+
33+
Note the required `--main-class` (or `-M`) flag before the &ldquo;`main`&rdquo; class `progscala3.introscala.Hello2` and the `--` to separate `scala` command arguments from your program's arguments. Change all other command-line examples in the book the same way.
34+
35+
However, it appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt. So, for example, the following still works as documented in the book:
36+
37+
```
38+
runMain progscala3.introscala.Hello2 Hello Scala World!
39+
```
40+
(Use of `sbt` is discussed further below.)
3741

3842
> [!TIP]
3943
> Several sections offer troubleshooting tips if you encounter problems.

0 commit comments

Comments
 (0)