mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-02 11:05:28 -04:00
initial commit
This commit is contained in:
parent
6ddaa13c1e
commit
de4395dc5e
44
README.md
44
README.md
@ -22,7 +22,49 @@ package.
|
||||
|
||||
The package compiles on Java 1.6-1.8.
|
||||
|
||||
# With commit [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project has changed from a flat directory containing all of the Java files to a directory structure that includes unit tests. If you have difficulty using the new structure, please open an issue so we can work through it.
|
||||
** Recently [#515 Merge tests and pom and code](https://github.com/stleary/JSON-java/pull/515), the structure of the project changed from a flat directory containing all of the Java files to a directory structure that includes unit tests and several build tools to build the project jar and run the unit tests. If you have difficulty using the new structure, please open an issue so we can work through it.
|
||||
|
||||
** Building from the command line
|
||||
|
||||
* Build the class files from the package root directory src/main/java
|
||||
|
||||
* * javac org\json\*.java
|
||||
|
||||
* Build the jar file
|
||||
|
||||
* * jar cf json-java.jar org/json/*.class
|
||||
|
||||
* Compile a program that uses the jar (see below example code)
|
||||
|
||||
* * javac -cp .;json-java.jar Test.java
|
||||
|
||||
* Excecute the Test file
|
||||
|
||||
* * java -cp .;json-java.jar Test
|
||||
|
||||
|
||||
* Test file contents
|
||||
|
||||
````
|
||||
import org.json.JSONObject;
|
||||
public class Test {
|
||||
public static void main(String args[]){
|
||||
JSONObject jo = new JSONObject("{ \"abc\" : \"def\" }");
|
||||
System.out.println(jo.toString());
|
||||
}
|
||||
}
|
||||
````
|
||||
|
||||
* Expected output
|
||||
|
||||
````
|
||||
{"abc":"def"}
|
||||
````
|
||||
|
||||
|
||||
You can only run the unit tests with Maven or Gradlew.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user