The Neko Platform

What is Neko?

Neko is a virtual machine. See the Neko website at for further information and see for information on virtual machines. The Neko VM is available on Microsoft Windows, Apple Macintosh and Linux computers. Neko allows Haxe code compiled for the Neko target to run on these computers.

How Do I Write Neko Code?

See Start Coding. Lets look at an actual example. Go to Arrays and look at the first Haxe code example which is in the Scores class. You have written the Haxe source code in Scores.hx. You compile the Haxe source code to Neko bytecode in a file from the command line like:
haxe -main Scores -neko scores.n

This tells the Haxe compiler that the target is Neko (from -neko) and the file containing the Neko bytecode is to be named scores.n.

You can run this Neko bytecode in the Neko VM from the command line like:
neko scores.n

When Should I Use Neko?

  1. Use Neko when you are learning to program in Haxe, especially if you are new to programming. Neko has a very simple, text-based user interface which uses the console or command line.
  2. Use Neko if you want to write prototypes of programs, or maybe test pieces of code to use in larger programs.
  3. Use Neko for server applications. The user interface is usually provided by the client program, e.g. a web page uses HTML elements. The or your local Haxe API will list the web commands available in Haxe and Neko.
  4. Use Neko with external libraries if you wish to make standalone applications with a GUI interface, e.g. using the Waxe library.

Neko Packages

Packages are collections of related classes to accomplish certain programming tasks. The Neko target has its own packages in the Haxe standard installation.

The Haxe API

Open the "Haxe API Documentation" in a web browser on your computer.

The documentation is divided into 2 sections. The first section (with black headings) has the target-specific packages of Haxe. The second section (with yellow headings) has the toplevel Haxe packages.

Target-Specific Packages

There are packages specifically for cpp, cs, flash, flash8, haxe, java, neko, php and sys targets (in Haxe 2.10). The package hierarchy can be expanded as needed by clicking on the black headings. You will see either another package (in black) or the class methods, typedefs, enums and variables (in yellow) are described.

For example, withing the neko package are further packages for:
  • db
  • io
  • net
  • vm
  • zip, e.g. has CRC32, Compress, Flush, Reader, Uncompress, Writer, ZipEntry classes

You use dot notation to access the methods or variables, like

Haxe Toplevel Packages

These are the standard Haxe classes shown in yellow when you first open the Haxe API documentation. They can be used in any Haxe application no matter what the target is. They are (in Haxe 2.10):
  • Array
  • ArrayAccess
  • ...
  • XmlType


The Neko installation package includes another program named nekotools which extends the functions of the Neko target. See

Nekotools Boot

The Haxe compiler will generate Neko code for my program which I can run on my Windows computer because I have the Neko VM already installed. How can someone, with a Windows computer which does not have the Neko VM installed, run my program?

Using our example from the Scores class above, I can type the following from the command line on my Windows computer:
nekotools boot scores.n

This will create a standalone Windows program (scores.exe) which does not need the Neko VM to run. I can create Macintosh or Linux programs in a similar way.

Go to for a tool that will build standalone binaries from a Haxe program for the Neko target. xCross will create three binaries, for Windows, OSX (Universal) and Linux with no required dependencies.

Nekotools Server

See for further information.

Create the "Hello World!" neko file as described in Start Coding. We can generate portable Neko bytecode to run on a web server across different OS using the "Dev WebServer". We will use Haxe instead of a language like PHP.

The Neko installation contains the development server. Change to the directory containing hello.n and start the server with:
nekotools server

You can connect to this server on your local machine using your web browser of choice by going to http://localhost:2000.

Configure the server by going to http://localhost:2000/server:config. Use Sys.setCwd() to set up the directory for the webserver's process with an absolute path if needed. Go to for further information.

Once you have developed the website, you would deploy your code on a production server like Apache. Read the previous reference for information on setting up the Apache mod_neko module. Go to for information on the Tora server for high-traffic websites.

Using Neko with a GUI

Many computer users are unused to the command line and will be unable to use your latest Haxe / Neko gem. They prefer to point and click on a Graphical User Interface. All is not lost! There is a GUI available for Neko. See for further information. Note that this is intended for more experienced developers as you will also need to use NME.

wxWidgets Library

This cross-platform GUI library allows developers to create applications for Windows, OSX and Linux computers. See for further details and source code.

Waxe GUI

There is an extensive series of blog articles at about setting up and using the Waxe GUI.