How to install Oracle Java 8 JDK on Linux Mint Debian Edition

Java_logo_182x247 mint_debian_logo


(1) Download the tar.gz (x86 or x64, depending on your platform)of latest JDK from the Oracle web site; (2) extract the content of the tar.gz file into /usr/local/java/ (you will need root privileges); (3) supposing the latest version is jdk1.8.0_25 then run the following commands:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_25/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_25/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_25/bin/javaws" 1

sudo update-alternatives --set java /usr/local/java/jdk1.8.0_25/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_25/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_25/bin/javaws

Update your $JAVA_HOME by adding the following lines at the end of your /etc/profile:

export JAVA_HOME
export PATH

Remove an older version

In case you were upgrading from an older version of Java 8 then, supposing the older version was jdk1.8.0_20, run the following commands to remove it:

sudo update-alternatives --remove javac /usr/local/java/jdk1.8.0_20/bin/javac
sudo update-alternatives --remove javaws /usr/local/java/jdk1.8.0_20/bin/javac
sudo update-alternatives --remove javaws /usr/local/java/jdk1.8.0_20/bin/javaws

and then delete the directory /usr/local/java/jdk1.8.0_20.

Remove all the other versions

In case you don’t need any other version of Java in your system, and you only need the latest, then you can safely remove the pre-installed ones by running the following commands:

sudo apt-get purge openjdk-6-jre* && sudo apt-get purge openjdk-6-jdk*

Install the Firefox Java Plugin

To install the Java plugin for Firefox run:

cd  ~/.mozilla/plugins
ln -s /usr/local/java/jdk1.8.0_25/jre/lib/amd64/

Restart Firefox and then type “about:plugins” in the location bar to confirm that the Java Plugin is loaded.

Firefox might complain you are not using the latest version of Java. In that case then you’ll have to use the IcedTea browser plugin. To install it run:

sudo apt-get install icedtea-7-plugin
cd  ~/.mozilla/plugins
ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/

Eclipse suggested settings, shortcuts, templates and troubleshooting

eclipseI have been using the Eclipse IDE for coding for several years, mostly in Java but also in PHP, HTML, CSS and Javascript. With this post I would like to share my favorite settings, Java templates and shortcuts I use on a daily basis, and some troubleshooting I had to deal with.

Suggested settings

Window / Preferences / General

  • Editors / Text editors
    • Undo history size = 99999
    • Show print margin
    • Show line numbers
    • Spelling / Disable spell checking
  • Web Browser = Use external web browser
  • Workspace
    • Refresh using native hooks or polling
    • Text file encoding: UTF-8

Window / Show View / Tasks

Package Explorer

  • View menu / Package presentation = hierarchical
  • “Link with editor” selected

Java templates

  • try finally block

Name = tryf
Description = try finally block

