Files
j3270/run.sh
T
2026-04-20 20:32:50 -04:00

46 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Launch j3270 - Java TN3270 Terminal Emulator
# Usage: ./run.sh [host] [port] [model]
# Example: ./run.sh mainframe.example.com 23 4
JAVA_DIR="$(cd "$(dirname "$0")" && pwd)"
BUILD_DIR="$JAVA_DIR/build"
# Always rebuild to pick up changes
echo "Building lib3270j..."
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR/lib3270j" "$BUILD_DIR/j3270"
# Compile libraries
find "$JAVA_DIR/lib3270j/src" -name "*.java" -print0 | xargs -0 javac -d "$BUILD_DIR/lib3270j"
echo "Building j3270..."
find "$JAVA_DIR/j3270/src" -name "*.java" -print0 | xargs -0 javac -cp "$BUILD_DIR/lib3270j" -d "$BUILD_DIR/j3270"
echo "Build complete."
# ---------------------------------------------------------
# NEW: Package the shareable JAR
# ---------------------------------------------------------
echo "Packaging j3270.jar..."
# 1. Create the Manifest file indicating the entry point
# Note: The manifest file must end with a new line or carriage return
echo "Main-Class: org.pubvm.j3270.J3270App" > "$BUILD_DIR/MANIFEST.MF"
echo "" >> "$BUILD_DIR/MANIFEST.MF"
# 2. Build the JAR using both compiled directories
jar cvfm "$BUILD_DIR/j3270.jar" "$BUILD_DIR/MANIFEST.MF" \
-C "$BUILD_DIR/lib3270j" . \
-C "$BUILD_DIR/j3270" .
echo "Executable JAR created at: $BUILD_DIR/j3270.jar"
# ---------------------------------------------------------
# Run the newly packaged JAR
# ---------------------------------------------------------
#exec java -Dapple.laf.useScreenMenuBar=true \
# -Dapple.awt.application.name=j3270 \
# -jar "$BUILD_DIR/j3270.jar" "$@"
nohup java -jar build/j3270.jar &