Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compile-run-with-classpath/solution.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env sh
# 请在这里编写两条命令:
# 1. 在当前目录中,使用javac命令编译StringIsBlank.java
javac -cp commons-lang3-3.9.jar StringIsBlank.java
# 2. 在当前目录中,使用java命令运行StringIsBlank,并传递三个参数:第一个参数是一个空字符串,第二个参数是一个空格,第三个参数是一个星号字符*
java -cp 'commons-lang3-3.9.jar;.' StringIsBlank '' ' ' \\42
# 使得该java命令输出:
# Args size: 3
# First argument is blank: true
Expand Down
3 changes: 3 additions & 0 deletions read-env-variable-system-property/solution.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env sh
# 请在这里编写三条命令:
# 1. 导出一个环境变量AAA,值是"$A;"(不包含双引号)
export AAA='$A;'
# 2. 在当前目录中,使用javac命令编译ReadEnvironmentVariableAndSystemProperty.java
javac ReadEnvironmentVariableAndSystemProperty.java
# 3. 在当前目录中,使用java命令运行ReadEnvironmentVariableAndSystemProperty,并传递系统属性(System property)BBB,值为'(一个单引号)
java -DBBB=\' ReadEnvironmentVariableAndSystemProperty
# 使得该java命令输出:
# Environment variable AAA: $A;
# System property BBB: '
2 changes: 2 additions & 0 deletions system-out-system-err/solution.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env sh
# 请在这里编写两条命令:
# 1. 在当前目录中,使用javac命令编译PrintSystemOutSystemErr.java
javac PrintSystemOutSystemErr.java
# 2. 在当前目录中,使用java命令运行PrintSystemOutSystemErr,使其标准输出和标准错误都重定向到当前目录下一个名为output.txt的文件中
java PrintSystemOutSystemErr > output.txt 2>&1