mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
Merge pull request #812 from yeikel/patch-1
docs: use syntax highlighting
This commit is contained in:
commit
1a2108efa2
28
README.md
28
README.md
@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user