I just went through a lot of internet search in order to do exactly what the title says, looks like in the Java world you need to have always a IDE like Eclipse, or even worse, Netbeans, but sometimes I just need to test a concept and I don’t want to create a project for it.
In this case I just wanted to make a simple REST client posting a JSON object and receiving the information, lots of posts uses libraries, frameworks and all kind of stuffs, but I wanted to make it the simpler possible so, here’s my code:
Keep in mind the commands on the instructions:
This command compiles the code and includes the JAR in order to check for the classes
javac -cp lib/java-json.jar JavaRestClientTest.java
This commands runs the code but also includes the JAR and the path where the code is
java -cp lib/java-json.jar:./ JavaRestClientTest