Why can't I install the ACP Eclipse plug-in?

What are the pros/cons of WebIDE vs Eclipse-plugin?

What languages does the WebIDE support?

What's the $TMPDIR_GLOBAL environment variable in WebIDE?

How to write Java code to read "src/example.txt" compatible both for WebIDE and Eclipse?

How to refresh a modified file in the WebIDE?

Why is there no Makefile in WebIDE for a C++ project created by Eclipse?

For Eclipse/C++ projects, why am I getting "Launch failed: Binary not found"?

How do I know if there is an update for the Eclipse plugin?

(For instructors) When I upload a project version, auto-generated files are overwritten?

 


 

Why can't I install the ACP Eclipse plug-in?

When attempting to install the ACP Eclipse plug-in, and you get an error message like this:

Could not find https://acp.foe.auckland.ac.nz/install

Unable to read repository at https://acp.foe.auckland.ac.nz/install/content.xml

  • You will need to upgrade the JRE that runs your Eclipse to the latest version. In particular, anything below 1.8.0_91 (i.e. minor version below 91) will receive the above error. More info on releases are available here.
  • Select the latest version, restart Eclipse, and again try to install ACP.

 


 

What are the pros/cons of WebIDE vs Eclipse-plugin?

Depending on the sorts of projects you want to use, students have the choice of either installing the Eclipse plugin or using the WebIDE interface. For teachers, only the Eclipse plugin allows them to upload projects since the WebIDE is currently just read-only. 

ACP via the Eclipse plugin:

  • (+ve) Works best for more advanced programming courses 
  • (+ve) Supports any language/project you can think of. If Eclipse can run it, then you have it as an ACP project! This includes using other plugins, jars, etc.
  • (+ve) Works for projects that need to run on the local machine (e.g. multi-threaded/parallel programming, GUI apps, require file/network I/O, etc).
  • (+ve) No limitation on how projects are set up, as long as Eclipse can run it! 
  • (-ve) Requires installation of Eclipse + plugin (not really a big deal)    

 

ACP via the WebIDE:

  • (+ve) Works just fine for introductory programming courses
  • (+ve) No need to install anything! Just log in and start running those code examples from your brower!
  • (+ve) Works with most web browsers, and has even been tested on tablets! It just gets a little annoying to code on small screens if the virtual keyboard is all you have.
  • (-ve) Limited to simple coding exercises. Programs cannot access web/files or be long-processing (just a few seconds only), and cannot run GUI applications.
  • (-ve) Cannot execute programs interactively. While you can create a program that reads "runtime user input", it needs to be given beforehand in the Input section of the WebIDE.
  • (-ve) For most languages (except C++), the code must be in a single file. A future release will allow multi-file projects.

 


 

What languages does the WebIDE support?

  • Java
  • C/C++
  • Python
  • Bash, Ruby, PHP (should also be possible, but haven't been tested much yet)

 


 

What's the $TMPDIR_GLOBAL environment variable in WebIDE?

  • $TMPDIR_GLOBAL has been deprecated in WebIDE.
  • A path to the directory with read & write permissions is available through an environment variable called $TMPDIR_GLOBAL.
  • The $TMPDIR_GLOBAL variable works for all languages, including C/C++ and Java.
  • The directory available under $TMPDIR_GLOBAL path can store files and/or directories with a total size not exceeding 32MB.
  • Currently, it is required to use the $TMPDIR_GLOBAL variable to retrieve the path to a writable directory, however in the future it will be possible to write to a directory in which the executable resides. In other words, currently it is required to do this: "touch $TMPDIR_GLOBAL/some_file" whereas in the future it will be possible to do the following: "touch some_file".

 


 

How to write Java code to read "src/example.txt" compatible both for WebIDE and Eclipse?


Open and read "scr/example.txt" directly. 

TMPDIR_GLOBAL has been deprecated.

public static void main(String[] a) {
    Charset charset = Charset.forName("US-ASCII");
    
    Boolean isWebIDE = System.getenv("TMPDIR_GLOBAL") == null;
    String prefix = isWebIDE ? "" : System.getenv("TMPDIR_GLOBAL") + "/submission";
    Path file = FileSystems.getDefault().getPath(prefix, "src/example.txt");
    
    BufferedReader reader = Files.newBufferedReader(file, charset));
}

 

 


 

