In order to run models built using HAL’s code base, you’ll need to download at least the Java8 JDK (Java Development Kit); newer JDKs should also work. To check if the JDK is already installed, open a Command Line (or terminal) prompt and enter:
java -version javac -version
If both of these commands print 1.8 or newer, you’ll be able to run HAL. If not, get the latest Java JDK by googling it or from the Oracle Website. (No need to download the demos and samples).
To download HAL’s source code, go to the GitHub repository to clone HAL, or click “download” get a zip file containing the source code along with the included examples. You’ll need to include these source files in each project developed using HAL. Unzip this folder and drop the files into the desired location.
Intellij Idea is a great IDE to edit and run Java code. It can be downloaded at jetbrains.com (a community edition is freely available). Students and academic faculty members can get the professional version free by applying at jetbrains.com/student.
- Download HAL
- Open Intellij Idea
- Navigate to the File menu and click New -> “Project from Existing Sources”
- Navigate to the directory with the unzipped HAL Source code
- Click “yes” for each step until asked for the Java JDK
- Mac: navigate to “/Library/ Java/ JavaVirtualMachines/”
- Windows: navigate to “C:\ Program Files\ Java\”
- Once the setup is complete we will need to do one more step and add some libraries that allow for 2D and 3D
- Navigate to the File menu and click “Project Structure”
- Click the “Libraries” tab
- Use the minus button (-) to remove any pre-existing libraries
- Click the plus button, and direct the file browser to the “Framework/lib” folder.
- Click apply or OK
This will setup the classes, sources, and native library locations that OpenGL needs. To test if everything is working properly, navigate to the “Examples” folder in the side menu, double click on any of the classes to open the source code. Scroll through the code until you find the class called “public static void main” and click the green arrow directly to the left to Run.
We've also designed a custom dark color scheme for Intellj Idea, which can be installed by navigating to the File menu and clicking Import Settings and navigating to the HalColorSchemes.jar file in the top level directory of HAL's source code.
- Automatically importing classes at first code mention (or, right click on the class name to import).
Debugging with the debugger (find an excellent tutorial on the Intellij debugger here).
- HINT: while paused in the debugger right click on anything and click “evaluate expression.”
- “Refactor” to rename variables, change all function signatures, etc. in one click (right click on some code and check out the “refactor” submenu).
- Use “find usages” and “Go To Declaration” to move fluidly around your code base and to see how its pieces connect together (right clicking on things will get you there, see “find usages” and the “go to” submenu).
- using Shift-F10 to quickly run the currently open file, and many other hotkeys to speed up your workflow.
- Tapping Shift twice allows you to search the entire codebase for any search term.
- Type “fori” , “iter” , “sout” or “psvm” then type “tab” to create a for loop, foreach loop, print statment, and main function respectively.