You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/04/25 17:26:13 UTC

[GitHub] dubee commented on a change in pull request #39: Refactor tests, update changelog

dubee commented on a change in pull request #39: Refactor tests, update changelog
URL: https://github.com/apache/incubator-openwhisk-runtime-java/pull/39#discussion_r184140191
 
 

 ##########
 File path: README.md
 ##########
 @@ -20,30 +20,94 @@
 
 [![Build Status](https://travis-ci.org/apache/incubator-openwhisk-runtime-java.svg?branch=master)](https://travis-ci.org/apache/incubator-openwhisk-runtime-java)
 
+## Changelogs
+- [Java 8 CHANGELOG.md](java8/CHANGELOG.md)
 
-### Give it a try today
-To use as a docker action
+
+## Quick Java Action
+A Java action is a Java program with a method called `main` that has the exact signature as follows:
+```java
+public static com.google.gson.JsonObject main(com.google.gson.JsonObject);
+```
+
+For example, create a Java file called `Hello.java` with the following content:
+
+```java
+import com.google.gson.JsonObject;
+
+public class Hello {
+    public static JsonObject main(JsonObject args) {
+        String name = "stranger";
+        if (args.has("name"))
+            name = args.getAsJsonPrimitive("name").getAsString();
+        JsonObject response = new JsonObject();
+        response.addProperty("greeting", "Hello " + name + "!");
+        return response;
+    }
+}
+```
+In order to compile, test and archive Java files, you must have a [JDK 8](http://openjdk.java.net/install/) installed locally.
+
+Then, compile `Hello.java` into a JAR file `hello.jar` as follows:
+```
+javac Hello.java
+```
+```
+jar cvf hello.jar Hello.class
+```
+
+**Note:** [google-gson](https://github.com/google/gson) must exist in your Java CLASSPATH when compiling the Java file.
+
+
+
+When you use the command line and a `.jar` source file, you do not need to
+specify that you are creating a Java action;
+the tool determines that from the file extension.
 
 Review comment:
   Do you mean that `--kind` does not need to be specified?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services