Bureaucrats, cc_docs_admin, cc_staff
2,306
edits
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
Compute Canada's systems have several different Java virtual machines installed which are made available to users via the <tt>module</tt> command like other software packages. You should normally only have one Java module loaded at a time. The principal commands associated with such Java modules are <tt>java</tt> to launch the Java virtual machine and <tt>javac</tt> to call the Java compiler for converting a Java source file into byte code. | Compute Canada's systems have several different Java virtual machines installed which are made available to users via the <tt>module</tt> command like other software packages. You should normally only have one Java module loaded at a time. The principal commands associated with such Java modules are <tt>java</tt> to launch the Java virtual machine and <tt>javac</tt> to call the Java compiler for converting a Java source file into byte code. | ||
Java software is frequently distributed in the form of a JAR file with the extension <tt>jar</tt>. You can use such software by means of the following command, | |||
{{Command|java -jar file.jar}} | |||
assuming the JAR file has been compiled to operate as an autonomous program (i.e. it possesses a <tt>Main-class</tt> manifest header). | |||
==Parallelism in Java== | ==Parallelism in Java== | ||
Line 29: | Line 33: | ||
===Memory Issues=== | ===Memory Issues=== | ||
Java uses an automatic system called ''garbage collection'' to identify variables which are out of scope and return the memory associated with them to the operating system which however doesn't stop many Java programs from requiring significant amounts of memory to run correctly. When a Java virtual machine is launched using the <tt>java</tt> command a default amount of the system memory is allocated to this virtual machine which may be inadequate. To correct this problem, you can tell the Java virtual machine the maximum amount of memory to use with the command line argument <tt>Xmx</tt>, for instance | Java uses an automatic system called ''garbage collection'' to identify variables which are out of scope and return the memory associated with them to the operating system which however doesn't stop many Java programs from requiring significant amounts of memory to run correctly. When a Java virtual machine is launched using the <tt>java</tt> command a default amount of the system memory is allocated to this virtual machine which may be inadequate. To correct this problem, you can tell the Java virtual machine the maximum amount of memory to use with the command line argument <tt>Xmx</tt>, for instance | ||
{{Command|java -Xmx4096m file.jar}} | {{Command|java -Xmx4096m -jar file.jar}} | ||
tells the Java virtual machine that it can use up to 4096 MB of memory. | tells the Java virtual machine that it can use up to 4096 MB of memory. | ||