How to refresh a modified file in the WebIDE?

WebIDE is able to reload the modified files automatically. 

The way of adding comment  "// refresh example.txt" has been deprecated.

In the WebIDE, you can refresh a file which was modified by the code after running it.

  • Add the necessary include or import (shown in below examples):

C++: 

#include <fstream>

Java:

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

  • Add a comment at the end of the source code (change example.txt to the name of the modified file):

// refresh example.txt

This currently only supports C++ and Java programs.

 

C++ Example:

#include <fstream>
#include <iostream>
using namespace std;

int main() {
      ofstream myfile;
      myfile.open ("example.txt");
      myfile << "Writing this to a file.\n";
      myfile.close();

      // refresh example.txt
      return 0;
}

 

Java Example:

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

import java.io.BufferedWriter;
import java.nio.file.FileSystems;
import java.nio.file.Path;

public class HelloWorld {

    public static void main(String[] a) {
        Charset charset = Charset.forName("US-ASCII");
        String prefix = System.getenv("TMPDIR_GLOBAL") == null ? "" : System.getenv("TMPDIR_GLOBAL") + "/submission";
        Path file = FileSystems.getDefault().getPath(prefix, "src/example.txt");
        
        String s = "Writing this to a file.";
        try (BufferedWriter writer = Files.newBufferedWriter(file, charset)) {
            writer.write(s, 0, s.length());
        } catch (IOException e) {
            e.printStackTrace();
        }

        // refresh src/example.txt
    }
}

 


 

Why is there no Makefile in the WebIDE for a C++ project created by Eclipse?

  • The Makefile created by Eclipse is not compatible with WebIDE.
  • The default make rules of WebIDE works fine for simple C++ projects.

 


 

For Eclipse/C++ projects, why am I getting "Launch failed: Binary not found"?

When you download a C++ project via ACP for the very first time, you need to Build it and then tell your Eclipse IDE about it. The good news is you only need to do this once, the first time you download the project (not every time you sync it). Follow these steps:

  • Right-click on the newly downloaded project in the Eclipse IDE
  • Select "Build Project"
  • Depending on how the project was set up, there should be an executable (look in the makefile to find out)
  • Locate that executable. Right-click on it, then "Run As" > "Run Configurations"
  • Create a "New Launch Configuration". Give the project a name, and for "C/C++ Application" put the name of that executable (if it is inside a folder, you need to include the folder in the path).
  • The "Run" button will be enabled once you have a correct executable referenced. Click it! 
  • Next time you modify the code (either yourself or via ACP-sync), you can just click on Eclipse's standard green run button. 

 


 

How do I know if there is an update for the Eclipse plugin? 

When the ACP plugin is activited (e.g. when you right-click on an ACP project, or select the ACP menu), the plugin will check for updates and inform you if there is a new version. If there is an issue updating the plugin, you might need to first uninstall it and then re-install it from scratch. 

 


 

(For instructors) When I upload a project version, auto-generated files are overwritten?

If you are using ACP in combination with other plugins, and you get weird behaviour when uploading new versions of a project, try to disable the auto-build of the other plugin -- and see if that fixes the problem. This (yet unsolved) issue has come up when using ACP with the JavaCC plugin (namely JJTree), where the auto-generated Java files are re-generated (even though they should not be after being modified by the user). Disabling the auto-build setting from JavaCC preferences fixes it (but means the *.jj file needs to be compiled by pressing the "Compile with JavaCC button" whenever changed).