A STAR-CCM+ macro is a Java program that is compiled and executed within the STAR-CCM+ workspace. This is the key reason that the Java SDK (Software Development Kit) is required - to compile the Java macros. Unlike other macro systems, STAR-CCM+ does not record every mouse movement, button click and keystroke, but rather it translates your actions from the workspace into meaningful Java code.
The macros that you write are completely standard Java so you have access to all the programming constructs of that language, such as loops and conditional constructs. In addition, the STAR-CCM+ server exposes a number of objects that you instantiate and manipulate to carry out the sequence of tasks that you require. You can activate a macro with the Play Macro... command.
You can write a macro from scratch, but that would require up-front knowledge about all the objects, attributes and methods exposed by the server. It is more effective to use the workspace to record the actions you want to perform, edit the Java file using your favorite text editor to get the exact effect you require, and then run the macro as often as you need.
Since the macro is just a Java program, it will not compile if there are syntax errors. When this happens, the error messages will be displayed so that you have specific file names, line numbers and issues to fix.