Do you have a web-based project—like a School Bell System—created with HTML, CSS, and JavaScript? Running it in a web browser can be annoying because of the address bar, the risk of accidental closing, and the computer going to “sleep” mode.
In this tutorial, I will show you how to convert your web project into a standalone Windows Software (.exe) and a Linux Application using Electron. We will use my “School Bell System” as a practical example.
Why Use Electron?
Electron allows you to wrap your web code into a real desktop application.
- No Address Bar: Looks like professional software.
- Prevent Sleep Mode: Keeps the school bell running all day.
- Offline Ready: No internet required after installation.
- Easy Updates: Edit the schedule without rebuilding the software.
- Cross-Platform: Create versions for Windows 10/11 and Linux (Ubuntu, Mint, etc.) from the same code.
Prerequisites
Before we start, you need to install Node.js on your computer (the one you are building the software on).
- Go to nodejs.org.
- Download the LTS Version (Windows Installer).
- Install it (click Next, Next, Finish).
- Restart your computer.
Step 1: Prepare Your Project Folder
Create a new folder on your desktop (e.g., MyBellApp) and organize your files exactly like this:
index.html(Rename your main HTML file to this)schedule.js(Your bell schedule logic)Sound_Files/(Folder containing all your .mp3 files)
Tip: Do not use spaces in your folder name. Use
MyBellAppinstead ofMy Bell App.
Step 2: Initialize the Project
Open your folder, click the address bar at the top, type cmd, and press Enter. A black command window will open.
Run this command to create the configuration file:
1 | npm init -y |
Next, install the Electron tools (this requires internet):
1 | npm install electron electron-packager --save-dev |
Step 3: Create the Engine (main.js)
We need a script to tell the app how to launch and stay awake. Create a new file named main.js in your folder and paste this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | const { app, BrowserWindow, powerSaveBlocker } = require('electron'); function createWindow() { // 1. Create the browser window const mainWindow = new BrowserWindow({ width: 1280, height: 800, webPreferences: { nodeIntegration: true, contextIsolation: false } }); // 2. Hide the Menu Bar (File, Edit, etc.) mainWindow.setMenuBarVisibility(false); // 3. Load your interface mainWindow.loadFile('index.html'); // 4. PREVENT SLEEP MODE (Critical for Bell Systems) powerSaveBlocker.start('prevent-display-sleep'); } app.whenReady().then(createWindow); |
Step 4: Configure for Windows & Linux
Open the package.json file (created in Step 2) with Notepad. We need to tell it to use main.js and add build commands for both operating systems.
Replace the file content with this:
1 2 3 4 5 6 7 8 9 10 11 12 | { "name": "school-bell-system", "version": "1.0.0", "main": "main.js", "scripts": { "start": "electron .", "build-win": "electron-packager . SchoolBellSystem --platform=win32 --arch=x64 --overwrite --electron-version=34.0.0", "build-linux": "electron-packager . SchoolBellSystem-Linux --platform=linux --arch=x64 --overwrite --electron-version=34.0.0" }, "author": "Ruwan Suraweera", "license": "ISC" } |
Step 5: Build Your Software
For Windows 10/11
Run this command in your terminal:
1 | npm run build-win |
- Result: A folder named
SchoolBellSystem-win32-x64. - How to Run: Open the folder and double-click
SchoolBellSystem.exe.
For Linux (Ubuntu, Mint, etc.)
Run this command in your terminal:
1 | npm run build-linux |
Common Questions & Troubleshooting (Q&A)
Q: I get an error “EBUSY: resource busy or locked” when building. A: This happens if your app is already running in the background. Open Task Manager, end the “SchoolBellSystem” or “Electron” task, close any open folders, and try again.
Q: Can I put the Windows .exe and Linux file in the same folder? A: No. They require different system files (DLLs for Windows, .so files for Linux). Keep them in separate folders, or create a master folder with sub-folders like /Windows and /Linux.
Q: The app opens and immediately closes. A: Check your package.json file. Ensure the line says "main": "main.js". If it says "main": "schedule.js", the app will crash because schedule.js cannot create a window.
Q: Can I delete index.html after creating the EXE? A: No. The EXE is basically a web browser. It still needs index.html to display your interface. Do not delete any files inside the resources folder.
Q: Can I rename the .exe file? A: Yes, you can rename SchoolBellSystem.exe to MyBell.exe. However, never move it out of the folder. To put an icon on your desktop, Right-click the EXE > Send to > Desktop (create shortcut).
Q: Can build the Linux version on a Windows 10 computer without any problems
You can build the Linux version on a Windows 10 computer without any problems. The electron-packager tool is smart enough to create the correct Linux files even while running on Windows.
However, there is one important thing you must do when you copy that folder to the Linux computer:
⚠️ The “Permission” Issue
Because Windows file systems do not use Linux permissions, the main start file (usually named SchoolBellSystem-Linux) often loses its “permission to run” during the copy process.
When you copy the folder to the Linux computer, you likely cannot double-click it immediately.
✅ How to Fix It (On the Linux Computer)
Once you copy the folder to the Linux machine:
- Open the folder.
- Right-click the file named
SchoolBellSystem-Linux(it will have no extension like .exe). - Select Properties.
- Go to the Permissions tab.
- Check the box that says “Allow executing file as program” (or “Is Executable”).
- Close the window.
Now you can double-click it, and it will run perfectly!
Q: How to Remove Login Password (Auto-Login)
This makes the computer go straight to the desktop when you turn it on.
For Ubuntu / Linux Mint:
- Open your Settings (System Settings).
- Find the Users settings.
- Click the Unlock button at the top right (you will need to type your password once).
- Look for the switch that says “Automatic Login”.
- Turn it ON.
Now, when you restart the computer, it will not ask for a password.
Q: How to Create a Desktop Shortcut
To put a clickable icon on your Desktop that opens your new Bell System:
- Right-click on your Desktop and choose Create New Document > Empty Document.
- Name it:
SchoolBell.desktop(Make sure it ends with.desktop). - Open this file with a text editor.
- Paste the code below
1 2 3 4 5 6 7 8 9 10 | [Desktop Entry] Type=Application Name=School Bell System Comment=Start the School Bell Exec="/home/YOUR_USERNAME/Documents/SchoolBellSystem-Linux-linux-x64/SchoolBellSystem-Linux" Icon=utilities-terminal Terminal=false Hidden=false NoDisplay=false X-GNOME-Autostart-enabled=true |
Activate the Shortcut:
- Right-click the new
SchoolBell.desktopfile on your desktop. - Select Properties > Permissions.
- Check the box “Allow executing file as program”.
- (On Ubuntu, you might also need to right-click the file and select “Allow Launching”).
Q: How to Add to Startup (Auto-Start)
If you want the Bell System to open automatically when the computer turns on:
- Open your Home Folder.
- Press
Ctrl + Hon your keyboard (this reveals hidden folders). - Open the folder named
.config. - Open the folder named
autostart. (If it doesn’t exist, create a folder namedautostart). - Copy the
SchoolBell.desktopfile you created in Part 2. - Paste it inside this
autostartfolder.
Now, when the computer turns on:
- It will skip the password (Auto-Login).
- It will automatically open your School Bell App.
Conclusion
Converting a web app to a desktop EXE is a powerful skill for any ICT student. Now you have a professional School Bell System that is stable, sleep-resistant, and runs on both Windows and Linux computers.
Happy Coding!







Leave a Reply