From charlesreid1

Line 84: Line 84:
=Libraries=
=Libraries=


awesome-java repo on github [https://github.com/akullpp/awesome-java]
awesome-java repo on github: https://github.com/akullpp/awesome-java


immutables in Java (similar notation to javascript/d3) [https://immutables.github.io/]
Immutables in Java (similar notation to javascript/d3): https://immutables.github.io/


libgdx for 3d games in Java [https://libgdx.badlogicgames.com/]
libgdx for 3d games in Java: https://libgdx.badlogicgames.com/
* 3d graphics: https://github.com/libgdx/libgdx/wiki/3D-Graphics
* 3d graphics: https://github.com/libgdx/libgdx/wiki/3D-Graphics


stanford core NLP in java [https://stanfordnlp.github.io/CoreNLP/]
stanford core NLP in java: https://stanfordnlp.github.io/CoreNLP/


legion of the bouncy castle [https://www.bouncycastle.org/java.html]
legion of the bouncy castle (lightweight crypto in Java): https://www.bouncycastle.org/java.html
* lightweight crypto API in Java


apache shiro for session management (large enterprise or small mobile) [https://shiro.apache.org/]
Selenium web browser test suite: http://docs.seleniumhq.org/
 
jsoup crawler and html parser https://jsoup.org/
 
twitter4j twitter client: http://twitter4j.org/en/index.html
 
crawler4j another crawler and html parser https://github.com/yasserg/crawler4j
 
Apache Shiro for session management (large enterprise or small mobile) https://shiro.apache.org/


selenium web browser test suite [http://docs.seleniumhq.org/]


jsoup crawler and html parser [https://jsoup.org/]


crawler4j another crawler and html parser [https://github.com/yasserg/crawler4j]





Revision as of 18:15, 31 May 2017

Cool: http://www.ibm.com/developerworks/library/j-robots/index.html

Getting Started

Download and install Java, if you need to.

Hello World

This will walk through compiling and running a "Hello world" example in Java.

The program

Here's a simple Java "Hello world" program:

public class HelloWorld {
    public static void main(String[] args) { 
        System.out.println("Hello world!");
    }
}

Compiling

To compile this program, use the javac command:

$ javac HelloWorld.java

This will create a HelloWorld.class file, which is the Java executable.

Running

To run a Java executable, use the java command, and pass it the executable's filename without the extension:

$ java HelloWorld
Hello, world!

Measuring Performance of Java Code

See Java/Profiling and Java/Timing

Using Jar Files

If you have a jar file that contains class definitions and you wish to use it, you can do the following:

  • To check contents of the jar, use the jar utility - it works a lot like tar
  • jar xf - expands (shows contents of) jar

Compile

To compile code mysource.java with a jar file called org.example.jar:

On Linux/Mac:

javac -cp '.:org.example.jar' mysource.java

On Windows:

javac -cp .;org.example.jar mysource.java

After this, you obtain the bytecode file mysource.class

Run

Now run the bytecode file:

java -cp '.:org.example.jar' mysource
java -cp .;org.example.jar mysource


Libraries

awesome-java repo on github: https://github.com/akullpp/awesome-java

Immutables in Java (similar notation to javascript/d3): https://immutables.github.io/

libgdx for 3d games in Java: https://libgdx.badlogicgames.com/

stanford core NLP in java: https://stanfordnlp.github.io/CoreNLP/

legion of the bouncy castle (lightweight crypto in Java): https://www.bouncycastle.org/java.html

Selenium web browser test suite: http://docs.seleniumhq.org/

jsoup crawler and html parser https://jsoup.org/

twitter4j twitter client: http://twitter4j.org/en/index.html

crawler4j another crawler and html parser https://github.com/yasserg/crawler4j

Apache Shiro for session management (large enterprise or small mobile) https://shiro.apache.org/