1# Ceylon 2 3This is the 1.3.3 _"Contents May Differ"_ release of the Ceylon 4command line tools. This is a production version of the platform. 5 6Ceylon is a modern, modular, statically typed programming language 7for the Java and JavaScript virtual machines. The language features 8a flexible and very readable syntax, a unique and uncommonly elegant 9static type system, a powerful module architecture, and excellent 10tooling, including an awesome Eclipse-based IDE. 11 12Ceylon enables the development of cross-platform modules which execute 13portably in both virtual machine environments. Alternatively, a Ceylon 14module may target one or the other platform, in which case it may 15interoperate with native code written for that platform. 16 17Read more about Ceylon at <http://ceylon-lang.org>. 18 19## First steps 20 21If you installed Ceylon using your system's or a third-party's package 22manager like apt-get, dnf, sdkman or brew there's nothing more for you 23to do, everything should just work fine. 24 25If on the other hand you downloaded and extracted the ZIP file you 26will see the following files and folders: 27 28- `bin` - Unix/Windows commands 29- `contrib` - Sample Ceylon command-line plugins 30- `doc` - Documentation about Ceylon including the spec in HTML and PDF format 31- `lib` - Required libraries for the Ceylon commands 32- `repo` - Required bootstrap Ceylon modules (language, tools) 33- `samples` - Sample Ceylon modules 34- `templates` - Templates for new Ceylon projects 35- `BUILDID` - The Git commit id used to build this distribution 36- `LICENSE-ASL` - The Ceylon ASL license 37- `LICENSE-GPL-CP` - The Ceylon GPL/CP license 38- `LICENSE-LGPL` - The Ceylon LGPL license 39- `NOTICE` - 3rd party licenses 40- `README.md` - This file 41 42The all-important `ceylon` command that is used for everything from 43compiling and running code to creating projects and copying modules 44can be found in the `bin` folder. 45 46For ease of use you might want to consider adding the `ceylon` command 47to your `PATH`. 48 49- On Linux and Mac you can do this either by adding the `bin` folder 50to your `PATH` environment variable or by creating a symbolic link to 51`bin/ceylon` in an appropriate place like `~/bin`. 52 53- On Windows you can search for "advanced system settings", click the 54"Environment Variables" button and add the path to the `bin` folder to 55the `PATH` variable. 56 57NB: If you don't add Ceylon to your path you will have to always type 58the path to the `bin/ceylon` command. So in every example that follows 59you'll need to change `ceylon` to `/path/to/ceylon-1.3.3/bin/ceylon`. 60 61## Trying it out 62 63To see if Ceylon was installed correctly type (the `$` is an indication 64of your command line prompt and should *not* be typed when trying these 65examples): 66 67 $ ceylon --version 68 69You should see something like: 70 71 ceylon version 1.3.3 1cac978 (Contents May Differ) 72 73## Tool usage 74 75To see the list of subcommand that `ceylon` supports just type: 76 77 $ ceylon 78 79You should see a short synopsis and then a list of subcommands like this 80(you might see more options): 81 82 * `bootstrap` - Generates a Ceylon bootstrap script in the current directory 83 * `browse` - Open module documentation in the browser 84 * `classpath` - Print a classpath suitable for passing to Java tools to run a given Ceylon module 85 * `compile` - Compile a Ceylon program for the Java backend 86 * `compile-js` - Compile a Ceylon program for the JavaScript backend 87 * `config` - Manage Ceylon configuration files 88 * `copy` - Copy modules from one module repository to another 89 * `doc` - Document a Ceylon program 90 * `fat-jar` - Generate a Ceylon executable jar for a given module 91 * `help` - Display help about another tool 92 * `info` - Print information about modules in repositories 93 * `jigsaw` - Tools to interop with Java 9 (Jigsaw) modules 94 * `import-jar` - Import a Java `.jar` file into a Ceylon module repository 95 * `new` - Generate a new Ceylon project 96 * `plugin` - Package or install command-line plugins 97 * `run` - Run a Ceylon program on the Java VM 98 * `run-js` - Run a Ceylon program on node.js (JavaScript) 99 * `src` - Fetch source archives from a repository and extract them 100 * `test` - Test a Ceylon program on the Java VM 101 * `test-js` - Test a Ceylon program on node.js (JavaScript) 102 * `version` - Show and update version numbers in module descriptors 103 * `war` - Generate a WAR file from a compiled `.car` file 104 105Then to see a more detailed explanation of a particular subcommand, 106use the `help` subcommand. For example, to get help on the `compile` 107subcommand type: 108 109 $ ceylon help compile 110 111## Running the sample programs 112 113The `samples` folder contains several small sample programs. To compile 114and run them, refer to the file `README.md` contained in the `samples` 115folder for further instructions. 116 117## Write some code 118 119A very easy we to quickly set up a module to compile is to use the 120`ceylon new` command which creates the basic folder structure with the 121necessary files. Create an empty folder, change into it and type: 122 123 $ ceylon new hello-world 124 125It will then ask you a series of questions: 126 127 Enter project folder name [helloworld]: . 128 Enter module name [com.example.helloworld]: my.first.module 129 Enter module version [1.0.0]: 130 Would you like to generate Eclipse project files? (y/n) [y]: 131 Enter Eclipse project name [my.first.module]: 132 Would you like to generate an ant build.xml? (y/n) [y]: 133 134In the above example we've accepted almost all the defaults except for 135the project folder name which we've changed to the current folder `.` 136and the name of the module where we've chosen "my.first.module". After 137it has finished the command will have created some source files, an Ant 138build file and will have prepared the project to be opened in Eclipse 139if you want. 140 141You can now type: 142 143 $ ceylon compile my.first.module 144 Note: Created module my.first.module/1.0.0 145 $ ceylon run my.first.module/1.0.0 146 Hello, World! 147 148to compile and run the newly created module. (You can also type `ant` 149if you let the tool create Ant build files). 150 151We'll be making a small change to the code so you can see what files 152are involved. For this run you favorite editor, here we'll just use 153`vi`: 154 155 $ vi source/my/first/module/run.ceylon 156 157Now change the second line to read: 158 159 shared void hello(String name = "Ceylon") { 160 161and save and exit. When you now repeat the compile and run commands 162the output should read: 163 164 Hello, Ceylon 165 166This is the very simplistic start of an interesting journey in learning 167to program in Ceylon. For much more information continue to the next 168section. 169 170## Learn more 171 172If you want to learn more about Ceylon you can go to the 173[documentation][] section of the Ceylon web site, where you'll 174find a [tour][], a [walkthrough][], and much more. 175 176[documentation]: http://www.ceylon-lang.org/documentation/current/ 177[tour]: http://www.ceylon-lang.org/documentation/current/tour/ 178[walkthrough]: http://www.ceylon-lang.org/documentation/current/walkthrough/ 179 180## Source code 181 182The source code for Ceylon is completely Open Source and freely 183available from <http://github.com/ceylon>. 184 185## Issues 186 187If you find a bug or have a suggestion or request, you may report 188it in the GitHub [issue tracker][]. 189 190[issue tracker]: http://github.com/ceylon/ceylon/issues 191 192## Contributing 193 194We're always looking for help, so if you would like to contribute 195in any way look [here](http://www.ceylon-lang.org/code/contribute/) 196for more information. 197 198## The Community 199 200If you have any questions or want to join the developers in their 201discussions about current and future developments of the Ceylon 202language or just chat with other users you can find a full list 203of [possible channels][community] at the Ceylon web site. Good 204options include: 205 206- the [user mailing list][], and 207- the [user Gitter channel][]. 208 209You can follow @ceylonlang on twitter. 210 211[community]: http://www.ceylon-lang.org/community/ 212[user mailing list]: http://groups.google.com/group/ceylon-users 213[user Gitter channel]: https://gitter.im/ceylon/user 214 215## License 216 217The Ceylon distribution is and contains work released 218 219- partly under the ASL v2.0 as provided in the `LICENSE-ASL` file 220 that accompanied this code, and 221- partly under the GPL v2 + Classpath Exception as provided in the 222 `LICENSE-GPL-CP` file that accompanied this code. 223 224### License terms for 3rd Party Works 225 226This software uses a number of other works, the license terms of 227which are documented in the `NOTICE` file that accompanied this code. 228 229## Acknowledgement 230 231We're deeply indebted to the community volunteers who contributed a 232substantial part of the current Ceylon code base, working often in 233their own spare time. 234