J2EE with Netbeans and Tomcat with Ubuntu Mate

You should have installed a recent java jdk. If you want also use java FX install the Oracle jdk. Open jdk has some trouble with java FX cause licences.
J2EE may not be downloaded from Oracle separately.
Install Netbeans from the Ubuntu repository and download tomcat .gz file from http://tomcat.apache.org/download-80.cgi.
Netbeans will be version 8.1 and I use tomcat 8.5.15. My OS is Ubuntu Mate 17.04.
Extract the apache-tomcat-8.5.15.tar.gz to your home-folder or where ever you want.
Start Netbeans and select from the Tools menu Plugins.
Add Java EE Base and EjB and EAR plugins.

(click to enlarge)

Without the EjB and EAR plugin an „javaee-endorsed-api-7.0.jar missing error“ will raise, when you start a new project.

Go to the Tool menu and choose Servers.
Click on Add Server .. down left in the window and choose Apache Tomcat or TomEE.
The server location is the root directory where tomcat was extracted to, i.e. the tomcat folder in your home folder.
Enter a username and a password and leave the option „Create user …“ checked.

There is also a well known bug in the tomcat configuration you have to fix.
Open the server.xml in <tomcat-folder>/bin set the connector tag as comment and define the connector like this:


(click to enlarge)

That’s it.
Now you can start a new project and test the installation. When click on the green arrow for „run project“ the code will be deployed, tomcat is starting and a new browser-window or tab opens with the result of your code.
This setup is so much easier than with MS Windows. And except download times you will be back at work in less than 15 minutes.

(click to enlarge)


Screen tearing on Linux on Thinkpad X201 with Ultrabase Dock on external LCD display

I have had the problem, that „waves“ were moving from the bottom of the monitor to the top.
It was not important which linux distribution I used. It was the same on every distribution. But most worst it was on XFCE environments. I tried to fix it with driver options and other compositors like compton, but nothing really helps.
For another reason I unplugged one time all USB devices from the dock. And the screen tearing was gone. I was surprised.
I found that the tearing comes from the power management. It tries to turn USB devices of and turn them directly on again. That results the tearing on the screen.
There is an advanced power management system called tlp that is available for every distribution.
Install tlp and set USB_AUTOSUSPEND = 0 in /etc/default/tlp . After that restart the computer or restart the service tlp and the „waves“ are history.
I tested this with Ubuntu MATE, Xubuntu, Ubuntu Gnome, Opensuse XFCE / Gnome, Debian XFCE / MATE / Gnome, Fedora Gnome 24/25, Manjaro XFCE and Linux Mint 18 MATE / Cinnamon.
Perhaps this will work with other machines with an intel i915 graphic chip.


Install LAMPP Stack on Ubuntu MATE Xenial Xerus 16.04

I used the Beta 2 Version for this tutorial and have rebuild my whole Ubuntu Mate 14.04 environment on 16.04 Beta 2 from the computer I use every day for business and it works flawless. I like Ubuntu MATE because it is stable. This Beta 2 is more stable than other distros after release date. And I can do all my stuff with this distro like programming in python, php, lazarus, java, making printing templates for the printery with gimp, inkscape, scribus in pdf/x format and icc cmyk profiles, making videos with openshot and all the other things with libreoffiice. MATE is the best balanced DE between resource saving and usability.
For wordpress and web development I need a local web server every day. Php 7 is the most recent version of php, but most web servers use php5 until now.

WordPress works fine with php7 but many plugins have problems. And without plugins wordpress is useless.
So I install php5, because it makes no sense to develop things, that can’t be used in the real live.

Some things are different from the installation on 14.04.
I installed apache2, mariadb, php5 and myphpadmin. lampp

Update 5/29/2016
PHP5 is no longer available in Ubuntu repositories.
You can only install PHP7 from there.

But there is a ppa for PHP5.6.
So the installation process changed.
Here is how to install apache2, mariadb, php5.6 and myphpadmin using the ppa:

First open a terminal and install the packages:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install apache2
sudo apt-get install mariadb-server

Mariadb has no root password by default. You should set a password else you will get in trouble with phpmyadmin when logging in from the browser. Change new_password to your new password. To set the root password follow these steps in a terminal:

sudo mysql -uroot -p
use mysql
update user set password=PASSWORD("new_password") where User='root';
update user set plugin='' where User='root';
flush privileges;

Restart mariadb.

systemctl restart mysql

Install PHP5.6 and phpmyadmin

sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring 
sudo apt-get install php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
sudo apt-get install php php-mysql php5.6-gd phpmyadmin libapache2-mod-php 
sudo apt-get install php5.6-curl php5.6-zip php5.6-xml php5.6-soap 
sudo apt-get install php-mbstring php-gettext php5.6-mcrypt 

Phpmyadmin asks for the password of mariadb while installation. 
If you get an error 1045 while installation, hit „ignore“.
When you start phpmyadmin the first time, a message comes up to install

To switch between PHP5 and PHP7 use a2enmod

sudo a2dismod php5
sudo a2enmod php7.0

The version numbers can differ with the years. You will find all avalible modules at

If you want to use wordpress with pretty permalinks (e.g mysite.com/my-new-post) you have to enable mod_rewrite.

sudo a2enmod rewrite
systemctl restart apache2

Now tell apache to use pretty permalinks and edit the apache config file.

sudo pluma /etc/apache2/apache2.conf

Search for : <Directory /var/www/> and replace

AllowOverride None


AllowOverride All

in this section, save the file and restart apache.

systemctl restart apache2

Now the basic configuration is done and you can use the LAMPP stack as it is.
The root directory is /var/www by default. I don’t like that, because there is always trouble with the permissions. I put the web server root directory in my home directory.
That means no trouble with permissions and it is easy to backup.

Create a new directory as server root in your home directory.

mkdir /home/username/html

Edit the default virtualhost file:

sudo pluma /etc/apache2/sites-available/000-default.conf

change DocumentRoot from /var/www to the path of your new server root
e.g. /home/username/html
Take care: There is NO slash behind the last directory.

Edit apache2.conf:

sudo pluma /etc/apache2/apache2.conf

Search for : <Directory /var/www/> and replace /var/www with your new server root
e.g. /home/username/html/
Take care: There IS a slash behind the last directory.

On my own laptop I don’t deal with permissions so I changed them for the html directory to 777. Never do this on a production machine.

sudo chmod -R 777 /home/username/html

That’s it.