Get Started

Here is a step-by-step instruction to start building your application with swing-ui GUI module. If you find issues with these instructions, please report it as soon as possible.

Requirements

  1. Windows, Linux, or Mac as operating system
  2. Node.js 18+, Bun, or Deno 2.0+ (Deno <2.0 is not supported)
  3. npm (Node package manager) installed
  4. Java 11 JDK or higher to run the main .jar file that’s inside of swing-ui module

Once you have the necessary Node.js and Java installed, make sure that their executables’ directories are added to system’s PATH list. It should be done in Windows as well as linux. You can check if it’s done by command:

java -version //to check java installation
node -v // to check Node.js installation

If they both show their version numbers, then you don’t have to add their directory to PATH. If any of them doesn’t work because system says that command is not found or something like that, then:

  • Their executables directory have to be added to system PATH list, or just add Node.js executable to PATH list and …
  • You can use full path to your Java executable to run gui.jar file inside of swing-ui module. This allows to run gui.jar with a different Java version than your default one in situations when you have multiple version of Java installed.

I will show example of each situation below.

Installation (for node.js)

  1. Create a directory of your new project
  2. Navigate to that directory with your preferred terminal, such as cmd.exe on Windows or bash on Linux.
  3. Run this command to set up Node.js project
npm init // sets up a new project
npm pkg set type=module // Enables ES Modules (required for 'import' syntax)

4. Run this command to install swing-ui module

npm install swing-ui

5. Run the following command to execute gui.jar, which will create the main JavaScript file with demo application to get your started.

java -jar poject_path/node_modules/swing-ui/jar/gui-11.jar

// ... or if you want to specify full path to java, you can do it like this on Windows:
"C:\Program Files\Java\jdk-11.0.22\bin\java.exe" -jar poject_path/node_modules/swing-ui/jar/gui-11.jar
// replace the path to java with your java installation path

// To run it without console window on Windows use javaw.exe instead or java.exe

If all went well, your should have a working demo application up and running. Congratulations!

By default the GUI module will attempt to use node command to run your project. If the path to node.js executable is not in PATH list of your operating system, you can add it there manually or provide a full path to the GUI module or specify another JavaScript runtime with option –runtime node, –runtime bun, –runtime deno

Swing-ui module has pre-made scripts that can run the GUI for you. Just find the one that corresponds to your operating system and desired JavaScript runtime. For example for Windows with Node.js use script run.win.node.bat script located in the module directory. Before executing such script file on Linux or macOS you should make it executable with command like this:

// navigate to swing-ui module directory, then...
chmod +x run.mac.deno.sh

Now What?

Now you are ready to explore the JavaScript GUI API library to start creating and using UI components within your project. Now enjoy building JavaScript GUI applications without HTML, CSS and web browsers. Only your favorite JS.

Scroll to Top