From edcec4f7a85eb9b3b339b3928edcd94d93625445 Mon Sep 17 00:00:00 2001 From: Bob <625750414@qq.com> Date: Thu, 9 Dec 2021 15:02:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compile-run-with-classpath/solution.sh | 2 ++ .../ReadEnvironmentVariableAndSystemProperty.java | 2 +- read-env-variable-system-property/solution.sh | 4 ++++ system-out-system-err/solution.sh | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compile-run-with-classpath/solution.sh b/compile-run-with-classpath/solution.sh index 292074f..366d645 100644 --- a/compile-run-with-classpath/solution.sh +++ b/compile-run-with-classpath/solution.sh @@ -7,3 +7,5 @@ # First argument is blank: true # Second argument is blank: true # Third argument is blank: false +javac -classpath commons-lang3-3.9.jar StringIsBlank.java +java -classpath commons-lang3-3.9.jar:. StringIsBlank "" " " "*" diff --git a/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java b/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java index 1c78cf2..c901136 100644 --- a/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java +++ b/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java @@ -3,4 +3,4 @@ public static void main(String[] args) { System.out.println("Environment variable AAA: " + System.getenv("AAA")); System.out.println("System property BBB: " + System.getProperty("BBB")); } -} +} \ No newline at end of file diff --git a/read-env-variable-system-property/solution.sh b/read-env-variable-system-property/solution.sh index 1dfb638..e0805ce 100644 --- a/read-env-variable-system-property/solution.sh +++ b/read-env-variable-system-property/solution.sh @@ -6,3 +6,7 @@ # 使得该java命令输出: # Environment variable AAA: $A; # System property BBB: ' +export AAA='$A;' +#echo $AAA +javac ReadEnvironmentVariableAndSystemProperty.java +java -DBBB="'" ReadEnvironmentVariableAndSystemProperty \ No newline at end of file diff --git a/system-out-system-err/solution.sh b/system-out-system-err/solution.sh index 5cdeb2b..64323a6 100644 --- a/system-out-system-err/solution.sh +++ b/system-out-system-err/solution.sh @@ -2,3 +2,5 @@ # 请在这里编写两条命令: # 1. 在当前目录中,使用javac命令编译PrintSystemOutSystemErr.java # 2. 在当前目录中,使用java命令运行PrintSystemOutSystemErr,使其标准输出和标准错误都重定向到当前目录下一个名为output.txt的文件中 +javac PrintSystemOutSystemErr.java +java PrintSystemOutSystemErr > output.txt 2>&1 \ No newline at end of file From 599f4d2852b2fb15ec8bd7505bfca39b0d7e7c07 Mon Sep 17 00:00:00 2001 From: Bob <625750414@qq.com> Date: Thu, 9 Dec 2021 15:02:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compile-run-with-classpath/solution.sh | 2 ++ .../ReadEnvironmentVariableAndSystemProperty.java | 2 +- read-env-variable-system-property/solution.sh | 4 ++++ system-out-system-err/solution.sh | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compile-run-with-classpath/solution.sh b/compile-run-with-classpath/solution.sh index 292074f..366d645 100644 --- a/compile-run-with-classpath/solution.sh +++ b/compile-run-with-classpath/solution.sh @@ -7,3 +7,5 @@ # First argument is blank: true # Second argument is blank: true # Third argument is blank: false +javac -classpath commons-lang3-3.9.jar StringIsBlank.java +java -classpath commons-lang3-3.9.jar:. StringIsBlank "" " " "*" diff --git a/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java b/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java index 1c78cf2..c901136 100644 --- a/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java +++ b/read-env-variable-system-property/ReadEnvironmentVariableAndSystemProperty.java @@ -3,4 +3,4 @@ public static void main(String[] args) { System.out.println("Environment variable AAA: " + System.getenv("AAA")); System.out.println("System property BBB: " + System.getProperty("BBB")); } -} +} \ No newline at end of file diff --git a/read-env-variable-system-property/solution.sh b/read-env-variable-system-property/solution.sh index 1dfb638..e0805ce 100644 --- a/read-env-variable-system-property/solution.sh +++ b/read-env-variable-system-property/solution.sh @@ -6,3 +6,7 @@ # 使得该java命令输出: # Environment variable AAA: $A; # System property BBB: ' +export AAA='$A;' +#echo $AAA +javac ReadEnvironmentVariableAndSystemProperty.java +java -DBBB="'" ReadEnvironmentVariableAndSystemProperty \ No newline at end of file diff --git a/system-out-system-err/solution.sh b/system-out-system-err/solution.sh index 5cdeb2b..64323a6 100644 --- a/system-out-system-err/solution.sh +++ b/system-out-system-err/solution.sh @@ -2,3 +2,5 @@ # 请在这里编写两条命令: # 1. 在当前目录中,使用javac命令编译PrintSystemOutSystemErr.java # 2. 在当前目录中,使用java命令运行PrintSystemOutSystemErr,使其标准输出和标准错误都重定向到当前目录下一个名为output.txt的文件中 +javac PrintSystemOutSystemErr.java +java PrintSystemOutSystemErr > output.txt 2>&1 \ No newline at end of file