394451 (3) [Avatar] Offline
Very basic stuff: On page 13 you write: Kotlin source code is normally stored in files with the extension .kt. The Kotlin
compiler analyzes the source code and generates .class files, just like the Java compiler does. The generated .class files are then packaged and executed using the standard procedure for the type of application you’re working on. In the simplest case,
you can use kotlinc command to compile your code from the command line, and use the java command to execute your code.

As you can see, kotlinc compiled Fox.kt into FoxKt.class, which java doesn't like.

Directory: C:\Junk\kotlin\k2

Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 24/02/2016 10:23 PM META-INF
-a---- 24/02/2016 10:23 PM 103 Fox.kt
-a---- 24/02/2016 10:23 PM 1109 FoxKt.class

PS C:\Junk\kotlin\k2> java FoxKt
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at FoxKt.main(Fox.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

Here is the Fox.kt file:

fun main(args: Array<String>smilie {
println("Fox. This is a challenge for TextPad, AMD, and Graeme.")

The command line instructions on the language site work correctly, so maybe something has changed?
Dmitry Jemerov (40) [Avatar] Offline
No, this hasn't changed. Kotlin code requires a runtime library, and you need to include it in the classpath in order to run the code.

The sentence in the book does not mean that you can use the kotlinc command and the java command without any further arguments to compile and run Kotlin code, and it's also not intended to give detailed instructions for compiling the code from the command line (this being Chapter 1, a high-level introduction to the language).
394451 (3) [Avatar] Offline
Thanks for the reply. Possibly you might consider, somewhere early in the text, a few instructions for people who want to type a brief "Hello World" style program into a text editor, save it in a file, compile and link it from the command line, and then execute it.
After all, if people try that, and don't link in runtime files, etc, (because they don't have to in java, and in C programming it is always discussed) they won't get upset with me. Possibly.
Dmitry Jemerov (40) [Avatar] Offline
I've added an example of the specific command lines that could be used to compile and run the code. Thanks for your feedback!