ant scp task

Ant SCP Task:

<?xml version="1.0" encoding="UTF-8"?>

<project name="MyProject" default="copyToUnix" basedir=".">

	<target name="copyToUnix">
		<scp todir="user@vserver:/var/www/myFolder/" keyfile="/Users/dummy/.ssh/id_rsa">
			<fileset dir="WebContent">
				<include name="*.php" />

You need an additional jar file for ant scp task:

Apache Ant – Copy files to ftp server

Sample for copying files to an FTP Server:

<?xml version="1.0" encoding="UTF-8"?>
<project name="project" basedir="." default="deploy">
	<target name="deploy">

		<ftp server=""
			<fileset dir="Testing">
				<include name="*.php"/>
				<include name="*.js"/>


By default, ant is not able to process this, because the ftp classes are not included by the typical ant installation.

To enable ant to use ftp tasks, you have to download the apache commons ftp package. The dependencies of Apache Ant can be found here:

Place the downlaoded commons-net.jar file into the lib folder of your ant installation. Now you can execute the ant tasks in your cmd shell.

If you have placed the jar-file outside the ant-lib directory you can run the ant-script with the lib-parameter:

ant -lib "/home/philipp/java/libs/commons-net-3.3/commons-net-3.3.jar"


Apache commons net:

Ant FTP Task:

Eclipse Updates or Plugins are not working – Linux / RHEL

Few days ago I wrote an article about how to Install Eclipse on RHEL (

After I installed some plugins I noticed, that they are not working with the „standard“ user. When installing the plugins as root they worked well.

I found a very good explanation on the Google GWT Plugin Page:

To avoid any problems with the installation and update of plugins, you should directly after you extracted the eclipse*.tar change the owner via:

sudo chown -R <user> eclipe

After I changed the owner to my current user, the installation and updates of my plugins worked perfectly fine.

I hope this tip can also help you 😉


Java RMI – How to setup java.rmi.server.codebase in Eclipse

A typical problem when running and building java RMI Applications is the following Exception:

Registering server with rmiregistry
Error happened: RemoteException occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 

To handle that problem, you have to set the following JVM Argument when running the ServerApplication:


When using Eclipse, you can set this Argument in the Run Configuration:

Right Click on the ServerApplication java file -> Run As -> Run Configuration

Go to the Arguments Tab and insert the codebase argument in the VM Arguments Section:


Be careful with the trailing slash at the end. This slash is NECESSARY.

When I tried to point to the src directory of my Project it did not work, but if it points to the bin directory it worked fine.


Have fun with Java RMI 🙂

Eclipse User Libraries – How to manage build path libraries for several projects easily

After switching my Workspace from Windows to Linux, I had to reconfigure the build-Path for each Eclipse project separately. This was a lot of work, so I took a look on how to manage build path libraries easily.

Eclipse ships a great solution for that, called „User Libraries“.

I will show you the advantages of user libraries and how to use them:

The Problem:

After switching my workspace to Linux, I had several Build Path errors like this:


The Solution:

To solve that, I had to reconfigure the build Path for all of my Projects in order to make them working.

This is a lot of work and if you want to upgrade your required Libraries (in this case you want to upgrade from ActiveMQ 5.4.3 to ActiveMQ 5.6.1) you have again to reconfigure all Build Paths that require that jar-File.

The Solution: User libraries

To avoid that, I decided to use User Libraries. How is it working? You can create your own libraries in which you can put several jar files (or classes). Then you have to reconfigure your build path in the projects to use the user libraries instead of the single jar files. If you now upgrade your Jar file (for Example ActiveMQ) you only have to modify your user library instead of all your project build paths.


Example in Pictures:

3 Projects that are using the same libraries:

Now we will create a User Library that contains the activemq-all.jar and log4j.jar file (Window -> Preferences:)

Add the needed jar-files to that library:

Then you see something like this:

Then you can reconfigure your projects to use this user library instead of the single jar-files (right click on project -> Build Path -> configure Build Path), remove the single jar files, and Add your user library (Add Library -> User Library -> „Your own Lib“):

Old build path:

New Path (with user library):


Projects View old:


Project View with user library:


Now you can apply that for all your Projects that are using ActiveMQ and/or log4j:


In the future you only have to maintain your user library and it will effect all the projects that are using that library:

Have fun with your own user libraries 😉