try {
} finally {
    // ${todo}: cleanup code
  • explicit lock-unlock block

Name = lul
Description = explicit lock-unlock block

try {
} finally {
  • iterate over map

Name = formap
Description = iterate over map

for (Entry<${key_type}, ${value_type}> entry : ${map}.entrySet()) {
    ${key_type} key = entry.getKey();
    ${value_type} value = entry.getValue();
  • read a file through scanner

Name = fread
Description = read a file through scanner

try (Scanner input = new Scanner(new BufferedInputStream(
        new FileInputStream(${file_name})))) {
} catch (FileNotFoundException e) {
    // ${todo}: handle exception
  • write a file through printwriter

Name = fwrite
Description = write a file through printwriter

try (PrintWriter output = new PrintWriter(new FileWriter(${file_name}))) {
} catch (IOException e) {
    // ${todo}: handle exception

Favorite shortcuts

CTRL+SHIFT+F Format source code = automatic indentation
ALT+SHIFT+R Refactor = Renames the selected element and (if enabled) corrects all references to the elements (also in other files)
CTRL+SHIFT+O Organize the imports = adds the missing import statements and removes the unused ones
CTRL+O Shows all methods of the current class, press CTRL+O again to show the inherited methods
CTRL+SHIFT+T Types search = quick access to a class of the current project
CTRL+left mouse click Opens the declaration or implementation of a variable, constant, method or class
ALT+right/left arrow Goes to previous or next editor position in history
CTRL+D Deletes the current line
CTRL+M Maximizes/minimizes the selected panel
ALT+SHIFT+N Opens a menu for the quick creation of a new element (Class, Interface, Package, etc)
CTRL+1 Quickfix = shows potential fixes for warnings, errors or shows possible actions
CTRL+F11 Runs the current class as Java application or the last executed application, depending on the preferences (by default it’s the last executed application)
CTRL+PGUP/PGDOWN Switch forward/backwards the current selected editor from the currently opened editors
CTRL+E Allows to select an editor from the currently opened editors
SHIFT+F2 Shows the Javadoc for the selected type / class / method

Keep in mind that you can quickly access any Eclipse element by typing in the Quick Access in the top right corner of the window.

A more comprehensive list can be found at ZeroTurnaround:


  • to fix the problem with Unity scroll bar, which doesn’t work in Eclipse, run:
    sudo vim /usr/bin/eclipse

    and insert the following lines at the beginning of the file:

    # work around for LP #769277
    # end work around
  • to fix the problem of Eclipse crashing at startup displaying an error dialog with the message “An error has occurred. See the log file /home/user/.eclipse/org.eclipse.platform_3.7.0_155965261/ configuration/1334402764482.log.” run the following commands:
    sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java
    sudo cp /usr/lib/jni/libswt-*.so ~/.swt/lib/linux/x86_64/
    sudo chown myusername. ~/.swt/lib/linux/x86_64/*
    sudo chmod 755 ~/.swt/lib/linux/x86_64/*

    Replace x86_64 with x86 if you have a 32-bit machine;

  • Eclipse on Linux uses by default  UTF-8 as text encoding, while on Windows it uses the CP1252 one: when you transfer your source code from one system to the other some special characters (like the accented vowels) may not appear correctly in one of the systems. To fix this problem open your Eclipse on Windows and change its text encoding from CP1252 to UTF-8 from the menu Window → Preferences → General → Workspace, in the “Text file encoding” panel. To change the encoding of a file from CP1252 to UTF-8 run the following command on a Linux terminal:
    iconv --from-code=WINDOWS-1252 --to-code=UTF8

Set up Eclipse and Tomcat 7 on Linux to create Java RESTful Web Services with Jersey

  1. Install Eclipse and Tomcat 7 by running in a terminal:
    sudo apt-get install eclipse tomcat7 -y
  2. assign the tomcat7 group to your user. Assuming your username is pippo, run:
    sudo adduser pippo tomcat7

    Note: you need to log out and log back in for the changes to take effect.

  3. stop the system-wide Tomcat by running:
  4. prevent the system-wide Tomcat from automatically starting at boot by running:
    sudo update-rc.d tomcat7 disable
  5. install WTP (Web Tools Platform) by running Eclipse and then:
    1. from then menu Help select Install New Softare…
    2. next to Work with: open the drop down menu and select the update site of your Eclipse version
    3. select Web, XML, Java EE Development and OSGi Enterprise Development, press Next and complete the installation;
  6. to configure WTP to use Tomcat 7:
    1. select Windows -> Preferences -> Server -> Runtime Environments;
    2. press Add…;
    3. select “Apache Tomcat v7.0”;
    4. enter “/usr/share/tomcat7” into the “Tomcat installation directory” field;
    5. press Ok;
  7. create a new “Dynamic Web Project”
    • as Target Runtime select “Apache Tomcat v7.0”;
    • press twice Next;
    • select the “Generate the web.xml deployment descriptor” option at the final dialog;
    • press Finish;
  8. open the Servers view:
    • go to Window->Show View->Other…;
    • choose the Servers under the Server category;
  9. click on new server wizard;
    • choose Apache / Tomcat v7.0 Server and press Next;
    • enter “/usr/share/tomcat7” into the “Tomcat installation directory” field;
    • press Next;
    • select your project on the left pane under “Available” and press Add> to move it to the right pane under “Configured”;
    • press Finish”;
  10. download the zip of Jersey;
  11. put the the jersey jars into the folder “WEB-INF/lib” and add them to the project build path;
  12. create your first RESTful Webservice by following this tutorial by Lars Vogel.

Your web services will be automatically deployed in the following folder:


Your web service will be accessible through the following URI:



  1. UrlPattern = the root of your service set inside the tag url-pattern in the web.xml;
  2. ClassPath = the path set for your class
  3. methodPath = the path set for your method

All the files you put in your WebContent folder will be accessible via http through the following URI:


Note: make sure the tag url-pattern in the web.xml is set to something like this:


and not something like this:



  • to fix the error “Cannot create a server using the selected type” assign the tomcat7 group to your user. Assuming your username is pippo, run:
    sudo adduser pippo tomcat7
    cd ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/    
    rm org.eclipse.jst.server.tomcat.core.prefs    
    rm org.eclipse.wst.server.core.prefs

    Alternatively you can try this other solution.

  • to fix the error “Could not load the Tomcat server configuration at /usr/share/tomcat7/conf. The configuration may be corrupt or incomplete. /usr/share/tomcat7/conf/catalina.policy (No such file or directory)” assign the tomcat7 group to your user. Assuming your username is pippo, run:
    sudo adduser pippo tomcat7
  • to fix the error “Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete” assign the tomcat7 group to your user. Assuming your username is pippo, run:
    sudo adduser pippo tomcat7

Things to do after installing Ubuntu 13.04

Ubuntu 10.04

  • From Software Sources:
    1. select “Other Software”;
    2. check “Canonical Partners”;
  • install squid-deb-proxy-client to auto-discover caching-enabled machines in the local network by running::
    sudo apt-get install squid-deb-proxy-client -y
  • install some basic software by running in a terminal:
    sudo apt-get update && sudo apt-get install vim eclipse-platform \
    openjdk-7-jdk meld chromium-browser skype gimp inkscape \
    gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-plugins-bad \
    rar p7zip-full ttf-mscorefonts-installer flashplugin-installer keepass2 \
    python-launchpadlib python-apport gparted gpicview -y
  • Follow the Eclipse basic configuration and fixes;
  • remove unused applications:
    sudo apt-get --purge remove modemmanager thunderbird
  • install Dropbox (do not use nautilus-dropbox from Ubuntu Software Center because of this bug. If you have installed that accidentally, make sure you have uninstalled it and wiped out your ~/.dropbox directory before installing the version from their web site). If you are upgrading from previous versions of Ubuntu then uninstall first the client by running:
    rm -rf ~/.dropbox-dist
    sudo rm -rf /var/lib/dropbox/.dropbox-dist

    then to install the latest version run:

    dropbox start -i
  • to fix the broken/corrupted flash problem install the Flash-Aid add-on for Firefox and reboot for the change to take effect;
  • set up the fastest mirror by editing your /etc/apt/sources.list. The geographical location does not always give the best mirror: in order to choose the best mirror it is recommended to know your local internet network topology;
  • edit your .bashrc and change “alias ll=’ls -alF'” to “alias ll=’ls -lF'”;
  • Nautilus, Edit / Preferences / Default View = List View
  • to keep recent files from appearing in Unity: click on Privacy in the System Settings and disable Record Activity
  • to fix this bugaffecting LibreOffice run:
    sudo add-apt-repository ppa:om26er/unity
    sudo apt-get update && sudo apt-get upgrade

    and then reboot;

  • gedit Text Editor, Edit / Preferences:
    • check display right margin;
    • check highlight current line;
    • check highlight matching brackets;
    • uncheck create a backup copy of files before saving;
    • increase font size;
    • plugins, check Change Case and Sort;
  • Image Viewer, Edit / Preferences
    • Slideshow
      • uncheck “Expand images to fit screen”;
      • uncheck “Loop sequence”;
    • Plugins
      • check “Date in statusbar”;
  • set Libreoffice to use the metric system by default: open LibreOffice Writer and go to Tools / Options / LibreOffice Writer / General and set the measurement unit from the drop down menu called Measurement Unit. Do the same for each LibreOffice application;
  • set your search domains:
    1. with a DHCP server, edit your /etc/dhcp/dhclient.conf and add a line like the following for each of the domains you want to use:
      prepend domain-name "";
    2. with a static IP, edit your /etc/resolv.conf and add a line like the following for each of the domains you want to use:
  • to rename and automount your NTFS partition:
    1. make required no folders in /mnt
      sudo mkdir /mnt/win
    2. check your partition list using
      sudo fdisk -l
    3. open /etc/fstab by running:
      sudo gedit /etc/fstab
    4. add entries in the following manner
      /dev/sdb1 /mnt/large ntfs user 0 0
    5. to make it appear in Nautilus open the directory by clicking on File System on the left menu, go into /mnt/win, from the top menu “Bookmarks” select “Add bookmark”.

How to install Oracle Java 6 JDK on Ubuntu 12.10

  • download the .bin JDK from here;
  • run the following commands (if you have a 32-bit machine replace x64 with i586):
chmod +x jdk-6u43-linux-x64.bin
sudo chown root. -R jdk1.6.0_43/
sudo mv jdk1.6.0_43/ /usr/lib/jvm/

sudo update-alternatives --install "/usr/bin/java" "java" 
"/usr/lib/jvm/jdk1.6.0_43/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" 
"/usr/lib/jvm/jdk1.6.0_43/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" 
"/usr/lib/jvm/jdk1.6.0_43/bin/javaws" 1

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws


If you have a JAVA_HOME variable set, then you need to update that with the new path (/usr/lib/jvm/jdk1.6.0_43).


How to install Android SDK on Ubuntu 11.10

  1. Install Oracle Java 6 JDK;
  2. install Eclipse by running:
    sudo apt-get install eclipse-platform -y
  3. if you are running a 64-bit distribution run:
    sudo apt-get install ia32-libs -y
  4. start Eclipse, then select Help > Install New Software:
    • add the following repositories:
      • Name: Eclipse Indigo
      • Name: ADT Plugin
    • select the checkbox next to “Developer Tools” and click next, next, accept the terms and finish; press OK at the secirity warning; at the end restart Eclipse;
    • at the “Welcome to Android Development” dialog select “Install new SDK” option and press Next, and then Finish;
    • at the “Choose packages to install” press “Accept All” and press “Install”;

Globus Toolkit 5.2 released

Globus Toolkit 5.2 promises to greatly enhance the ability to install, setup and update the GT client and service components. This has been achieved by providing binary native packages Red Hat, Fedora, Debian, Ubuntu, Scientific Linux, and CentOS. Globus developers will maintain a Globus repository containing all packages.

GT 5.2 includes the latest versions of all components: GRAM, GridFTP, MyProxy and GSISSH. This latest version of GRAM includes a number of scalability and reliability improvements found from working with Open Science Grid (OSG) that are not in the 5.0 series. GridFTP added support for the DCSC command, which allows the client to specify credentials used to secure the data channel connection. Globus Online utilizes this command for seamless data movement across multiple security domains.

GT 5.2 is protocol and client API compatible with GT 5.0 (e.g. 5.2 clients will work with GT 5.0 services, and visa versa.)

For more information about GT 5.2 visit

Globus Toolkit 4.0.x troubleshooting

Disclosure: this troubleshooting is intended for legacy applications which mandatory need the version 4.0.x of Globus Toolkit. If you don’t have an impelling reason to install that particular version, it is highly recommended that you install the latest version available of Globus Toolkit from its official web site and follow the installation guide of the official documentation.

See also the official Globus Toolkit admin guide troubleshooting.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

ERROR service.ReliableFileTransferImpl [main,<init>:76] Unable to setup database driver with pooling.Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections

  • open /etc/postgresql/X.Y/main/postgresql.conf(where X.Y is current PostgreSQL version) and check that the line beginning with “listen_addresses” is not commented (i.e. the line should not begin with a #) and is set to listen to all addresses, in the following way:
    listen_addresses = '*'
  • open /etc/postgresql/X.Y/main/pg_hba.conf” and check that the last line looks like:
    host rftDatabase "globus" "x.x.x.x" md5

    where “x.x.x.x” is your public IP address. If you are using Globus Toolkit on your local machine for testing purposes then using should be fine, although in this case you won’t be able to access Globus services outside your machine;

  • check that PostgreSQL is up and running and on which port:
    sudo netstat -tulpn | grep postgres
  • PostgreSQL should run on port 5432. The default port number may be automatically changed (usually to 5433) as result of a version upgrade. To change it back to 5432 edit the /etc/postgresql/X.Y/main/postgresql.conf and the stop and start the service (warning: a restart won’t be enough) with:
    sudo service postgresql stop
    sudo service postgresql start
  • to check whether PostgreSQL is running properly on the 5432 port run:
    telnet localhost 5432
  • the message “telnet: Unable to connect to remote host: Connection refused” would mean either PostgreSQL is not running, or is running on the wrong port. If you get “Connected to localhost.localdomain. Escape character is ‘^]’.” then PostgreSQL is fine.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

ERROR service.ReliableFileTransferImpl [main,<init>:76] Unable to setup database driver with pooling.A connection error has occurred: FATAL:  password authentication failed for user “root”

  • open $GLOBUS_LOCATION/etc/globus_wsrf_rft/jndi-config.xmland look into the “dbConfiguration” section:
    • make sure the userName value is not “root” but “globus”;
    • make sure the “password” value is not “foo” but the password for the globus user you have previously set in postgres;
    • make sure the “connectionString” value contains the fully qualified domain name of your host (e.g. “jdbc:postgresql://”).
  • make sure you are running globus-start-container as globus user.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

ERROR service.ReliableFileTransferImpl [main,<init>:76] Unable to setup database driver with pooling.A connection error has occurred: FATAL:  password authentication failed for user “globus”

  • you may have forgotten to create the globus user in postgres. To fix it follow the steps 22 and 23 on this tutorial.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

/O=YourCA/CN=Name Surname” is not authorized to use operation:}requestSecurityToken on this service

  • ensure that in your /etc/grid-security/grid-mapfile there is a line containing the Subject of your usercert.pem (note that you need to change the ‘, ‘ with ‘/’), followed by a user on the server machine (you can use globus if you don’t have a user account on that machine). For example:
    "O=YourCA/CN=Name Surname" globus

    Stop and restart your Globus container for changes to take effect.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

client.GramJob keeps displaying annoying INFO

  • edit /usr/local/globus-4.0.8/ and set the variable to WARN so that it will look this way:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

exec.StateMachine [RunQueueThread_2,createFaultFromErrorCode:3181] Unhandled fault code 201

Job … failed. Description: Error code: 201 Cause: org.globus.exec.generated.FaultType: Error code: 201 caused by [0: org.oasis.wsrf.faults.BaseFaultType: Script stderr:

Can’t locate Globus/GRAM/JobManager/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl . /usr/local/globus-4.0.8/lib/perl) at (eval 1) line 2.]

  • you have probably missed one step during the installation of Globus Toolkit. To fix that, run the following command as globus user:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

exec.StateMachine [RunQueueThread_2,createFaultFromErrorCode:3181] Unhandled fault code 201

Job … failed. Description: Error code: 201 Cause: org.globus.exec.generated.FaultType: Error code: 201 caused by [0: org.oasis.wsrf.faults.BaseFaultType: Script stderr:

Using a hash as a reference is deprecated at /usr/local/globus-4.0.8/lib/perl/Globus/GRAM/ line 161.Using a hash as a reference is deprecated at /usr/local/globus-4.0.8/lib/perl/Globus/GRAM/ line 174.]

  • there seems to be a bug in Perl 5.x, or some kind of incompatibility issue between Perl 5.x and Globus Toolkit 4.0.x. To fix that, you need to edit the file lib/perl/Globus/GRAM/ and remove the % character in front of $attributes at lines 161 and 174.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

The file $GLOBUS_LOCATION/etc/globus_wsrf_rft/jndi-config.xml is missing

  • you have probably missed one step during the installation of Globus Toolkit. To fix that, run the following command as globus user:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

My client application does not receive any notification from the server.

  • make sure the client and the server nodes resides in the same local area network and that there is no interference by a firewall or NAT router. To avoid NAT router problems try adding in the /etc/hosts of each one of your server nodes the following entry:
    x.x.x.x hostname fully.qualified.hostname

    where x.x.x.x is the server public IP.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

java.lang.RuntimeException: File map configuration file /usr/local/globus-4.0.8/etc/gram-service/globus_gram_fs_map_config.xml has no mappings.
at org.globus.exec.service.exec.utils.FileMapping.<init>(

  • your /usr/local/globus/etc/gram-service/globus_gram_fs_map_config.xml is corrupted or wasn’t created during the Globus Toolkit installation as it was supposed to. Download this file (right click and choose save as), put it in /usr/local/globus/etc/gram-service/ and replace ????? with the hostname of your machine.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Authentication failed [Caused by: Operation unauthorized (Mechanism level: Authorization failed.
Expected “/CN=host/localhost” target but received “/O=…/OU=…/CN=host/…”)]

  • The /etc/grid-security/grid-mapfile of your server machine may be misconfigured. Make sure the values of O, OU e CN are the same as those of your user’s usercert.pem certificate file.

Globus Toolkit 5.2 beta released

The 5.2 release is protocol and source compatible with Globus Toolkit 5.0.

Major Changes between 5.0 and 5.2:

  • Native packaging for linux distributions based on RPM and Debian package managers
  • The concept of “flavors” of Globus libraries has been obsoleted
  • Elimination of the compile-time distinction between threaded and non-threaded builds. All libraries are built to be thread-safe, but most applications and services will run by default without threads. The GLOBUS_THREAD_MODEL environment variable can be used to select between “none” (nothreads) and “pthreads” event-handling model.
  • The toolkit has been reorganized to be compliant with the Filesystem Hierarchy Standard.
  • The environment variable GLOBUS_LOCATION is no longer required to be set at runtime (though it is still honored to allow non-native packages to be relocated).
  • Shared library versioning to allow different versions of libraries to coexist.
  • Simplified configuration: more default values for Globus service configurations (especially GRAM5), more admin tools for interacting with tools (GRAM gatekeeper, audit)
  • Cleaner separate of configuration file and implementation for GRAM LRM modules.
  • Elimination of GPT setup packages as a way to create default configuration files
  • Much simplified globus-simple-ca package for managing a CA, including tools for distributing RPM and debian packages containing CA certificate and policy files.
  • More user-installable documentation and man pages for tools and libraries
  • Many bug fixes

For more information about GT 5.2 visit