Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

removal of old java desktop + workspace change in tauri (#5459)

Anthony Stirling36c93694044c
diff --git a/CLAUDE.md b/CLAUDE.md
index cb3d9048fc..2c4cfa5370 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -199,7 +199,6 @@ return useToolOperation({
- **Java Version**: Minimum JDK 17, supports and recommends JDK 21
- **Lombok**: Used extensively - ensure IDE plugin is installed
-- **Desktop Mode**: Set `STIRLING_PDF_DESKTOP_UI=true` for desktop application mode
- **File Persistence**:
- **Backend**: Designed to be stateless - files are processed in memory/temp locations only
- **Frontend**: Uses IndexedDB for client-side file storage and caching (with thumbnails)
diff --git a/app/common/src/main/java/stirling/software/common/configuration/InstallationPathConfig.java b/app/common/src/main/java/stirling/software/common/configuration/InstallationPathConfig.java
index cc5401f865..8050a16591 100644
--- a/app/common/src/main/java/stirling/software/common/configuration/InstallationPathConfig.java
+++ b/app/common/src/main/java/stirling/software/common/configuration/InstallationPathConfig.java
@@ -1,8 +1,6 @@
package stirling.software.common.configuration;
import java.io.File;
-import java.nio.file.Paths;
-import java.util.Locale;
import lombok.extern.slf4j.Slf4j;
@@ -61,28 +59,6 @@ public class InstallationPathConfig {
}
private static String initializeBasePath() {
- if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
- String os = System.getProperty("os.name").toLowerCase(Locale.ROOT);
- if (os.contains("win")) {
- return Paths.get(
- System.getenv("APPDATA"), // parent path
- "Stirling-PDF")
- + File.separator;
- } else if (os.contains("mac")) {
- return Paths.get(
- System.getProperty("user.home"),
- "Library",
- "Application Support",
- "Stirling-PDF")
- + File.separator;
- } else {
- return Paths.get(
- System.getProperty("user.home"), // parent path
- ".config",
- "Stirling-PDF")
- + File.separator;
- }
- }
return "." + File.separator;
}
diff --git a/app/core/build.gradle b/app/core/build.gradle
index 6f6f0987dd..c309215035 100644
--- a/app/core/build.gradle
+++ b/app/core/build.gradle
@@ -38,13 +38,6 @@ spotless {
}
dependencies {
- if (System.getenv('STIRLING_PDF_DESKTOP_UI') != 'false'
- || (project.hasProperty('STIRLING_PDF_DESKTOP_UI')
- && project.getProperty('STIRLING_PDF_DESKTOP_UI') != 'false')) {
- implementation 'org.openjfx:javafx-controls:21'
- implementation 'org.openjfx:javafx-swing:21'
- }
-
if (System.getenv('DISABLE_ADDITIONAL_FEATURES') != 'true'
|| (project.hasProperty('DISABLE_ADDITIONAL_FEATURES')
&& System.getProperty('DISABLE_ADDITIONAL_FEATURES') != 'true')) {
@@ -115,19 +108,8 @@ sourceSets {
resources {
srcDirs += ['../configs']
}
- java {
- if (System.getenv('STIRLING_PDF_DESKTOP_UI') == 'false') {
- exclude 'stirling/software/SPDF/UI/impl/**'
- }
-
- }
}
test {
- java {
- if (System.getenv('STIRLING_PDF_DESKTOP_UI') == 'false') {
- exclude 'stirling/software/SPDF/UI/impl/**'
- }
- }
}
}
diff --git a/app/core/src/main/java/stirling/software/SPDF/SPDFApplication.java b/app/core/src/main/java/stirling/software/SPDF/SPDFApplication.java
index e913aefafb..bce73b25c1 100644
--- a/app/core/src/main/java/stirling/software/SPDF/SPDFApplication.java
+++ b/app/core/src/main/java/stirling/software/SPDF/SPDFApplication.java
@@ -20,7 +20,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import io.github.pixee.security.SystemCommand;
import jakarta.annotation.PostConstruct;
-import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
@@ -28,7 +27,6 @@ import stirling.software.common.configuration.AppConfig;
import stirling.software.common.configuration.ConfigInitializer;
import stirling.software.common.configuration.InstallationPathConfig;
import stirling.software.common.model.ApplicationProperties;
-import stirling.software.common.util.UrlUtils;
@Slf4j
@EnableScheduling
@@ -60,19 +58,6 @@ public class SPDFApplication {
Properties props = new Properties();
- if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
- System.setProperty("java.awt.headless", "false");
- app.setHeadless(false);
- props.put("java.awt.headless", "false");
- props.put("spring.main.web-application-type", "servlet");
-
- int desiredPort = 8080;
- String port = UrlUtils.findAvailablePort(desiredPort);
- props.put("server.port", port);
- System.setProperty("server.port", port);
- log.info("Desktop UI mode: Using port {}", port);
- }
-
app.setAdditionalProfiles(getActiveProfile(args));
ConfigInitializer initializer = new ConfigInitializer();
@@ -153,13 +138,6 @@ public class SPDFApplication {
"Running in Tauri mode. Parent process PID: {}",
parentPid != null ? parentPid : "not set");
}
- // Desktop UI initialization removed - webBrowser dependency eliminated
- // Keep backwards compatibility for STIRLING_PDF_DESKTOP_UI system property
- if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_DESKTOP_UI", "false"))) {
- log.info("Desktop UI mode enabled, but WebBrowser functionality has been removed");
- // webBrowser.initWebUI(url); // Removed - desktop UI eliminated
- }
-
// Standard browser opening logic
String browserOpenEnv = env.getProperty("BROWSER_OPEN");
boolean browserOpen = browserOpenEnv != null && "true".equalsIgnoreCase(browserOpenEnv);
@@ -192,14 +170,6 @@ public class SPDFApplication {
}
}
- @PreDestroy
- public void cleanup() {
- // webBrowser cleanup removed - desktop UI eliminated
- // if (webBrowser != null) {
- // webBrowser.cleanup();
- // }
- }
-
@EventListener
public void onWebServerInitialized(WebServerInitializedEvent event) {
int actualPort = event.getWebServer().getPort();
diff --git a/app/core/src/main/resources/static/3rdPartyLicenses.json b/app/core/src/main/resources/static/3rdPartyLicenses.json
index 71618c28ca..d8289e0d97 100644
--- a/app/core/src/main/resources/static/3rdPartyLicenses.json
+++ b/app/core/src/main/resources/static/3rdPartyLicenses.json
@@ -1596,30 +1596,6 @@
"moduleLicense": "Mozilla Public License, Version 2.0",
"moduleLicenseUrl": "http://www.mozilla.org/MPL/2.0/index.txt"
},
- {
- "moduleName": "org.openjfx:javafx-base",
- "moduleVersion": "21",
- "moduleLicense": "GPLv2+CE",
- "moduleLicenseUrl": "https://openjdk.java.net/legal/gplv2+ce.html"
- },
- {
- "moduleName": "org.openjfx:javafx-controls",
- "moduleVersion": "21",
- "moduleLicense": "GPLv2+CE",
- "moduleLicenseUrl": "https://openjdk.java.net/legal/gplv2+ce.html"
- },
- {
- "moduleName": "org.openjfx:javafx-graphics",
- "moduleVersion": "21",
- "moduleLicense": "GPLv2+CE",
- "moduleLicenseUrl": "https://openjdk.java.net/legal/gplv2+ce.html"
- },
- {
- "moduleName": "org.openjfx:javafx-swing",
- "moduleVersion": "21",
- "moduleLicense": "GPLv2+CE",
- "moduleLicenseUrl": "https://openjdk.java.net/legal/gplv2+ce.html"
- },
{
"moduleName": "org.opensaml:opensaml-core",
"moduleVersion": "4.3.2",
diff --git a/docker/Dockerfile.unified b/docker/Dockerfile.unified
index 6d045b4f27..8807766e73 100644
--- a/docker/Dockerfile.unified
+++ b/docker/Dockerfile.unified
@@ -31,7 +31,6 @@ COPY . .
# Build server-only JAR (no frontend, includes security features controlled by DOCKER_ENABLE_SECURITY at runtime)
RUN DISABLE_ADDITIONAL_FEATURES=false \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
# Stage 3: Final unified image
diff --git a/docker/Dockerfile.unified-lite b/docker/Dockerfile.unified-lite
index 264d03d676..fc0dc7114d 100644
--- a/docker/Dockerfile.unified-lite
+++ b/docker/Dockerfile.unified-lite
@@ -30,7 +30,6 @@ WORKDIR /app
COPY . .
RUN DISABLE_ADDITIONAL_FEATURES=true \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
# Stage 3: Final unified ultra-lite image
diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile
index 8ebccfaf7b..567fb873bd 100644
--- a/docker/backend/Dockerfile
+++ b/docker/backend/Dockerfile
@@ -25,7 +25,6 @@ COPY . .
# Build the application (server-only JAR - no UI, includes security features controlled at runtime)
RUN DISABLE_ADDITIONAL_FEATURES=false \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
# ========================================
diff --git a/docker/backend/Dockerfile.fat b/docker/backend/Dockerfile.fat
index 8e31c27c0f..a833efb260 100644
--- a/docker/backend/Dockerfile.fat
+++ b/docker/backend/Dockerfile.fat
@@ -25,7 +25,6 @@ COPY . .
# Build the application (server-only JAR - no UI, includes security features controlled at runtime)
RUN DISABLE_ADDITIONAL_FEATURES=false \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
# ========================================
diff --git a/docker/backend/Dockerfile.ultra-lite b/docker/backend/Dockerfile.ultra-lite
index bf1929234c..7840df339e 100644
--- a/docker/backend/Dockerfile.ultra-lite
+++ b/docker/backend/Dockerfile.ultra-lite
@@ -21,7 +21,6 @@ COPY . .
# Build the application with DISABLE_ADDITIONAL_FEATURES=true
RUN DISABLE_ADDITIONAL_FEATURES=true \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -x spotlessApply -x spotlessCheck -x test -x sonarqube
# ========================================
diff --git a/docker/embedded/Dockerfile b/docker/embedded/Dockerfile
index cad7a6038b..b1ab2bc1f4 100644
--- a/docker/embedded/Dockerfile
+++ b/docker/embedded/Dockerfile
@@ -32,7 +32,6 @@ COPY . .
# Build JAR with embedded frontend (includes security features controlled at runtime)
RUN DISABLE_ADDITIONAL_FEATURES=false \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -PbuildWithFrontend=true -x spotlessApply -x spotlessCheck -x test -x sonarqube
# Stage 2: Runtime image based on Debian stable-slim
diff --git a/docker/embedded/Dockerfile.fat b/docker/embedded/Dockerfile.fat
index 047e256afe..529a694e72 100644
--- a/docker/embedded/Dockerfile.fat
+++ b/docker/embedded/Dockerfile.fat
@@ -32,7 +32,6 @@ COPY . .
# Build JAR with embedded frontend (includes security features controlled at runtime)
RUN DISABLE_ADDITIONAL_FEATURES=false \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -PbuildWithFrontend=true -x spotlessApply -x spotlessCheck -x test -x sonarqube
# Stage 2: Runtime image based on Debian stable-slim
diff --git a/docker/embedded/Dockerfile.ultra-lite b/docker/embedded/Dockerfile.ultra-lite
index 96575a17e6..145803d6b9 100644
--- a/docker/embedded/Dockerfile.ultra-lite
+++ b/docker/embedded/Dockerfile.ultra-lite
@@ -32,7 +32,6 @@ COPY . .
# Build ultra-lite JAR with embedded frontend (minimal features)
RUN DISABLE_ADDITIONAL_FEATURES=true \
- STIRLING_PDF_DESKTOP_UI=false \
./gradlew clean build -PbuildWithFrontend=true -x spotlessApply -x spotlessCheck -x test -x sonarqube
# Stage 2: Runtime image
diff --git a/frontend/src-tauri/src/commands/backend.rs b/frontend/src-tauri/src/commands/backend.rs
index aed5f0b879..b79715a6b8 100644
--- a/frontend/src-tauri/src/commands/backend.rs
+++ b/frontend/src-tauri/src/commands/backend.rs
@@ -1,7 +1,7 @@
use tauri_plugin_shell::ShellExt;
use tauri::Manager;
use std::sync::Mutex;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use crate::utils::add_log;
use crate::state::connection_state::{AppConnectionState, ConnectionMode};
@@ -126,6 +126,45 @@ fn normalize_path(path: &PathBuf) -> PathBuf {
}
}
+fn migrate_legacy_workspace(legacy_dir: &PathBuf, target_root: &PathBuf) -> std::io::Result<()> {
+ for entry in std::fs::read_dir(legacy_dir)? {
+ let entry = entry?;
+ let file_type = entry.file_type()?;
+ let src_path = entry.path();
+ let dest_path = target_root.join(entry.file_name());
+
+ if file_type.is_dir() {
+ copy_dir_recursive(&src_path, &dest_path)?;
+ } else if file_type.is_file() {
+ if let Some(parent) = dest_path.parent() {
+ std::fs::create_dir_all(parent)?;
+ }
+ std::fs::copy(&src_path, &dest_path)?;
+ }
+ }
+
+ Ok(())
+}
+
+fn copy_dir_recursive(src: &Path, dest: &Path) -> std::io::Result<()> {
+ std::fs::create_dir_all(dest)?;
+
+ for entry in std::fs::read_dir(src)? {
+ let entry = entry?;
+ let file_type = entry.file_type()?;
+ let src_path = entry.path();
+ let dest_path = dest.join(entry.file_name());
+
+ if file_type.is_dir() {
+ copy_dir_recursive(&src_path, &dest_path)?;
+ } else if file_type.is_file() {
+ std::fs::copy(&src_path, &dest_path)?;
+ }
+ }
+
+ Ok(())
+}
+
// Create, configure and run the Java command to run Stirling-PDF JAR
fn run_stirling_pdf_jar(app: &tauri::AppHandle, java_path: &PathBuf, jar_path: &PathBuf) -> Result<(), String> {
// Get platform-specific application data directory for Tauri mode
@@ -143,7 +182,8 @@ fn run_stirling_pdf_jar(app: &tauri::AppHandle, java_path: &PathBuf, jar_path: &
// Create subdirectories for different purposes
let config_dir = app_data_dir.join("configs");
let log_dir = app_data_dir.join("logs");
- let work_dir = app_data_dir.join("workspace");
+ let work_dir = app_data_dir.clone();
+ let legacy_work_dir = app_data_dir.join("workspace");
// Create all necessary directories
std::fs::create_dir_all(&app_data_dir).ok();
@@ -151,6 +191,19 @@ fn run_stirling_pdf_jar(app: &tauri::AppHandle, java_path: &PathBuf, jar_path: &
std::fs::create_dir_all(&work_dir).ok();
std::fs::create_dir_all(&config_dir).ok();
+ // Migrate legacy workspace content into the app data root before launch.
+ if legacy_work_dir.exists() {
+ add_log(format!("πŸ“¦ Migrating legacy workspace from {}", legacy_work_dir.display()));
+ if let Err(err) = migrate_legacy_workspace(&legacy_work_dir, &app_data_dir) {
+ add_log(format!("⚠️ Failed to migrate legacy workspace: {}", err));
+ } else {
+ match std::fs::remove_dir_all(&legacy_work_dir) {
+ Ok(_) => add_log("βœ… Removed legacy workspace directory after migration".to_string()),
+ Err(err) => add_log(format!("⚠️ Failed to remove legacy workspace: {}", err)),
+ }
+ }
+ }
+
add_log(format!("πŸ“ App data directory: {}", app_data_dir.display()));
add_log(format!("πŸ“ Log directory: {}", log_dir.display()));
add_log(format!("πŸ“ Working directory: {}", work_dir.display()));
@@ -162,7 +215,6 @@ fn run_stirling_pdf_jar(app: &tauri::AppHandle, java_path: &PathBuf, jar_path: &
let java_options = vec![
"-Xmx2g",
"-DBROWSER_OPEN=false",
- "-DSTIRLING_PDF_DESKTOP_UI=false",
"-DSTIRLING_PDF_TAURI_MODE=true",
&log_path_option,
"-Dlogging.file.name=stirling-pdf.log",
diff --git a/scripts/build-tauri-jlink.bat b/scripts/build-tauri-jlink.bat
index 16d143c10c..b9e4387155 100644
--- a/scripts/build-tauri-jlink.bat
+++ b/scripts/build-tauri-jlink.bat
@@ -96,7 +96,6 @@ echo REM Launch with bundled JRE >> "frontend\src-tauri\runtime\launch-stirling.
echo "%%JRE_DIR%%\bin\java.exe" ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -Xmx2g ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -DBROWSER_OPEN=true ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
-echo -DSTIRLING_PDF_DESKTOP_UI=false ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo -jar "%%STIRLING_JAR%%" ^^ >> "frontend\src-tauri\runtime\launch-stirling.bat"
echo %%* >> "frontend\src-tauri\runtime\launch-stirling.bat"
@@ -133,4 +132,4 @@ echo β€’ Smaller distribution size with custom runtime
echo β€’ Better security with minimal required modules
echo β€’ Consistent Java version across all deployments
echo.
-echo βœ… The application will now run without requiring users to install Java!
\ No newline at end of file
+echo βœ… The application will now run without requiring users to install Java!
diff --git a/scripts/build-tauri-jlink.sh b/scripts/build-tauri-jlink.sh
index ef39615d16..ec2b283afe 100755
--- a/scripts/build-tauri-jlink.sh
+++ b/scripts/build-tauri-jlink.sh
@@ -159,7 +159,6 @@ fi
"$JRE_DIR/bin/java" \
-Xmx2g \
-DBROWSER_OPEN=true \
- -DSTIRLING_PDF_DESKTOP_UI=false \
-jar "$STIRLING_JAR" \
"$@"
EOF
@@ -188,7 +187,6 @@ REM Launch with bundled JRE
"%JRE_DIR%\bin\java.exe" ^
-Xmx2g ^
-DBROWSER_OPEN=true ^
- -DSTIRLING_PDF_DESKTOP_UI=false ^
-jar "%STIRLING_JAR%" ^
%*
EOF