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