osgi-run 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Build, run, inspect and drive an Eclipse Equinox OSGi application without the IDE, from a terminal or from an AI coding agent (MCP server for opencode, Claude Code and other MCP clients).
4
4
 
5
- Requires **Node 18+** (only to install) and a **JDK 17+**. Projects are built with Maven or Gradle, or with Eclipse plug-in projects that use no build tool.
5
+ Requires **Node 18+** (only to install) and **Java 8+** (a JDK for Eclipse plug-in projects without a build tool). Projects are built with Maven or Gradle, or with Eclipse plug-in projects that use no build tool.
6
6
 
7
7
  ## Install
8
8
 
package/bin/osgi-run.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  // Thin launcher: osgi-run is written in Java; this runs the bundled jar with the local JDK.
3
3
  "use strict";
4
- const { spawn } = require("child_process");
4
+ const { spawn, spawnSync } = require("child_process");
5
5
  const fs = require("fs");
6
6
  const path = require("path");
7
7
 
@@ -13,13 +13,28 @@ if (process.env.JAVA_HOME) {
13
13
  if (fs.existsSync(candidate)) java = candidate;
14
14
  }
15
15
 
16
+ // osgi-run needs Java 8+. An older java on PATH would only print
17
+ // "UnsupportedClassVersionError", so check first and say what to do.
18
+ const probe = spawnSync(java, ["-version"], { encoding: "utf8" });
19
+ if (!probe.error) {
20
+ const m = /version "(\d+)(?:\.(\d+))?/.exec(`${probe.stderr || ""}${probe.stdout || ""}`);
21
+ if (m) {
22
+ const major = m[1] === "1" ? Number(m[2]) : Number(m[1]);
23
+ if (major < 8) {
24
+ console.error(`osgi-run: ${java} is Java ${major}; osgi-run needs Java 8 or newer.`);
25
+ console.error("Set JAVA_HOME to Java 8+ (a JDK if you have Eclipse PDE projects).");
26
+ process.exit(1);
27
+ }
28
+ }
29
+ }
30
+
16
31
  const child = spawn(java, ["-jar", jar, ...process.argv.slice(2)], {
17
32
  stdio: "inherit",
18
33
  env: { ...process.env, OSGIRUN_LAUNCHER: "npm" },
19
34
  });
20
35
  child.on("error", (err) => {
21
36
  console.error(`osgi-run: could not start Java (${java}): ${err.message}`);
22
- console.error("osgi-run needs a JDK 17 or newer: put java on PATH or set JAVA_HOME.");
37
+ console.error("osgi-run needs Java 8 or newer: put java on PATH or set JAVA_HOME.");
23
38
  process.exit(1);
24
39
  });
25
40
  for (const sig of ["SIGINT", "SIGTERM"]) {
package/osgi-run.jar CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osgi-run",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Build, run, inspect and drive Eclipse Equinox OSGi applications without the IDE. CLI and MCP server for AI coding agents (opencode, Claude Code).",
5
5
  "bin": {
6
6
  "osgi-run": "bin/osgi-run.js"