diff --git a/core-java-modules/core-java-lang/pom.xml b/core-java-modules/core-java-lang/pom.xml index da759012aee4..05bc9c44fe1b 100644 --- a/core-java-modules/core-java-lang/pom.xml +++ b/core-java-modules/core-java-lang/pom.xml @@ -28,6 +28,16 @@ core-java-lang + + + org.apache.maven.plugins + maven-compiler-plugin + + 21 + 21 + + + src/main/resources diff --git a/core-java-modules/core-java-lang/src/main/java/com/baeldung/commandlinearguments/CliFileReader.java b/core-java-modules/core-java-lang/src/main/java/com/baeldung/commandlinearguments/CliFileReader.java new file mode 100644 index 000000000000..5648a7074219 --- /dev/null +++ b/core-java-modules/core-java-lang/src/main/java/com/baeldung/commandlinearguments/CliFileReader.java @@ -0,0 +1,23 @@ +package com.baeldung.commandlinearguments; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +public class CliFileReader { + + public static void main(String[] args) throws IOException { + if (args.length == 0) { + System.out.println("Usage: CliFileReader "); + } + String path = args[0]; + List lines = Files.readAllLines(Path.of(path)); + for (String line : lines) { + System.out.println(line); + + } + + } + +} diff --git a/core-java-modules/core-java-lang/src/main/resources/hello.txt b/core-java-modules/core-java-lang/src/main/resources/hello.txt new file mode 100644 index 000000000000..45c0dbb315df --- /dev/null +++ b/core-java-modules/core-java-lang/src/main/resources/hello.txt @@ -0,0 +1,3 @@ +Hello World! +Cheers +Baeldung Team \ No newline at end of file