Difference between revisions of "Programming/Java"

From HPC
Jump to: navigation , search
m
m (Navigation)
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995.  
 
Java is a high-level programming language originally developed by Sun Microsystems and released in 1995.  
  
Java runs on a variety of platforms, including Viper (LInux), Windows, and Mac OS.
+
Java runs on a variety of platforms, including Viper (Linux), Windows, and Mac OS.
  
  
 
=== Programming example ===
 
=== Programming example ===
  
<pre style="background-color: #C8C8C8; color: black; border: 2px solid green; font-family: monospace, sans-serif;">
+
 
 +
<pre style="background-color: #f5f5dc; color: black; font-family: monospace, sans-serif;">
  
  
Line 26: Line 27:
 
The following modules are available:
 
The following modules are available:
  
* module load java/jdk1.7.0_80
+
* module add java/jdk1.7.0_80
* module load java/jdk1.8.0_102
+
* module add java/jdk1.8.0_102
  
  
 
==== Compilation ====
 
==== Compilation ====
  
The program would be compiled in the following way, which a choice Java JDK available.
+
The program would be compiled in the following way, which is a choice of Java JDK available.
 
* <strong>Javac</strong> - is the JAVA byte compiler
 
* <strong>Javac</strong> - is the JAVA byte compiler
 
* <strong>Java</strong> - is the JAVA runtime  
 
* <strong>Java</strong> - is the JAVA runtime  
Line 39: Line 40:
 
<pre style="background-color: black; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: black; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
  
[username@login01 ~]$  module load java/jdk1.7.0_80 (or module load java/jdk1.8.0_102)
+
[username@login01 ~]$  module add java/jdk1.7.0_80 (or module add java/jdk1.8.0_102)
  
 
[username@login01 ~]$  javac MyFirstJavaProgram.java
 
[username@login01 ~]$  javac MyFirstJavaProgram.java
Line 47: Line 48:
 
</pre>
 
</pre>
  
 +
== Next Steps ==
 +
 +
[http://www.tutorialspoint.com/java/ http://www.tutorialspoint.com/java/]
  
[[Category:Programming]]
+
{{Languagespagenav}}

Latest revision as of 11:28, 16 November 2022

Programming Details

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995.

Java runs on a variety of platforms, including Viper (Linux), Windows, and Mac OS.


Programming example



public class MyFirstJavaProgram {

   /* This is my first java program  */

   public static void main(String []args) {
      System.out.println("Hello World"); // prints Hello World
   }
}

Modules Available

The following modules are available:

  • module add java/jdk1.7.0_80
  • module add java/jdk1.8.0_102


Compilation

The program would be compiled in the following way, which is a choice of Java JDK available.

  • Javac - is the JAVA byte compiler
  • Java - is the JAVA runtime



[username@login01 ~]$  module add java/jdk1.7.0_80 (or module add java/jdk1.8.0_102)

[username@login01 ~]$  javac MyFirstJavaProgram.java
[username@login01 ~]$  java MyFirstJavaProgram 
Hello World

Next Steps

http://www.tutorialspoint.com/java/





Languages | Main Page | Further Topics