E Under Eclipse

From Erights

Jump to: navigation, search

Contents

Windows XP

While these directions worked for me on Windows XP, it's very likely the same set of instructions would also work on *nix, MacOS X and other versions of Windows.

  • May 31, 2009: Directions executed successfully on MacOS X 10.5.7. (In section 6.4.4: select the appropriate bin/mac/.../swt.jar )

Installation / Setup

  1. Download and install a JRE http://www.eclipse.org/downloads/
    1. If you prefer, you can manually download JRE from http://java.com/en/download/manual.jsp
  2. Download and install Eclipse http://www.eclipse.org/downloads/
    1. Choose "Eclipse IDE for Java Developers".
    2. "Install" it anywhere you want by just extracting it to some place on your hard drive.
  3. Run Eclipse.
    1. Execute eclipse.exe from the folder you extracted it to above.
    2. When the Workspace Launcher appears give it a location you would like it to store it's data files at for you.
    3. On the Eclipse welcome screen click the "Workbench" button on the right side.
  4. Install the Subclipse plug-in.
    1. Follow the directions found at http://subclipse.tigris.org/install.html
    2. When you get to step 6, uncheck the "Integrations (Optional)" box, if you don't the install will fail due to missing dependancies.
  5. Checkout the latest E source code.
    1. Window -> Show View -> Other...
    2. SVN -> SVN Repository
    3. Add SVN Repository (button in top right of SVN Repository window).
    4. Url: svn://svn.synchrona.org/erights/e/trunk/src
    5. Right-click the top level of the source tree you just created and select "Checkout..."
    6. Select "Check out as a project configured using the New Project Wizard" from the Checkout dialog and click Finish.
    7. At the New Project wizard choose Java -> Java Project (Next)
      1. Project Name: E-Source
      2. Create new project in workspace
      3. Use default JRE
      4. Create separate folders for sources and class files
      5. Configure defatult (we change these because the defaults conflict with the E repository folder names)
        1. Source folder name: Source
        2. Output folder name: Output
        3. As JRE library use: JRE container
      6. (Next)
    8. Source Tab: Click on the folder "Source" and select "Remove source folder 'Source' from the build path".
    9. Finish.
    10. Confirm Overwrite: OK
    11. Wait for the SVN Checkout to complete, this may take several minutes.
  6. Setup E Project.
    1. In the Package Explorer window right-click E-Source (root of your newly checked out tree).
    2. Build Path -> Configure Build Path...
    3. Source Tab:
      1. Add Folder...
      2. Check "jsrc" and click OK.
    4. Libraries Tab:
      1. Add Class Folder...
      2. Check esrc, safej, bin/resources and click OK.
      3. Add JARs...
      4. Select bin/win32/x86/swt.jar and click OK
    5. Click OK (in the lower right you should see some action briefly while it builds everything).
  7. At this point I had to restart Eclipse before going on to the next step. I am not sure what the problem is but no matter how many times I tried to do this I always had to restart eclipse or I would be unable to set a Main Class.
  8. Setup a build configuration for Rune.
    1. Run -> Open Run Dialog...
    2. Select Java Application and click New (top left button).
    3. On the "Main" tab:
      1. Name: Rune
      2. Project: E-Source
      3. Main class: org.erights.e.elang.interp.Rune
    4. (Optional) Go to the Common tab and check the box for "Run" under "Display in favorites menu". This will make running Rune easier.
    5. Apply and Close.
  9. Verify it all worked.
    1. Run -> Open Run Dialog...
    2. Select Rune and click "Run".
    3. (Optional) If you added it to the favorites menu you can just use the Run tool in the toolbar which should have "Rune" listed in the dropdown.
    4. In the Console window you should see a '?' and nothing else. Try typing the following followed by enter: 1 + 1
    5. If all went well you should see # value: 2 followed by another '?'

Creating a JAR File

1. Follow the directions above for Installation/Setup.

2. File -> Export...

3. Java -> JAR file (Next)

4. Under E-Source check: jsrc, esrc, safej, bin/resources

5. JAR file: E-Source/e.jar

You will get several warnings, some of which are Java compiler warnings regarding generics which need to be resolved in the E source tree and a few at the end are regarding duplications found in the output. The latter may also require fixes in the build tree, further investigation is required though.

6. Finish


Hello World

  1. Follow the directions above for Installation/Setup and JAR file creation.
  2. File -> New -> Java Project
    1. Project name: Hello World
    2. Contents: Create new project in workspace
    3. JRE: Use default JRE
    4. Project layout: Create separate folders for sources and class files
    5. Next
  3. Libraries tab:
    1. Add JARs...
    2. Select E-Source/e.jar and click OK
    3. Finish
  4. File -> New -> File
    1. Hello World/Source
    2. File name: HelloWorld.e
    3. Finish
  5. In the HelloWorld.e edit window enter this code and save the file: println("Hello World")
  6. Run -> Open Run Dialog...
    1. Select Java Application
    2. Click the "New" button (top left)
    3. Main tab:
      1. Name: Hello World
      2. Project: Hello World
      3. Main Class: org.erights.e.elang.interp.Rune
    4. Arguments tab:
      1. Program arguments: HelloWorld.e
      2. Working directory: Other: Workspace...: Hello World/Output
      3. Apply and Run
  7. If all went well you should see "Hello World" in the console window.

Tips

  • For learning E, create a Run configuration just like you did for Hello World but in the arguments put "${file_prompt}" (no quotes). Doing this will make it so when you run that configuration it will prompt you for a file and pass that filename as an argument to Rune. This will make it so you can create numerouse .e files in your project and only have to have one Run configuration (just use the open dialog to specify which .e file you want to pass to Rune).
Personal tools
more tools