javacommand

Want to know what each word meaning in this command


I'm trying to run a node.js app on JVM with the help of avatar.js using the following command which I got into an article here: http://blog.jonasbandi.net/2014/03/running-nodejs-applications-on-jvm-with.html

java -Djava.library.path=dist -jar dist/avatar-js.jar app.js

Want to know what is the exact meaning of each and every word in this command.


Solution

  • This is documented quite extensively on Oracle's website ( https://docs.oracle.com/en/java/javase/11/tools/java.html ), as well as in the command itself (try java -? ).

    The part -Djava.library.path=dist means:

        -D<name>=<value>
                      set a system property
    

    So this sets the java.library.path property to dist. I think this may be relevant for using a JNI (Java Native Interface) extension, and it tells the JVM where to look for native library files.

    The next part -jar dist/avatar-js.jar app.js instructs Java to execute the jar file named dist/avatar-js.jar, with app.js as program argument, which is document as follows:

       or  java [options] -jar <jarfile> [args...]
               (to execute a jar file)