Ant Errors: “Perhaps JAVA_HOME does not point to the JDK”

In this case, I was working on a Linux environment (RHEL Server 6.2) which had previously been using the OpenJDK version of Java. For dev purposes, I was required to remove OpenJDK and install an IBM JDK instead. After this, any attempt to build through Ant gave the following error…

{name of file}: Unable to find a javac compiler; is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/opt/ibm/java-i386-60/jre"

At this point I had already set JAVA_HOME on the computer to “/opt/ibm/java-i386-60/bin” and had also created a similar Classpath Variable in Eclipse.

However, there was one thing I had missed. After removing OpenJDK, a reference to it was still in place in the Eclipse preferences. To solve this error I did the following:

Edit Ant’s runtime properties via Window > Preferences > Ant > Runtime. Next, under the Classpath tab, expand the Global Entries entry.
Here, Ant requires a reference to the tools.jar file from your desired JDK. In my case, an old reference still existed belonging to OpenJDK – which I deleted.
Finally, click Add External Jars and select tools.jar from your desired JDK directory (e.g., /opt/ibm/java-i386-60/lib/tools.jar). Your build should now compile successfully.

Note: This error can also occur when no reference to tools.jar exists at all. The steps above will also work in this situation – just exclude the part about removing the OpenJDK file.

Posted in Code Monkey | Tagged , , , | Leave a comment

Linux: FTP issues #1

Below are some problems and solutions that were encountered when attempting to make an FTP connection between two new machines on a network. For the purposes of this post, I shall refer to the machines as Server1 and Client1. It should be noted also that Red Hat systems were in use.


Connection Refused:

In this example, Server1 has the file that Client1 wants. To begin, ftp and vsftpd (the FTP server) must be installed on Server1. If you want to clarify at any point whether these files have been installed – you can do so via the following two commands:

rpm -q ftp and rpm -q vsftpd

Then, to install, run the following commands as the root user (from the root “/” directory).

yum install ftp and yum install vsftpd

Afterwards, you can ensure that the FTP server has started by entering the following command.

service vsftpd start

Over on Client1, simply install ftp alone.

Note: Installing vsftpd on Server1 ensures that the following error is avoided when attempting to ftp from Client1.

ftp: connect :Connection refused


Permission Denied:

On Client1, your first attempt to ftp may generate the following error:

# ftp 9.x.x.x
Connected to 9.x.x.x (9.x.x.x).
220 (vsFTPd 2.2.2)
Name (9.x.x.x:root): root
530 Permission denied.
Login failed.

As this is an attempt to ftp while logged in as root, one solution for this is to check the contents of the following two files on Server1: /etc/vsftpd/ftpusers and /etc/vsftpd/user_list

These files contain lists of users that are not allowed to login via FTP.  In both cases, comment out the line that contains the word “root“. For example:

# Users that are not allowed to login via ftp


Cannot Change Directory:

Once root has been granted ftp access, your next login attempt may generate the following error:

# ftp 9.x.x.x
Connected to 9.x.x.x (9.x.x.x).
220 (vsFTPd 2.2.2)
Name (9.x.x.x:root): root
331 Please specify the password.
Password: <your password>
500 OOPS: cannot change directory:/root
Login failed.

In this case, access to the required directory has been denied by SELinux. This can be fixed by activating the ftp_home_dir Boolean – which is done by running the following command on Server1:

setsebool -P ftp_home_dir=1

Posted in Code Monkey | Tagged , , , , , | Leave a comment

Makefile Tips #1

I had my first experience with Makefiles in Unix today. Here are some initial tips and errors that I experienced…

1) When faced with a file such as – you can’t use the make command straight away. You must first generate the makefile itself from the contents of, like so…


This will produce a standard makefile, that you can then use in conjunction with the make command – simply run make from the command line.

2) If you have several makefiles, you can specify which one to execute with the command:
make -f <name of the makefile to run>
For example…

make -f MyFirstMakefile

3) A makefile may contain targets, that allow you to run specific sets of actions.  To execute a specific target, use the command:
make <name of target>
For example…

make install

4) Error "missing separator. Stop."

This basically means “syntax error”, and appears when make is unable to parse the specified line of your makefile. A common reason for this error is a section of the command script that has been indented with spaces instead of a TAB character. A simple fix to try, is to press TAB at the start of the highlighted line.

Note: Each command line must begin with a TAB character.

5) Error"commands commence before first target. Stop."

I experienced this error when I accidentally placed a TAB character in front of a non-command line. In such a case, make will usually interpret the following text as a command. If the erroneous TAB is recognized as a syntax error, the error above will be displayed.

Posted in Code Monkey | Tagged , , , | Leave a comment

Lotus Symphony: How to disable/undo automatic corrections

Two questions:

1) How do I undo or disable automatic typing corrections?

By default, IBM Lotus Symphony automatically corrects common typing errors while you type. For example, abotu will be changed to about, or the first letter of a sentence will automatically be capitalized.  To quickly undo an automatic correction, press Ctrl+Z.

To turn off these features completely, go to Tools -> Instant Changes in the menu-bar, and deselect the While Typing option.

2) How do I disable date formatting in tables?

By default, a date that you enter into a table is automatically formatted based on the regional settings specified by your operating system.  So, for example, a European user may see a date changed from 2012/03/01 to 01/03/12.

To disable this formatting, right-click a table cell and deselect the Number Recognition option.

