You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2021/12/07 08:56:03 UTC

[sling-whiteboard] branch master updated: jbang/jvmVersion

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 3953050  jbang/jvmVersion
3953050 is described below

commit 39530503d8e78421512248edf5db5c8748a7378a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Tue Dec 7 09:55:48 2021 +0100

    jbang/jvmVersion
---
 jbang-catalog.json    |  4 ++++
 jbang/jvmVersion.java | 29 +++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/jbang-catalog.json b/jbang-catalog.json
index 77c74e8..d955459 100644
--- a/jbang-catalog.json
+++ b/jbang-catalog.json
@@ -8,6 +8,10 @@
     "repoinitValidator": {
       "script-ref": "jbang/RepoinitValidator.java",
       "description": "Validate a Repoinit script"
+    },
+    "jvmVersion": {
+      "script-ref": "jbang/jvmVersion.java",
+      "description": "Run with a specific JVM version"
     }
   }
 }
diff --git a/jbang/jvmVersion.java b/jbang/jvmVersion.java
new file mode 100644
index 0000000..4944be7
--- /dev/null
+++ b/jbang/jvmVersion.java
@@ -0,0 +1,29 @@
+//usr/bin/env jbang "$0" "$@" ; exit $?
+//JAVA 13+
+// //DEPS <dependency1> <dependency2>
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/* Test the jbang JVM selection mechanism */
+public class jvmVersion {
+
+    public static void main(String... args) {
+        final String PROP = "java.version";
+        System.out.println(String.format("%s=%s", PROP, System.getProperty(PROP)));
+    }
+}