Repository navigation
Your First Project
This page shows how to create a new Haxe project or open an existing one, what the plugin sets up for you, and how to build and run your first program. It assumes you have installed the plugin and registered a Haxe SDK; if not, start with Installation.
Open the New Project dialog: click New Project on the Welcome screen, or choose File | New | Project. The plugin adds two entries to it:
| Entry | Where in the dialog | What it creates |
|---|---|---|
| Haxe | In the list of languages on the left | A module with a src folder. With Add sample code selected, also src/Main.hx and a build.hxml that runs Main in the Haxe interpreter. |
| Haxe Template | Under Generators on the left | A project from a template: Empty, HXML, Lime, OpenFL, NME or Haxelib. The templates ask for the settings their build files need. |
Both entries have a Haxe SDK: field. Pick a registered Haxe SDK, or add one from the field's drop-down list. The SDK you pick becomes the project default.

The Haxe and Haxe Template entries in the New Project dialog
The Haxe Template entry offers these templates:
| Template | Fields | Files it creates |
|---|---|---|
| Empty | none | A module with a src folder |
| HXML | Target:, Main class:, Dead code elimination:, Output:; Generate source map for JavaScript; Stage:, FPS:, Background: and SWF version: for Flash |
src/<Main class>.hx and build.hxml
|
| Lime, OpenFL | Target:, Application name:, Package:, Window size: and FPS: |
project.xml and src/Main.hx
|
| NME | the same as Lime |
project.nmml and src/Main.hx
|
| Haxelib | Library name:, License:, Version:, Description:, URL:, Tags:, Contributors: and Release note: |
haxelib.json, a starter class in src, and dev.hxml, a build file for IDE support (completion and diagnostics) that compiles the library with --interp
|
The targets the HXML template offers
- HashLink (VM bytecode)
- HashLink (HL/C sources)
- JavaScript
- Neko
- C++ (hxcpp)
- JVM (.jar)
- Java (generated sources)
- C# (generated sources)
- PHP
- Python
- Lua
- Flash
- Eval (interpreter)
The targets the Lime and OpenFL templates offer by default
- HTML5
- Windows
- Mac OS
- Linux
- HashLink
- Neko
- Raspberry Pi
- Flash
- Adobe AIR
- Android
- iOS
- tvOS
- WebAssembly
- Electron
The targets the NME template offers by default
- Desktop (C++)
- Cppia
- Android
- Android (library view)
- Android (simulator)
- iOS
- iOS (device debugging)
- iOS (simulator)
- iOS (library view)
- watchOS
- watchOS (simulator)
- Flash
- Windows
- Windows Arm64
- WinRT / UWP
- Mac OS
- Linux
- Raspberry Pi
- RG350 console
- Neko
- HTML5 (jsprime)
The Output: field follows the target you pick until you edit it; Eval (interpreter) writes no output, so it has no Output: field. For Lime, OpenFL and NME, the Target: list comes from Settings | Languages & Frameworks | Haxe | Frameworks; see Targets and Sections.
Every template also has a Haxelib repository: field:
- Global: libraries come from your haxelib repository, as set up in Installation.
-
Local (.haxelib): creates a
.haxelibfolder in the project. haxelib then installs and finds libraries for this project in that folder. The folder is excluded from the module's sources.
The generated build file becomes the project's active build file and the module's Build command, so the project builds right away. For Lime, OpenFL and NME, the target you picked becomes the build file's selected target. Core Concepts explains these terms.
A Lime, OpenFL or NME project needs its framework library. If haxelib does not have it yet, the library shows in red in the Haxe tool window: right-click the build file's Libraries node and choose Install All Missing Libraries.
Tip
The files the templates create come from editable file templates. Change them under Settings | Editor | File and Code Templates, on the Other tab, in the Haxe project group.

The Haxe project group on the Other tab; select a template to edit its text on the right
- Choose File | Open and select the folder that contains your build file, for example
build.hxmlorproject.xml. - IntelliJ IDEA asks whether you trust the project. See Trust the project.
- Open the Haxe tool window: View | Tool Windows | Haxe. By default it sits on the right side of the window.
Important
A project set up with version 1.x of the plugin needs a one-way conversion first. See Migrating from 1.x.
When the project opens, the plugin does this for you:
-
Build files. hxml files, Lime and OpenFL project files, NME
.nmmlfiles and.hxpfiles at the top level of the project folder and of each module's folder show up in the Haxe tool window. Files in subfolders are not picked up automatically, because tools such as OpenFL write generated build files there. To add one, right-click the Build files node and choose Add Build File…, or right-click the file in the Project view and choose Add as Haxe Build File. See Build Files. - Source folders. If a module has no source folders yet, the class paths of its build files become source folders, and the folders the builds write to are excluded. A module that already has source folders is left alone.
- The build of each file. Each source file is analyzed with the build file that compiles it, and the status bar shows which one. See Resolve Context.
- The active build file. If the project has exactly one build file, it becomes the active build file.
- The SDK. Each module gets the SDK chosen for it, or the project default. See Choose the SDK.
- Libraries. The haxelib libraries your build files use show up under External Libraries in the Project view. The plugin resolves them each time it opens a trusted project; an untrusted project waits until you trust it. See Libraries and Haxelib.
When you later edit a build file, a Sync Haxe Changes button appears in the top-right corner of the editor. Click it, or click Reload Haxe Project in the tool window's toolbar, to pick up the change.

