Portable Java WebView app for local HTML files and web pages via http / https with useful window customization
https://github.com/rmellis/JavaWebViewer/releases
java --module-path lib --add-modules javafx.controls,javafx.web -jar viewer.jar index.htm --title="Java WebApp" --width=1200 --height=760 false flase --icon=icon.png
Opens index.htm from current directory (1200x760 window)
The command line arguments can work either by using direct key=value flags or by position (index) as shown below. Here are some examples using both hybrid mode and index-based mode.
viewer.jar [url] --title="example app" --width=640 --height=480 false false --icon=icon.png
You need to use quotation marks if a key value has more than one word. Otherwise, the space will split it into separate keys and cause a syntax error.
Another example:
viewer.jar "[url]" "[title]" [width] [height] [fullscreen] [maximized] [resizable] [alwaysontop] [x] [y] [icon]
1: url (URL/path) Default: index.htm
2: title (string) Default: "Local HTML Viewer"
3: width (px/auto) Default: 1200
4: height (px/auto) Default: 800
5: fullscreen (true/false) Default: false
6: maximized (true/false) Default: false
7: resizable (true/false) Default: true
8: alwaysontop (true/false) Default: false
9: x (px/center) Default: center
10: y (px/center) Default: center
11: icon (URL / path / auto) Default: null
Basic:
viewer.jar "folder/index.html" "My WebApp"
Basic with icon:
viewer.jar "folder/index.html" "My WebApp" auto auto false false false center center icon.png
Kiosk Mode:
viewer.jar "kiosk/dashboard.html" "Dashboard" true true false
Fixed Debug Window:
viewer.jar "logs/debug.html" "Live Logs" 400 300 false false false true true 10 10
Since the early releases, console logging has improved based on your configuration. Below is an example of how the console looks when you launch the app with your custom flags.
🚀 LocalViewer Configuration:
📄 URL: index.htm
🏷️ Title: Java WebApp
📐 Size: auto x auto
🔧 Flags: fullscreen=false, maximized=false
🖼️ Loading icon: icon.png
✅ Icon loaded successfully (64x64)
🎯 Window centered
✨ Viewer ready! Press Ctrl+C to exit.
JavaWebViewer.zip
├── viewer.jar
├── index.htm
├── lib/
├── bin/
├── Launch.bat
├── icon.png
└── Launch-FullScreen.bat
Launch.bat:
@echo off
java --module-path lib --add-modules javafx.controls,javafx.web -jar viewer.jar index.htm --title="Java WebApp" --width=1200 --height=760 false flase --icon=icon.png
Java: 21+ (Temurin recommended)
JavaFX: 21+ (pre-included, no need to download)
OS: Windows 10/11, macOS, Linux
Note: this has only yet been tested on Windows so far, it may need additional libraries for Linux and MacOS but i'll look into that in the future.
Windows: C:/Users/You/site/index.htm
Linux: /home/user/site/index.htm
Relative: index.htm
javac --add-modules javafx.controls,javafx.web --module-path javafx-sdk-21/lib LocalViewer.java
jar cfe viewer.jar LocalViewer *.class