Repository navigation
Tutorial Quick Start
Vlad Dumitrescu edited this page Oct 27, 2010
·
1 revision
Thanks to Eli Liang for writing this guide.
- Start eclipse
- If it prompts you to choose workspace, select the folder you want to work in. For this tutorial you might want to use a fresh one.
- On the menu bar, Choose Help -> Software Updates...
- Select the Installed Software tab. If "Erlang IDE" appears under name, then go to [17][3].
- Select the Available Software tab.
- Click the Add Site... button on the right.
- In the Location field, enter
http://erlide.org/update - Click OK
- Check the box left of http://erlide.org/update
- Check the box left of Unstable builds
- Click the Install... button on the right
- When the Install dialog pops, click on the Next button
- Accept the terms of the license agreement.
- Click Finish.
- Click Yes to restart.
- Go to [20][4] below
- Select (click on) Erlang IDE
- Click on the Update button on the right
- Follow the directions to update and restart Eclipse.
- Click on the Workbench icon on the right side of the main eclipse window
- On menu bar, choose Windows -> Preferences -> Erlang -> Install runtimes
- See if there is a runtime listed in the drop down field called Runtime used by Erlide itself (restart is required). If there is something there, hit Cancel and go on to [28][5].
- Click on the Add... button.
- In the Runtime name field, enter
erl5.6.4. - In the Location field, browse to the very top level folder of the Erlang tree. This should be a folder called "erl5.6.4" or something like that.
- Click OK. Then Click Apply and OK in the Install runtimes pane.
- On menu bar, choose File -> Restart
- On menu bar, chose Windows -> Open Perspective -> Other... -> Erlang. Click OK.
- On menu bar, chose File -> New -> Project...
- In wizard, chose Erlang -> Erlang Project and click Next
- In Project name field, type
HelloWorldProject - Click Finish
- On menu bar, choose Project and make sure that Build Automatically option is checked
- The left pane is the Erlang Navigator. Right-click the HelloWorldProject branch. In the context menu that pops, select New -> Other... -> Erlang -> Module and click Next (can also just select "New Module" directly)
- In the wizard, in the Module name field, type
hello - Click Finish
- On menu bar, choose Run -> Run Configurations...
- Select the "Erlang application"
- Click the New Launch configuration button (left side above the field with "type filter text")
- Select the "New configuration"
- Select the "Main tab" in the right pane
- Check the box left of the HelloWorldProject
- Select the "Runtimes" tab in the right pane
- In the filed titled Node name, enter
erlide - In some environments, Java and Erlang look for the default
.erlang.cookiefile in different places, and if you get connection problems you should enter some value for the Cookie field. If the node is already running, you have to use the same cookie value; otherwise, any string will do. - Check the box to the left of "Start the Erlang node if not running presently"
- Click "Apply" and "Run"
- In the center code pane (titled "hello.erl"), enter the following code:
hello/0(within the brackets for the export, so it reads "-export([hello/0]).") - On the next line after the export, enter the following code:
hello() -> io:format("Hello World!~n", []).
- In the menu bar, choose File -> Save As...
- Double-click on the folder titled "HelloWorldProject" in the dialog box
- Click on (select) the folder titled "
src" in the dialog box. The field entitled Enter or select the parent folder: should now readHelloWorldProject/src - Click OK. The file "
hello.erl" is saved in the src directory and automatically built. - The lower pane has a number of tabs. Select the "Console" tab.
- In the console pane, enter the following command "
hello:hello()." and hit return. The output from the program will appear. - To exit, in the menu bar, choose File -> Close, and then File -> Exit