Articles

Getting Started

At the moment, there are two ways you can run Whiley: via the Whiley Developement Kit or the simple Web IDE.

Whiley Development Kit (WDK)

The Whiley Development Kit (WDK) includes all the libraries necessary to run the wy tool from the command-line.  In addition, it includes various examples and documentation. You can download the latest version of the WDK from here. In principle, the system should run out-of-the-box although, in practice, it’s easier to set up under UNIX.  If you want to run Whiley on a Windows machine, then I would highly recommend installing Cygwin – a UNIX environment for Windows (alternatively, download the executable jar discussed above).

After expanding the WDK tarball, set your PATH environment variable to point to the bin/ directory, and then you should be ready to go.  For example, let’s compile the classic hello world example.:

% cd examples
% wy jvmcompile hello_world.whiley

Here, we are employing the wy tool to compile the whiley file into JVM bytecode, and you should see a file called hello_world.class is generated.  To run the compiled program, we use the wy tool as follows:

% wy jvmrun hello-world
Hello World

If you make the program run and see it print “Hello World” as above, then you’ve got Whiley working!  To find out more about the various command-line options available, run wy --help.

Simple Web IDE

A simple web IDE is available which allows you to run Whiley on your computer using a web browser.  The following screenshot illustrates:


To setup the Web IDE, simple clone the WhileyWeb repository from github:

% git clone git@github.com:Whiley/WhileyWeb.git
Cloning into 'WhileyWeb'...
remote: Counting objects: 220, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 220 (delta 0), reused 4 (delta 0), pack-reused 213
Receiving objects: 100% (220/220), 5.98 MiB | 163.00 KiB/s, done.
Resolving deltas: 100% (76/76), done.
Checking connectivity... done.

At this point, you can run the web IDE from the command line using ant (if you have that installed) as follows:

% ant run

Then, just point your web browser to localhost:8080 to access the IDE. Alternatively, you can create a project in Eclipse and run the Web IDE from there.