{"id":387,"date":"2018-01-17T10:03:30","date_gmt":"2018-01-17T10:03:30","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/htccondor\/?page_id=387"},"modified":"2025-02-21T12:06:08","modified_gmt":"2025-02-21T12:06:08","slug":"java","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/software\/java\/","title":{"rendered":"Java"},"content":{"rendered":"<div class=\"entrytext\">\n<h2><span id=\"Overview\">Overview<\/span><\/h2>\n<p>Java is a general-purpose computer programming language that is concurrent, class-based and object-oriented developed by <a href=\"https:\/\/www.java.com\/en\/download\/faq\/develop.xml\">Oracle<\/a>.<\/p>\n<h2>Restrictions on use\/License information<\/h2>\n<p>Java is released under the <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/terms\/license\">Oracle Binary Code license<\/a>.<\/p>\n<p>There is no restriction on the number of simultaneously running java programs on HTCondor.<\/p>\n<h2><span id=\"Versions_installed\">Versions installed<\/span><\/h2>\n<table align=\"center\" border=\"1\">\n<tbody>\n<tr>\n<th align=\"center\">JDK version<\/th>\n<th align=\"center\">JDK update<\/th>\n<th align=\"center\">HTCondor ClassAd<\/th>\n<\/tr>\n<tr>\n<td align=\"center\">1.7.0<\/td>\n<td align=\"center\">1.7.0_79<\/td>\n<td align=\"center\">HAS_STANDARD_IMAGE<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">1.8.0<\/td>\n<td align=\"center\">1.8.0_92<\/td>\n<td align=\"center\">HAS_JAVA_1_8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span id=\"Set_up_procedure_on_submit_node\">Set up procedure on the HTCondor submit node<\/span><\/h2>\n<p>To enable the java compiler you must first run the command:<\/p>\n<pre>\r\nmodule load JDK\/&lt;JDK version&gt;\r\n<\/pre>\n<p>and then access the compiler using the command <tt>javac<\/tt>.<\/p>\n<h2><span id=\"Running_the_application\">Running the application<\/span><\/h2>\n<p>In order to run java code on HTCondor, it is first necessary to compile the java code into a java class file using the java compiler.<\/p>\n<h3>Step 1 &#8211; Compiling your java code<\/h3>\n<p>To ensure that your java code will run on HTCondor, it is advisable to compile your java code on the HTCondor submit node.<\/p>\n<p>From a linux terminal prompt, run the command:<\/p>\n<pre>\r\njavac &lt;java_code&gt;.java\r\n<\/pre>\n<p>to produce a java class file. Please note that the name of the java class file is determined by the contents of the java file and need not match the name <tt>&lt;java_code&gt;<\/tt>.<\/p>\n<h3>Step 2 &#8211; Submitting your code to run on HTCondor<\/h3>\n<p>Running java code on HTCondor is simply a matter of submitting the java class file with a suitable submit file. The following lines are the contents of a simple generic HTCondor submit text file:<\/p>\n<pre>\r\nUniverse = vanilla\r\n\r\nRequirements = (Target.Opsys == \"LINUX\" &amp;&amp; Target.Arch == \"X86_64\" &amp;&amp; &lt;HTCondor ClassAd&gt;=?=True)\r\nRequest_Memory = 1000\r\n\r\nLog = java.log\r\nOutput = java.out\r\nError = java.error\r\nNotification = Error\r\n\r\nShould_Transfer_Files = Yes\r\nWhen_To_Transfer_Output = On_Exit\r\n\r\nExecutable = \/opt\/JDK\/jdk&lt;JDK update&gt;\/bin\/java\r\nTransfer_Executable = False\r\nEnvironment = JAVA_HOME=\/opt\/JDK\/jdk&lt;JDK update&gt;\r\nArguments = &lt;java_code&gt; &lt;input arguments&gt;\r\nTransfer_Input_Files = &lt;java_code&gt;.class\r\n\r\nQueue\r\n<\/pre>\n<p>If your submit file is called <tt>submit.txt<\/tt> then your job can be submitted to HTCondor using the command <tt>condor_submit submit.txt<\/tt>.<\/p>\n<h2>Sample java HTCondor jobs<\/h2>\n<ol>\n<li><a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/software\/java_calculate_pi\/\">Java code for calculating Pi using <em>n<\/em> terms of the Gregory series<\/a>.<\/li>\n<\/ol>\n<p><\/body><\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Java is a general-purpose computer programming language that is concurrent, class-based and object-oriented developed by Oracle. Restrictions on use\/License information Java is released under the Oracle Binary Code license. There is no restriction on the number of simultaneously running java programs on HTCondor. Versions installed JDK version JDK update HTCondor ClassAd 1.7.0 1.7.0_79 HAS_STANDARD_IMAGE 1.8.0 1.8.0_92 HAS_JAVA_1_8 Set up procedure on the HTCondor submit node To enable the java compiler you must first run.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/software\/java\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"parent":17,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-387","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":15,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/387\/revisions"}],"predecessor-version":[{"id":1241,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/387\/revisions\/1241"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/17"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/media?parent=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}