This is a java implementation of the Unix core tool wc
.
The cli is built using picocli and the native executable is generated using GraalVM. The executable is an arm64
binary compiled on an M1 Macbook Air 2020.
The binary generated is standalone i.e. everything required to run it, is packaged into it. Java installation of any kind (JRE, JDK, JVM etc.) is not required thanks to GraalVM native-image.
The binary can be executed just like any other command line application by simply invoking it on the command line:
>> ./wc test.txt
7145 58164 342190 test.txt
- line count
- word count
- byte count
- char count
- input from file
- input from stdin (compatible with pipes)
- Clone the repo.
- Install dependencies and plugins.
>> mvn dependency:resolve
>> mvn dependency:resolve-plugins
- Compile and run tests.
>> mvn test
- Generate the jar file.
>> mvn package
- Install graalvm and make sure the native-image utility is on your path.
- Generate the binary.
>> native-image -jar /path/to/jar
- input from multiple files