transmission_of_audio_and_video:audio_and_video
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| transmission_of_audio_and_video:audio_and_video [2024/10/23 20:27] – aperez | transmission_of_audio_and_video:audio_and_video [2025/12/25 20:42] (current) – aperez | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| {{ : | {{ : | ||
| + | |||
| + | {{ : | ||
| + | ---- | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ====== Automatic Startup of Java Application (VisionLite) as a Windows Service ====== | ||
| + | |||
| + | ===== Purpose ===== | ||
| + | Establish a standard, reproducible, | ||
| + | application as a **Windows Service**, ensuring: | ||
| + | |||
| + | * Automatic startup when the server boots | ||
| + | * Independence from user login | ||
| + | * Automatic restart on failures | ||
| + | * Use of standard production paths | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Scenario ===== | ||
| + | Java application manually executed with: | ||
| + | |||
| + | < | ||
| + | java -jar VLite_2_3_169.jar | ||
| + | </ | ||
| + | |||
| + | Requirement: | ||
| + | The application must start automatically after every operating system reboot. | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | * Windows Server 2016+ / Windows 10+ | ||
| + | * PowerShell with administrative privileges | ||
| + | * Internet connectivity (initial installation) | ||
| + | * Java Runtime Environment (JRE) | ||
| + | * NSSM (Non-Sucking Service Manager) | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 1 — Chocolatey Installation ===== | ||
| + | Chocolatey is the standard Windows package manager. | ||
| + | |||
| + | ==== Verification ==== | ||
| + | <code powershell> | ||
| + | choco -v | ||
| + | </ | ||
| + | |||
| + | ==== Installation (if not present) ==== | ||
| + | <code powershell> | ||
| + | Set-ExecutionPolicy Bypass -Scope Process -Force | ||
| + | [System.Net.ServicePointManager]:: | ||
| + | iex ((New-Object System.Net.WebClient).DownloadString(' | ||
| + | </ | ||
| + | |||
| + | Close and reopen PowerShell. | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 2 — Java Installation and Verification ===== | ||
| + | Java LTS is recommended (Java 8 or 11). | ||
| + | |||
| + | ==== Java 8 Installation ==== | ||
| + | <code powershell> | ||
| + | choco install jre8 -y | ||
| + | </ | ||
| + | |||
| + | ==== Verification ==== | ||
| + | <code powershell> | ||
| + | java -version | ||
| + | </ | ||
| + | |||
| + | Validated output in this environment: | ||
| + | < | ||
| + | java version " | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 3 — Identifying the REAL Java Path ===== | ||
| + | ⚠️ Do NOT use the wrapper: | ||
| + | < | ||
| + | C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe | ||
| + | </ | ||
| + | |||
| + | ==== Validate the real binary ==== | ||
| + | <code powershell> | ||
| + | Test-Path " | ||
| + | </ | ||
| + | |||
| + | Result: | ||
| + | < | ||
| + | True | ||
| + | </ | ||
| + | |||
| + | Confirmed path: | ||
| + | < | ||
| + | C:\Program Files\Java\jre1.8.0_261\bin\java.exe | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 4 — NSSM Installation ===== | ||
| + | NSSM allows applications to run as controlled Windows services. | ||
| + | |||
| + | ==== Installation ==== | ||
| + | <code powershell> | ||
| + | choco install nssm -y | ||
| + | </ | ||
| + | |||
| + | ==== Verification ==== | ||
| + | <code powershell> | ||
| + | nssm version | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 5 — Service Verification ===== | ||
| + | Check whether the service already exists: | ||
| + | |||
| + | <code powershell> | ||
| + | Get-Service *vision* | Format-Table Name, | ||
| + | </ | ||
| + | |||
| + | Validated result: | ||
| + | < | ||
| + | Name DisplayName | ||
| + | VisionLite VisionLite | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 6 — VisionLite Service Configuration ===== | ||
| + | All commands must be executed in **PowerShell as Administrator**. | ||
| + | |||
| + | ==== Java executable definition ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite Application " | ||
| + | </ | ||
| + | |||
| + | ==== Execution parameters ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite AppParameters "-jar VLite_2_3_169.jar" | ||
| + | </ | ||
| + | |||
| + | ==== Initial working directory ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite AppDirectory " | ||
| + | </ | ||
| + | |||
| + | ==== Automatic startup ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite Start SERVICE_AUTO_START | ||
| + | </ | ||
| + | |||
| + | ==== Automatic restart on failure ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite AppExit Default Restart | ||
| + | nssm set VisionLite AppRestartDelay 60000 | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 7 — Service Start and Validation ===== | ||
| + | <code powershell> | ||
| + | nssm start VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| + | |||
| + | Validated state: | ||
| + | < | ||
| + | STATE : 4 RUNNING | ||
| + | </ | ||
| + | |||
| + | ==== Auto-start confirmation ==== | ||
| + | <code powershell> | ||
| + | sc qc VisionLite | ||
| + | </ | ||
| + | |||
| + | Result: | ||
| + | < | ||
| + | START_TYPE : 2 AUTO_START | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 8 — Best Practice Correction ===== | ||
| + | A user Desktop–based path is **NOT recommended** for production. | ||
| + | |||
| + | ==== Standard path defined ==== | ||
| + | < | ||
| + | C: | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 9 — Service Migration to Standard Path ===== | ||
| + | |||
| + | ==== Stop the service ==== | ||
| + | <code powershell> | ||
| + | nssm stop VisionLite | ||
| + | </ | ||
| + | |||
| + | ==== Create production directory ==== | ||
| + | <code powershell> | ||
| + | mkdir C: | ||
| + | </ | ||
| + | |||
| + | ==== Migrate application files ==== | ||
| + | <code powershell> | ||
| + | Move-Item " | ||
| + | </ | ||
| + | |||
| + | ==== Update service working directory ==== | ||
| + | <code powershell> | ||
| + | nssm set VisionLite AppDirectory " | ||
| + | </ | ||
| + | |||
| + | ==== Restart the service ==== | ||
| + | <code powershell> | ||
| + | nssm start VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Step 10 — Final Validation ===== | ||
| + | ==== NSSM configuration dump ==== | ||
| + | <code powershell> | ||
| + | nssm dump VisionLite | ||
| + | </ | ||
| + | |||
| + | Confirm: | ||
| + | < | ||
| + | AppDirectory C: | ||
| + | </ | ||
| + | |||
| + | ==== Recommended test ==== | ||
| + | Reboot the server and verify the service is in RUNNING state. | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Daily Operations ===== | ||
| + | <code powershell> | ||
| + | nssm start VisionLite | ||
| + | nssm stop VisionLite | ||
| + | nssm restart VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Troubleshooting ===== | ||
| + | ^ Symptom ^ Probable cause ^ Corrective action ^ | ||
| + | | Service stops | Incorrect directory | Verify AppDirectory | | ||
| + | | JAR does not start | Incorrect Java path | Validate real java.exe | | ||
| + | | Does not start after reboot | Not AUTO_START | Verify sc qc | | ||
| + | | Files not found | Relative paths | Use standard path | | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Best Practices ===== | ||
| + | * Use `C: | ||
| + | * Avoid user-profile-dependent paths | ||
| + | * Document changes in Wiki | ||
| + | * Centralize management with NSSM | ||
| + | * Consider a dedicated service account for critical services | ||
| + | |||
| + | --- | ||
| + | |||
| + | ===== Final Note ===== | ||
| + | Once configured as a service: | ||
| + | |||
| + | ❌ DO NOT manually execute: | ||
| + | < | ||
| + | java -jar VLite_2_3_169.jar | ||
| + | </ | ||
| + | |||
| + | ✅ Manage exclusively as a Windows service. | ||
| + | |||
| + | --- | ||
| + | |||
| + | <code powershell> | ||
| + | nssm stop VisionLite | ||
| + | sc query VisionLite | ||
| + | |||
| + | nssm set VisionLite Application " | ||
| + | nssm set VisionLite AppParameters "-jar VLite_2_3_169.jar" | ||
| + | nssm set VisionLite AppDirectory " | ||
| + | nssm set VisionLite Start SERVICE_AUTO_START | ||
| + | nssm set VisionLite AppExit Default Restart | ||
| + | nssm set VisionLite AppRestartDelay 60000 | ||
| + | |||
| + | nssm start VisionLite | ||
| + | sc query VisionLite | ||
| + | |||
| + | sc qc VisionLite | ||
| + | |||
| + | nssm dump VisionLite | ||
| + | |||
| + | nssm start VisionLite | ||
| + | nssm stop VisionLite | ||
| + | nssm restart VisionLite | ||
| + | sc query VisionLite | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
transmission_of_audio_and_video/audio_and_video.1729715246.txt.gz · Last modified: by aperez
