Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
software:java:farber [2018-08-10 16:27] – created anita | software:java:farber [2021-04-27 16:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Projects in Java on Farber ====== | ||
+ | |||
+ | Below is a basic Java example and steps you can follow and apply to your '' | ||
+ | |||
+ | <file java HelloWorld.java> | ||
+ | public class HelloWorld | ||
+ | { | ||
+ | public static void main(String[] args) | ||
+ | { | ||
+ | System.out.println(" | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | Check the versions of java development available on your cluster by using | ||
+ | |||
+ | <code bash> | ||
+ | $ vpkg_versions openjdk | ||
+ | </ | ||
+ | |||
+ | and make sure you select the appropriate version to compile and create the '' | ||
+ | |||
+ | <code bash> | ||
+ | [farber ~]$ workgroup -g it_css | ||
+ | [(it_css: | ||
+ | [(it_css: | ||
+ | public class HelloWorld | ||
+ | { | ||
+ | public static void main(String[] args) | ||
+ | { | ||
+ | System.out.println(" | ||
+ | } | ||
+ | } | ||
+ | [(it_css: | ||
+ | Your job 1392265 (" | ||
+ | waiting for interactive job to be scheduled ... | ||
+ | Your interactive job 1392265 has been successfully scheduled. | ||
+ | Establishing / | ||
+ | [(it_css: | ||
+ | Adding package `openjdk/ | ||
+ | [(it_css: | ||
+ | [(it_css: | ||
+ | HelloWorld.class | ||
+ | [(it_css: | ||
+ | Hello, World! | ||
+ | [(it_css: | ||
+ | [(it_css: | ||
+ | </ | ||
+ | |||
+ | Once we are back on the head node, you will need a job submission script to run your java job. For this simple example, copy '' | ||
+ | |||
+ | <file bash submit.qs> | ||
+ | # | ||
+ | # Template: | ||
+ | # | ||
+ | # Change the following to #$ and set the amount of memory you need | ||
+ | # per-slot if you're getting out-of-memory errors using the | ||
+ | # default: | ||
+ | # -l m_mem_free=2G | ||
+ | # | ||
+ | # If you want an email message to be sent to you when your job ultimately | ||
+ | # finishes, edit the -M line to have your email address and change the | ||
+ | # next two lines to start with #$ instead of just # | ||
+ | # -m eas | ||
+ | # -M my_address@mail.server.com | ||
+ | # | ||
+ | |||
+ | # Add vpkg_require commands after this line: | ||
+ | vpkg_require openjdk/ | ||
+ | |||
+ | # Now append all of your shell commands necessary to run your program | ||
+ | # after this line: | ||
+ | java HelloWorld | ||
+ | </ | ||
+ | |||
+ | Now submit the job using '' | ||
+ | |||
+ | <code bash> | ||
+ | (it_css: | ||
+ | Your job 1392329 (" | ||
+ | [(it_css: | ||
+ | job-ID | ||
+ | ------------------------------------------------------------------------------------------------------------------------------------------------ | ||
+ | | ||
+ | [(it_css: | ||
+ | HelloWorld.class | ||
+ | [(it_css: | ||
+ | [(it_css: | ||
+ | |||
+ | [CGROUPS] UD Grid Engine cgroup setup commencing | ||
+ | [CGROUPS] Setting 1073741824 bytes (vmem none bytes) on n038 (master) | ||
+ | [CGROUPS] | ||
+ | [CGROUPS] done. | ||
+ | |||
+ | Adding package `openjdk/ | ||
+ | Hello, World! | ||
+ | [(it_css: | ||
+ | </ | ||
+ | |||
+ | <note tip> | ||