Use Java 6 and Java 7 on (X)ubuntu Eclipse

Install both Java versions

sudo apt-get install openjdk-6-jre
sudo apt-get install openjdk-7-jre

Check active version

java -version

Check installed versions

update-java-alternatives -l

In Eclipse go into
Project > Properties > Java Build Path > Add Library > JRE System Library > Alternate JRE

If your Java is not in it

  • Click on Installed JREs
  • Click Add
  • Click Standard VM
  • Choose Directory containing Java 6 (/usr/lib/jvm/java-6-openjdk-i386)


Map Java Thread Details to Linux processes

  1. Search for Java PID:
    Example ouput:4170 blalub 25 0 6309m 5.2g 10m R 97.5 33.3 732:27.41 java
  2. Get a listing of all Java threads in Java Process with PID 4170:
    top -H -p 4170
  3. Find PID of JBoss:
    jps -l
    Example output: 4170 org.jboss.Main
  4. Using Server PID (4170) for thread dump
    jstack -l 4170 > jstack.log
  5. To find threads from the listing (top -H -p) in jstack.log thread PIDs have to be converted from decimal (listing) to nid hexdecimal (jstack) in jstack output

Hex converter:


When 0 is true – grep exit status

If you want to use grep results in bash scripts then it can get confusing. Because if grep returns a result then its exit status is 0; if it does not return anything the exit status is 1.

So these two line mean, if my script is currently not running.

ps ax | grep | grep -v grep
if [ $? -eq 1 ]; then

vimdiff how to

start vim diff

vimdiff file1 file2

essential commands

ctrl+w ctrl+w -> move cursor to other window
do -> diff obtain get currently marked changes from other window
dp -> diffput : put currently marked change to other window
zo -> open fold
zc -> close fold
:set noscrollbind -> temporarily disable simultaneous scrolling on both buffers
:set scrollbind -> reenable simultaneous scrolling
:qa -> quit all
:wqa -> save all and quit all