Tag Archives: Java

Find jar with class

This helped me to resolve java.lang.ClassNotFoundException.  Bash command scans jar files in the folder and prints who contains given class.


Maven: install local jar to repository

Adding local jar to maven repository.




Install Hadoop on Ubuntu

The best article of Hadoop installation I found is http://codesfusion.blogspot.ru/2013/10/setup-hadoop-2x-220-on-ubuntu.html 

I adopted it a little for my configuration: Ubuntu 14.04, Hadoop 2.2.0 single node, JDK 6. Not latest versions of Java and Hadoop but I had to reproduce existing production system.  

My steps are:

Install prerequisites

JDK 6 and ssh:

$ sudo apt-get install oracle-java6-installer
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo  apt-get update
$ sudo apt-get install oracle-java6-installer
$ sudo apt-get install ssh

Continue reading

Install Oracle JDK 7 on Ubuntu 13.10

Install JDK from repository (oracle-java7-installer from this ppa is JDK)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Set this version to be used by default
sudo update-java-alternatives -s java-7-oracle
Set up environment variables
sudo apt-get install oracle-java7-set-default

Spring MVC 3.1.1 and Apache Tiles 2 on JBoss AS 7.1 with Hibernate and JTA

Last week I spent some time to bring together Spring MVC, Apache Tiles, Hibernate+JPA with JTA. 

My EAR application consists of two modules: WAR and EJB project. 

WAR project: Spring MVC 3.1.1, Apache Tiles,Maven

EJB project: Hibernate through JPA, Spring 3.1.1, JBoss AS 7.1, JTA data source, Maven.

Configuration artifacts are:

Pom.xml in war project

Contains Spring MVC and Apache Tiles dependencies

Continue reading

JBoss AS 7.1 and UTF-8 encoding

Today I faced an interesting problem at work. It was JSP + Spring MVC 4 + Apache Tiles 2 + JBoss AS 7.1 application. JSP pages contain UTF-8 encoded Russian text encoding and should be displayed in UTF-8 in browser. I placed  @Page directive in some pages:

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

Pages with above directive started to display non-English text perfectly fine. Others continued to show me unreadable rubbish instead (in default JBoss ISO-8859-1). So I already had a solution:

Solution 1 – modify every JSP page in the project to add proper @page directive.

Continue reading

JFreeChart: CandlestickChart example

From time to time I use JFreeChart library. This is a CandlestickChart sample to copy paste from here in future.

Maven dependencies in pom.xml



Continue reading