OpenJDK: Difference between revisions

18 bytes removed ,  9 months ago
m (Special:WantedCategories ?)
 
Line 10:
== Usage ==
OpenJDK is a set of command-line tools.
If OpenJDK is installed in <ttkbd>/usr/local/jdk-1.7.0</ttkbd>, then <ttkbd>/usr/local/jdk-1.7.0/bin</ttkbd> needs to be added to the <ttkbd>PATH</ttkbd> environment variable.
The two most important tools are the [[javac]] compiler, and the java runner.
 
This example program would compute 12 - 4.
 
<syntaxhighlight lang="java">
<lang java>/* TwelveMinusFour.java */
public class TwelveMinusFour {
public static void main(String[] args) {
System.out.println(12 - 4);
}
}
}</lang>
</syntaxhighlight>
 
One can compile this program with <kbd>javac</kbd>, and run it with <kbd>java</kbd>.
 
<syntaxhighlight lang="bash">
<lang bash>$ javac TwelveMinusFour.java
$ javajavac TwelveMinusFour .java
$ java TwelveMinusFour
8</lang>
8
</syntaxhighlight>
 
== References ==