Skip to content

Commit 84f5582

Browse files
committed
Used the example on page 12, the first one that breaks with 3.5 changes.
Signed-off-by: Dean Wampler <[email protected]>
1 parent 8520271 commit 84f5582

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ The `master` branch and the `3.X.Y` tag releases are for the third edition. The
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.
1818
>
19-
> In particular, running a scala program on the command line has changed as of 3.5.0. So, for example, on page 18 of the book, change this command for running a program at the shell prompt:
20-
>
21-
> `$ scala -cp . -M progscala3.introscala.UpperMain1 hello computed world!`
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:
2220
>
21+
> ```
22+
> $ cp="target/scala-3.5.0/classes/" # Note the book has "3.0.0"
23+
> $ scala -classpath $cp progscala3.introscala.Hello2 Hello Scala World!
24+
> ```
2325
> to this:
26+
> ```
27+
> $ cp="target/scala-3.5.0/classes/" # Note the book has "3.0.0"
28+
> $ scala -classpath $cp -M progscala3.introscala.Hello2 -- Hello Scala World!
29+
> ```
30+
> Note the required `-M` (or `--main-class`) flag before the &ldquo;`main`&rdquo; class and the `--` to separate `scala` arguments from your programs arguments. Use these changes for all subsequent examples in the book that use the `scala` command to run code.
2431
>
25-
> `$ scala -cp . -M progscala3.introscala.UpperMain1 -- hello computed world!`
26-
>
27-
> Note the required `--` to separate `scala` arguments from your programs arguments. Use this change for all subsequent examples in the book that use the `scala` command to run code.
28-
>
29-
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt:
30-
>
31-
> `> runMain progscala3.introscala.UpperMain1 hello computed world!`
32-
>
33-
> Use of `sbt` is discussed further below.
32+
> It appears that `sbt` syntax has **not** changed when using `runMain` at the SBT prompt, for example:
33+
> ```
34+
> runMain progscala3.introscala.Hello2 Hello Scala World!`
35+
> ```
36+
> (Use of `sbt` is discussed further below.)
3437
3538
> [!TIP]
3639
> Several sections offer troubleshooting tips if you encounter problems.

0 commit comments

Comments
 (0)