How to update sun jdk 7 on Ubuntu 12.04

java logo

Oracle has releasedĀ  JDK 7 Update 6 with JavaFX 2.2 Final for GNU/Linux, Mac OS X and MS Windows last week. I have already written how to install Sun JDK 6-7 on Ubuntu 12.04. I want to write how to update JDK 7 Update 6 manually.

Update JDK 7u6:

If you want to manually upgrade to a new version, first uninstall the JDK 7 and then reinstall. You can check your java version in console "java -version” or online here: Verify java version

Package manager: Those who have already installed an older version of Sun Java via the package manager, removes the same way.

  • First, close the web browser (because of java browser plugin).
  • Remove the Java version from the alternatives system:
sudo update-alternatives --remove "javac" "/usr/lib/jvm/jdk1.7.0_04/bin/javac"
sudo update-alternatives --remove "java" "/usr/lib/jvm/jdk1.7.0_04/bin/java"
sudo update-alternatives --remove "javaws" "/usr/lib/jvm/jdk1.7.0_04/bin/javaws"
  • Remove the browser plugin link:
sudo rm /usr/lib/mozilla/plugins/libnpjp2.so
  • Remove the jdk directory:
sudo rm -rf /usr/lib/jvm/jdk1.7.0_04

Netbeans note: If you uninstall old JDK, NetBeans 7.2 is not starting. Open the netbeans.conf file under etc directory and change theĀ netbeans_jdkhome parameter to the new jdk path.

netbeans_jdkhome="/usr/lib/jvm/jdk1.7.0_06"

Happy coding.

PostgreSQL installation and settings on Ubuntu 12.04

postgresql

Updated for Ubuntu GNU/Linux 13.04 (Raring Ringtail).

  • Install latest PostgreSQL 9.1 in console:
sudo apt-get install postgresql libpq-dev
  • PostgreSQL has a super user is called postgres. Change user to the PostgreSQL user:
sudo su - postgres
  • Change password of postgres user:
psql -d postgres -U postgres
psql (9.1.3) Type "help" for help
postgres=# alter user postgres with password 'YOUR_NEW_PASSWORD';
ALTER ROLE
postgres=# \q
#logout postgres user
logout
  • Restart the PostgreSQL server:
sudo /etc/init.d/postgresql restart

pgAdmin III: PostgreSQL administration and management tools

  • If pgAdminIII is not installed, the installation is easy:
sudo apt-get install pgadmin3
  • Open pgAdminIII and add new localhost server. Go to menu File > Add Server as the following screenshot:

pgAdmin

Set up pgAdmin III server instrumentation:
When connecting to a PostgreSQL database using pgAdmin you may receive an error letting you know that the server instrumentation is not installed.

  • Install postgresql-contrib package:
sudo apt-get install postgresql-contrib
  • Install adminpack extension:
sudo -u postgres psql
postgres=# CREATE EXTENSION "adminpack";
postgres=# \q

Netbeans IDE 7.2 Look and Feel on Ubuntu 12.04

netbeans
ubuntu

NetBeans tips for java developers:

NetBeans IDE 7.2 has been released. This is the fastest version of NetBeans. I like NetBeans IDE. NetBeans has many good features, especially compared to Eclipse in Swing / JavaFX development. But NetBeans has ugly Look and Feel on Ubuntu. NetBeans GTK Look and Feel has a lot of chopping. Metal Look and Feel is too bad. I like clean and smart UI. That’s why I always use NetBeans IDE with Nimbus Look and Feel on Ubuntu. Better than Metal and GTK Look and Feel.

Nimbus Look and Feel setting is simple in NetBeans.

  • Edit netbeans.conf file (in netbeans-7.2 / etc directory by me)
  • include the option –laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel between the quotation marks in the line beginning netbeans_default_options:
netbeans_default_options="-J-client -J-Xss2m
-J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true
-J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true
-J-Dsun.zip.disableMemoryMapping=true
--laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"

Happy coding in NetBeans!