Introduction

Stability level

Current stability level for Packaging:

Alpha
Beta 1
Beta 2
RC Stable
- Pre b2.1.3 code protection part logic is removed from native side and may not protect your IP.
Visit here to report an issue or request a feature enhancement.

Back To Top

Introduction

JXcore introduces a unique feature for packaging of source files and other assets.

Let’s assume you have a large project consisting of many files. This feature packs them all into a single file to simplify the distribution.

Back To Top

Long story short

The full documentation is further down the page. But if you want a summary on how to create JX package and run, here it is:

> jx package helloworld.js "Hello world"
> jx helloworld.jx

Back To Top

JX package

About JX package file

The JX package file is what you get as a result of compiling, packaging and encrypting of your project. It’s a binary file used only by JXcore executable. It contains all of the script files of your project, as well as assets, which can be considered as static resources.

Back To Top

Compiling

Creating a JX package out of your project is very easy. You can either use a command line. Or you can use the Terminal (or Command Window on Windows).

First, go to the directory, where the project is located:

> cd Hello_world

Basically, the compilation tool needs a JXP project file. You can read more about this in another section: JXP project file.

But you can also generate it, if you want to make your life easier. To accomplish this, just type:

> jx package helloworld.js "Hello world"

More on this can be found at package.

As a result, you will receive both helloworld.jxp (the project’s description file) and helloworld.jx (the final package itself).

Now, having the helloworld.jxp file, you could modify it using a text editor (to add a version number, for example), and later recompile the JX package by:

> jx compile helloworld.jxp

Back To Top

Launching

JX packages can be executed as follows:

> jx my_project.jx

Obviously, you need to have JXcore installed first. For this, please visit Downloads page.

You can also run the package in multiple instances.

> jx mt my_project.jx
or
> jx mt-keep my_project.jx

For more details, please refer here.

Back To Top

JXP project file

About JXP project file

The JXP file is a JX package description. It contains information about the package. This is also the input file for the compilation of a JX file. It means, if you want to package your project into a JX package, you need to create a JXP project file first.

You can do it either manually or by using our jx package generation tool.

Back To Top

Generating

JXcore contains an internal JXP file generation tool. It recursively scans the current folder and generates a JXP package information file based on all the files in that directory.

It’s very easy to use from the command line. You can use the Terminal (or Command Window on Windows) for this.

First, go to the directory, where your project is located:

jx_generating1

Type jx package to see the command syntax for creating JXP file:

jx_generating2

Suppose you have a simple Hello_World project, with just two files: helloworld.js and index.html.

jx_generating3

Now you can create the first JXP file with the following command:

> jx package helloworld.js "Hello World"

jx_generating4

Initially, the tool generates JXP project file (helloworld.jxp). Then it creates the output package helloworld.jx by using the project file. In the end, you’ll have the following files in the folder:

jx_generating5

Now, you can move helloworld.jx file to another folder and type the command:

> jx helloworld.jx

You are done!

Back To Top

Excluding folders

You can use the slim parameter for excluding folders in the JXP file generation tool. They will not be embedded into the JXP project file, as well as the compiled package.

Based on the previous example, if you need to exclude e.g. two folders: folder1 and folder2, you can do it as follows:

> jx package helloworld.js "Hello World" -slim folder1,folder2

Back To Top

Native binary

Compiling

Instead of creating JX package, you can create a standalone native binary package. Once a node application compiled into native binary, it doesn’t require Node or JXcore installed on the target machine in order to run.

There are few ways of doing this.

First of them is to add -native switch to jx package command:

> jx package helloworld.js "Hello world" -native

Or you may edit JXP file and add “native” parameter with a value true:

{
    ...
    "native" : true
}

Lastly, you may also add -native switch to jx compile command:

> jx compile helloworld.jxp -native

Once it’s given from the command line, native binary will be created regardless of the value of native parameter from JXP file.

resulting binary file can be executed directly as shown below;

for *nix systems

> ./helloworld

Windows

> helloworld.exe

Back To Top