docs: use syntax highlighting

use syntax highlighting to improve the format of the readme
This commit is contained in:
Yeikel 2023-10-21 00:10:42 -04:00 committed by GitHub
parent 411f71137b
commit 6007165c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,24 +44,24 @@ The org.json package can be built from the command line, Maven, and Gradle. The
**Building from the command line** **Building from the command line**
*Build the class files from the package root directory src/main/java* *Build the class files from the package root directory src/main/java*
```` ```shell
javac org/json/*.java javac org/json/*.java
```` ```
*Create the jar file in the current directory* *Create the jar file in the current directory*
```` ```shell
jar cf json-java.jar org/json/*.class jar cf json-java.jar org/json/*.class
```` ```
*Compile a program that uses the jar (see example code below)* *Compile a program that uses the jar (see example code below)*
```` ```shell
javac -cp .;json-java.jar Test.java (Windows) javac -cp .;json-java.jar Test.java (Windows)
javac -cp .:json-java.jar Test.java (Unix Systems) javac -cp .:json-java.jar Test.java (Unix Systems)
```` ```
*Test file contents* *Test file contents*
```` ```java
import org.json.JSONObject; import org.json.JSONObject;
public class Test { public class Test {
public static void main(String args[]){ public static void main(String args[]){
@ -69,31 +69,31 @@ public class Test {
System.out.println(jo.toString()); System.out.println(jo.toString());
} }
} }
```` ```
*Execute the Test file* *Execute the Test file*
```` ```shell
java -cp .;json-java.jar Test (Windows) java -cp .;json-java.jar Test (Windows)
java -cp .:json-java.jar Test (Unix Systems) java -cp .:json-java.jar Test (Unix Systems)
```` ```
*Expected output* *Expected output*
```` ```json
{"abc":"def"} {"abc":"def"}
```` ```
**Tools to build the package and execute the unit tests** **Tools to build the package and execute the unit tests**
Execute the test suite with Maven: Execute the test suite with Maven:
``` ```shell
mvn clean test mvn clean test
``` ```
Execute the test suite with Gradlew: Execute the test suite with Gradlew:
``` ```shell
gradlew clean build test gradlew clean build test
``` ```