Posted in Word Processing | Tagged , , , , , , | 1 Comment

How to find the most frequent text value in a spreadsheet column

Here’s a compact solution to find the single most frequent value:


If entered into cell A1, this will display the value that appears most frequently in the range A2:A6 (see column A below).

Note: In a situation where more than one value appears equal-highest, the value that was counted last will be provided as the result (see column B above).

Posted in Spreadsheets | Tagged , , , , , , | Leave a comment

Eclipse: Workspace Unavailable

Eclipse isn’t known for it’s helpful error messages at the best of times – and here’s one example… “Workspace in use or cannot be created, choose a different one.”

Unfortunately, Eclipse doesn’t offer any suggestions on how to fix this, so some manual searching was required. Here is what worked for me:

  1. Remove the workspace lock:
    • close Eclipse – and go to the .metadata folder in your workspace, e.g. C:\workspace\.metadata.
    • delete the .lock file in this folder.
    • in some cases you may be prevented from deleting the .lock file (see error message below). If this is the case, move to Step 2.
  2. End the Javaw process:
    • open Task Manager, and end the process javaw.exe.
    • return to the metadata folder, and delete the lock file.
    • restart Eclipse.

Eclipse should now open your workspace correctly.

Posted in Computers | Tagged , , | 5 Comments

Viewing Unread Messages Quickly in Gmail

One of the most regular complaints about Gmail is the difficulty in quickly viewing your unread messages. The simplest solution is to do the following:

1) In the Search bar at the top, enter one of the following:


2) Click on “Search Mail”. You will now be presented with all of your unread emails.

However, at times when I really need to access my unread mail quickly, I often forget these commands – and have to search online for them – which defeats the whole purpose of saving time. So here’s a method of creating a permanent link to your unread messages – that you can then access with one mouse-click.

1) Go to Settings -> Labs, and enable the “Quick Links” feature.

2) You will now see a new “Quick Links” menu on the left-hand side of the screen (above “Invite a friend”).

3) Follow the same “Search Mail” steps above… then, with the unread messages on screen, select “Add a Quick Link” in the new menu.

4) Save the Quick Link as “Unread Messages” (or whatever you prefer) and you now have one-click access to all unread mail.

Posted in Internet | Tagged , | Leave a comment

Ant Errors: “Error starting modern compiler”

In my case, this error appeared when I attempted to run an Ant script through Eclipse, that was designed to compile Java classes and package them into a ZIP file.

%my XML file%: Error starting modern compiler

This problem can arise in different development environments, and for different reasons – though generally these reasons are all related – the version of Java being used by the compiler does not match that already loaded by the VM, or being referred to in JAVA_HOME.

To solve this in Eclipse, I first went to Run > External Tools > External Tools Configurations … and accessed the JRE tab.

The next step, change from “Run in the same JRE as the workspace” to specifying a “Separate JRE”:

However, this change still resulted in the “modern compiler” error being displayed. The final step? Despite the prompt asking for a separate JRE – it is in fact the JDK that needs to be selected:

And voila – you should now see these happy words…


Posted in Code Monkey | Tagged , , , , | 20 Comments

Java Errors: “UnsupportedClassVersionError…bad major version at offset=x”

In my case, this error appeared when I attempted to load a class from a batch file in the Windows command prompt.

“Caused by: java.lang.UnsupportedClassVersionError: (*myclassname*) bad major version at offset=6”

This error indicates that your projects were compiled with a higher level Java compiler than the runtime can support.

Firstly, confirm what version of Java is installed on your machine. In Windows, open a command prompt window and enter the following command:

java -version

The output will look something like:

java version "1.5.0_22"
Java(TM) SE Runtime Environment (build 1.5.0_22-b03)
Java HotSpot(TM) Client VM (build 1.5.0_22-b03, mixed mode, sharing)

This message confirmed that my runtime environment was Java 5 – but error above was stating the classes had been compiled in Java 6. The next step is to check what version of Java is being used to compile your project. In my case, I was using Eclipse.

Go to Window > Preferences > Java > Installed JREs and make sure your 5.0 runtime shows up in the list and is checked. If nothing suitable appears in the list of options, then you need to download the correct Java version from the Sun website.

Finally, go to Window->Preferences->Java->Compiler and ensure that your Compiler compliance level is set to 1.5.

Posted in Code Monkey | Tagged , , , | 11 Comments

How To Rename a Series of Files (MS Windows XP)

I’m amazed that I never knew about Windows XP’s built-in function to rename a series of files.  It’s limited (with other available applications giving you more control over the renaming style), but it’s fast and easy.

  1. Open My Computer/Windows Explorer to the folder containing the files you want to rename.
  2. Select the group of files that you wish to rename.
  3. Right-click on the first file in the list and choose Rename from the menu options.
  4. Type a new name for the file…
    • Note that the first file will change to the name you type, while all other selected files will append a number enclosed in brackets to this name.
    • For example, if you typed ‘file.jpg’, the rest of the files will change to ‘file (1).jpg’, ‘file (2).jpg’, etc.
    • When sorting by name, the unnumbered file will sort to the bottom of the list.   To avoid this, include the starting number in the name you type, e.g. ‘mynewfile (1).jpg’.  The numbers for the other files will continue from this number.  Remember to include the space and brackets.
Posted in Computers | Tagged , | Leave a comment