Using Java language

The process of creating Java function depends on OpenWhisk. You must use JDK8 to compile.

You must write the main method that has the exact signature as follows.

public static JsonObject main(JsonObject args)

Import the following package called google-gson.


Create a java file called


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;

Compile a into a JAR file called hello.jar. google-gson must exist in your Java CLASSPATH when compiling the Java file.

jar cvf hello.jar Hello.class

Create a function called function1. You need to specify the name of the main class using --main.

meteoroid function create function1 hello.jar --language java --main Hello

Using Python language

The process of creating Python function depends on OpenWhisk.

Python function is a top-level function called main, create a file called

def main(args):
    name = args.get("name", "stranger")
    greeting = "Hello " + name + "!"
    return {"greeting": greeting}

Create a function.

meteoroid fucntion create function1

If you want to use other entry methods, you must specify the method name using --main.