The Sync Haxe Changes button after an edit to a project file
- The SDK, in a project you open from disk that has no project default yet. See Choose the SDK.
- The active build file, when several build files compile the same source folders. Right-click the build file in the tool window and choose Set as Active Build File.
- The Build command, if Build | Build Project should build something other than the module's default build file, or nothing at all. Right-click an action under a build file, such as Build, and choose Set as Build Command. Or click the value of the Build command row under Compilation to configure it. See Building and Running.
- Missing libraries. Libraries that are not installed show in red. Right-click the build file's Libraries node and choose Install All Missing Libraries.
A Haxe build runs code from the project itself: compiler macros, .hxp scripts and tools such as Lime from a
project-local haxelib repository. IntelliJ IDEA asks whether you trust a project before it opens one from an unknown
location. The dialog Trust and Open Project '…'? offers Trust Project, Preview in Safe Mode
and Don't Open. In safe mode, the editor shows a banner with a Trust project… link, so you can trust the
project later.
In safe mode, you can read and edit the code, and the plugin's own code analysis keeps working. The plugin starts nothing that would run project code:
- Lime, OpenFL, NME and HXP build files are not evaluated. The tool window shows only what the file itself declares.
- The compilation server does not start, so compiler-backed features such as compiler diagnostics are off. The Compilation server row in the tool window reads project not trusted — compiler evaluation disabled.
- Builds and commands do not run. Build | Build Project, the Build command row and the tools in the Haxe tool window ask you to trust the project first. A compile step before a launch is skipped with Compile skipped: the project is not trusted.
The first time the plugin skips something, it shows the notification Haxe: Project Is Not Trusted with a Trust Project… link. When you trust the project, the plugin reloads it at once; you do not have to reopen it. JetBrains explains trust and safe mode in Project security.
Each module needs a Haxe SDK. If a module has none, Haxe files in it show the banner No Haxe SDK is configured for this module - pick one here or in the Haxe tool window under Environment. Click Setup SDK in the banner and pick one.
In the Haxe tool window, the SDK row under a module's IDE environment node shows the module's SDK:
- Project default (Haxe 4.3.7), for example, means the module follows the project default set in Settings | Build, Execution, Deployment | Build Tools | Haxe.
- Project default (none) means no project default is set yet. This happens in a project you opened from disk; the new-project wizard sets the default for you. Set one in Build Tools | Haxe, or click the value and pick an SDK for this module.
See Installation for registering SDKs and choosing them.
This walkthrough needs only Haxe. It creates a project that runs in the Haxe interpreter.
-
Choose File | New | Project and select Haxe in the list on the left.
-
Enter a Name:, for example
hello, pick a Haxe SDK: and make sure Add sample code is selected. -
Click Create. The project contains:
src/Main.hx:class Main { static function main() { trace("Hello, Haxe!"); } }
build.hxml:-cp src -main Main --interp
-
Open the Haxe tool window (View | Tool Windows | Haxe).
-
Expand Build files and then build.hxml. The file is marked (Active). Under it you see Target, Defines, IDE Overrides, Libraries and Actions.
-
Expand Actions and double-click Build (it shows the command
haxe build.hxml). If IntelliJ IDEA asks whether to trust the project, trust it. -
The Run tool window opens and shows the output of the program: a line ending in
Hello, Haxe!.
The first run creates a run configuration named build.hxml Build, so you can run it again from the run configuration list in the main toolbar. Build | Build Project also works: it runs the module's Build command in a Haxe Build tab of the Run tool window.
For an interpreter build, Actions also has a Run row. Double-click it to run the program as a Haxe Interpreter configuration, or right-click it and choose Debug. See Debugging with the Interpreter.

The sample project after a run, with its output in the Run tool window
To run a compiled program, use a target with a runtime. This example uses HashLink, so you need the HashLink runtime; see Installation.
-
Choose File | New | Project and select Haxe Template under Generators.
-
Pick HXML as the Template: and HashLink (VM bytecode) as the Target:. Keep the Output:
out/app.hl, and click Create. The generatedbuild.hxml:-cp src -main Main -dce std --hl out/app.hl
-
In the Haxe tool window, expand the build file's Actions. Besides Build, it lists Build & run with the value HashLink Application.
-
Double-click Build & run. The plugin creates a run configuration named build.hxml (HashLink) that compiles the build file first and then runs
out/app.hl. The output appears in the Run tool window. -
To debug, right-click Build & run and choose Debug. See Debugging HashLink.
You can start the same from the editor: src/Main.hx shows a run icon beside static function main(). Click it and
choose Run 'build.hxml (HashLink)' or Debug 'build.hxml (HashLink)'.
Build & run appears for builds whose output the plugin knows how to launch, such as HashLink bytecode, JavaScript for a browser or Node.js, Neko and C++ executables. See Building and Running for every target, and Run Configurations for the configurations it creates.
- Core Concepts: how modules, build files, targets and the environment fit together.
- The Haxe Tool Window: every node and action in the tool window.
- Building and Running: build commands, actions and custom actions.
Getting started
Working with projects
- The Haxe Tool Window
- Build Files
- Targets and Sections
- Resolve Context
- Libraries and Haxelib
- Defines and Custom Targets
- Building and Running
- Run Configurations
- Tools
- Compilation Server
Debugging
Testing
Profiling
Editing code
- Code Completion
- Diagnostics and Inspections
- Refactoring and Navigation
- Formatting and Code Style
- Conditional Compilation
- Editor Extras
Reference