Skip to content

Java Web Viewer is a lightweight Java app that lets you embed a local HTML file or a web URL inside a Java-based window. It includes configurable options that can be easily set via command-line arguments or scripts, making it flexible for tasks like kiosk displays or simple web app distribution.

License

Notifications You must be signed in to change notification settings

rmellis/JavaWebViewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Web Viewer (viewer.jar)

Portable Java WebView app for local HTML files and web pages via http / https with useful window customization

Download

https://github.com/rmellis/JavaWebViewer/releases

Quick Start

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)

Command Line Arguments

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

Usage Examples

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

Console Feedback

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.

Distribution Bundle

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

Requirements

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.

File Paths

Windows: C:/Users/You/site/index.htm Linux: /home/user/site/index.htm
Relative: index.htm

Build from Source

javac --add-modules javafx.controls,javafx.web --module-path javafx-sdk-21/lib LocalViewer.java
jar cfe viewer.jar LocalViewer *.class

About

Java Web Viewer is a lightweight Java app that lets you embed a local HTML file or a web URL inside a Java-based window. It includes configurable options that can be easily set via command-line arguments or scripts, making it flexible for tasks like kiosk displays or simple web app distribution.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published