Julia - Installation Instructions


In this course, you will learn a bit about the Julia programming language. This means that you will need to install:

   1. The programming language, Julia.

   2. A programming environment, Visual Studio Code, along with the proper extensions for the Julia programming language.

This page contains the instructions for the required installations as well as some beginner tips on how to use either programming environment.

 

1. Installing the Julia programming language

 

First, install Juliahttps://julialang.org/downloads/

More specifically, use the 1.8.5 version for the operating system of your preference (I will be using Windows 64-bit).

We recommend that you accept the default installation options.

 

2. Installing the Programming Environment


Install Visual Studio Codehttps://code.visualstudio.com/

More specifically, use: https://code.visualstudio.com/Download#

We recommend that you accept the default installation options.


Installing the Julia Extension

Launch Visual Studio Code and install the Julia extension.

In Visual Studio Code, click the View menu in the top bar, and choose Extensions (Ctrl+Shift+X).

In the extensions pane, type Julia into the search engine (on top) and select the Julia extension by clicking the install button. Visual Studio Code will install it. When the installation completes, restart Visual Studio Code.


Launching the Terminal and the Julia REPL

To run code, or to visualize the results of any program you run, you must launch the Terminal (or REPL). If this tab is not already visible at the bottom of your workspace, go to the View menu in the top bar and choose Terminal (Ctrl+ç in a PT keyboard; Ctrl+` in a US keyboard).

The terminal, at the bottom of your screen, should indicate that you are running Julia. If you do not see a Julia prompt in your terminal (julia>), change the dropdown menu on the top right corner of the terminal to the Julia REPL option.

Another option to start the Julia REPL is available directly through the Command Pallete. Go to the View menu in the top bar and choose Command Pallete (Ctrl+Shift+P). Type Julia: Start REPL in the search engine that appears and select the corresponding option. The terminal should appear at the bottom of your workspace. The same can be achieved with the following key bindings: Alt+J Alt+O



Julia - Beginner tips

 

Opening a Julia file

You can write and run programs directly in the Julia REPL. However, these cannot be saved for later use. The REPL is useful for testing parts of your program and for visualizing the results of program runs. For more complex developments, you should work on a Julia file that can be saved to your computer.

To begin programming, open a new text file. Go to the File menu in the top bar and choose New File (Ctrl+N). This will open a new text file. You now have two options to convert it into a Julia file:

A.      On the bottom right corner of the workspace, you will notice the file is cataloged as Plain Text in the Select Language Mode button. Click on it to change the file type. A search engine will appear, where you should write and select Julia. Your file should now be recognized as a Julia file.

B.      The same effect can be achieved by saving the new text file with the Julia extension. Select the File menu in the top bar and choose Save As (Ctrl+Shift+S). In the Save as type dropdown menu select the Julia (*.jl) option, or simply add the extension yourself to the file name (e.g. Untitled.jl).

You can now start developing Julia code within the file.

 

Running Code

There are several options to run the code in your program. You may run the full program, or you may prefer to run only parts of it. In either case, the results of each run will show in the Julia REPL.

To run the full program click Shift+Enter when your cursor is anywhere within the program file

To run only parts of the file, you can use Ctrl+Enter, which sends the current line (where your cursor is) or selection to the REPL, or use Alt+Enter, which runs the current instruction and moves your cursor downwards simultaneously.

Other useful commands include:

   Ctrl+D or Alt+J Alt+K for exiting the Julia REPL

   Ctrl+C to interrupt or cancel a process. Useful to break infinite loops or erroneous runs.

   Ctrl+L to clear terminal screen.

 

Inline visualization of results

We have shown you how to visualize program results in the REPL. There are other options for the visualization of results, namely inline visualization, which allows you to see the results of your program directly in the program file, in front of the line you just ran. Go to the File menu in the top bar, choose Preferences, and then Settings (Ctrl+,)Here open the Extensions drop-down menu and find Julia. In the Julia extension settings menu, change the default options in Execution: Result Type to inline or to both.