Menu

Development

Brian Park Gord Thompson

Coding Style Guide

  • real tabs
  • 4-space indent for tabs
  • import statement ordering: Eclipse defaults
  • max line length: undecided (but one of the developers uses 100 column max)

Dev Environment Setup

Ubuntu

The following combination of Ubuntu and Eclipse versions are known to work:

  • Ubuntu 16.04 LTS / Eclipse Mars.2 (4.5.2)
  • Ubuntu 16.10 / Eclipse Mars.2 (4.5.2)
  • Ubuntu 17.04 / Eclipse Neon.3 (4.6.3)

Other combinations may also work but but haven't been verified.

Eclipse Incompatibility with GTK3

Eclipse Mars and Neon are broken under all versions of Ubuntu mentioned above (16.04, 16.10 and 17.04) due to incompatibility with GTK3 (See Eclipse bug, askubuntu 16.04, askubuntu 16.10, stackoverflow 16.04). The symptom of this problem shows up as Eclipse missing a bunch of tool buttons at the top, and the console prints out a whole bunch of errors like:

(Eclipse:9643): GLib-CRITICAL **: g_base64_encode_step: assertion 'in != NULL' failed
(Eclipse:9643): 
Gtk-WARNING **: Negative content height -3 (allocation 1, extents 2x2) while allocating gadget (node toolbar, owner GtkToolbar)

The easiest solution is run the eclipse binary with the SWT_WEBKITT and SWT_GTK3 environment variables set like this:

$ SWT_WEBKIT2=1 SWT_GTK3=0 $HOME/eclipse/java-neon/eclipse/eclipse

or

$ SWT_WEBKIT2=1 SWT_GTK3=0 $HOME/eclipse/java-mars/eclipse

where $HOME/eclipse/java-neon and $HOME/eclipse/java-mars are the directories where you installed Eclipse.

You can create a shell script in $HOME/bin or define aliases in your $HOME/.bashrc (or the equivalent startup file for your own shell program).

Java

There are 2 versions of Java that you can run on Ubuntu:

I've had problems with OpenJDK (I can't remember if it was this project or another project), so I generally use Oracle Java instead. Oracle Java is not supported by the Ubuntu repositories. You can use the WebUpd8 Personal Package Archives (PPA) which maintain the Oracle packages that you can install using the familiar apt command. Do the following:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ sudo apt-get install oracle-java9-installer

Unfortunately, WebUpd8 no longer maintains Java 6 and Java 7. To develop UCanAccess against these versions, you need to go to the Oracle Java website and manually download and install the JDK. You need to create a support account at Oracle to access those files, but you don't need to pay anything (at this time this wiki was written).

Manually Adding a JDK6 Version to the Project

To force Eclipse to use a particular JDK version for UCanAccess, you need to specify the JDK libraries for the project.

  • Import the UCanAccess Maven project using "File > Import... > Maven > Existing Maven Projects".
    • Click "Browse..." and navigate to the directory that contains the pom.xml file.
    • Select the /pom.xml checkbox, and click "Finish".
  • Click on "Project > Properties > Java Build Path"
  • Select the "Libraries" tab.
    • If you imported UCanAccess with only JDK8 (or JDK9) installed on your computer, you will see "JavaSE-1.6" selected in the "JARs and class folders on the build path" box. However, this is incorrect, there's a bug somewhere.
    • If you open up the arrow, you will that it contains JDK8 jars, not JDK6 jars.
  • Click on the "Add Library..." button on the right.
  • Select "JRE System Library" in the "Add Library" dialog box.
  • Click "Next".
  • Select "Alternate JRE" radio button, then click on the "Installed JREs..." button on the right. It will go to another dialog box titled "Preferences (Filtered)".
    • You will see only JDK8 (or JDK9) here.
    • Click on "Add..." button on the right, to bring up a dialog box titled "Add JRE / JRE Type".
      • Select "Standard VM" in the list.
      • Click "Next" to go to "Add JRE / JRE Definition".
      • Click on the "Directory..." button on the right.
      • Select the JDK6 directory that you created when you downloaded and unpacked the file from Oracle. (For example, I downloaded it to $HOME/Downloads/jdk1.6.0_45.)
        • Click "Ok" button on the folder selctor.
      • You should see a whole bunch of JDK 6 jars populating the "JRE Definition" dialog box.
    • Click the "Finish" button.
  • Click on a bunch of "OK" or "Finish" buttons (I can't remember how many) to pop out to the "Proejct > Properties" dialog box.
  • You should see "JRE System Library [JavaSE-1.6]" as an option (or selected here).
    • You may also see duplicate JRE6 entries here, I don't know why that happens.
    • You may also see the JDK8 or JDK9 selected here.
    • Remove the ones that you don't want, and select the JDK6 entry only.
  • Finally, click the "Ok" button to get out of this dialog box.

Maven

You can also use Maven directly on Ubuntu to compile and test the code. Here is how to install and run Maven on Ubuntu:

$ sudo apt install maven
$ mvn compile
$ mvn test -DskipTests=false

Note that Maven itself is a Java program and it no longer works with Java6 from at least 16.04 (perhaps earlier). Currently, the pom.xml is set up to compile UCanAccess with the same version of Java that runs Maven. Therefore, you cannot compile UCanAccess using Java6 using Maven, unless you make some modifications to pom.xml. I have not submitted these modifications because it makes the development environment more complicated than it was worth to support this particular use-case. However, please contact the developers if you need to do it. If there's enough interest, I'll document it.

Broken Tests on Linux

There are a number of functional tests which are broken on Linux. They will be broken on both Eclipse and on the Maven command line.

Windows

Git support in Eclipse on Windows

Eclipse built-in support for Git (EGit) does not seem to like https: transport on this site. (It works fine on GitHub.) These instructions for generating SSH keys using PuTTYgen are basically correct, but EGit does not recognize PuTTY's default file format. I had to export the private key from PuTTYgen using "Export OpenSSH key"...

ExportKey.png

and save it as C:\Users\gord\.ssh\id_rsa (no file extension). Then, after I uploaded my public key to SourceForge (Account Settings > SSH Settings) I was able to use ssh:// URLs with EGit.