How to setup Apache Tomcat, Java on CentOS?

Below set of steps involve setting up Tomcat 6 on CentOS 5 with Java 1.6

Download Apache Tomcat

$ wget http://apache.parentingamerica.com/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz

Go to opt/ folder and extract Tomcat

$ cd /opt

$ tar -xzf apache-tomcat-6.0.36.tar.gz

Create a tomcat user

$ useradd -d /opt/apache-tomcat-6.0.36/ tomcatuser

Change user permission on tomcat folder

$ chown -R tomcatuser:tomcatuser apache-tomcat-6.0.36
Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to install java 6 on CentOS 5 and remove other JDK, JRE version?

At the time of writing this article Java 6 (update 37) was available at http://www.java.com/en/download/manual_v6.jsp

First set up a folder where you want to install java

$ cd /opt

$ wget http://download.oracle.com/otn-pub/java/jdk/6u37-b06/jdk-6u37-linux-x64-rpm.bin

$ chmod +x jdk-6u37-linux-x64-rpm.bin

$ ./jdk-6u37-linux-x64-rpm.bin
Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to check, remove JRE, JDK, OPENJDK installation?

To check the current installation of java

$ rpm -qa | grep jre

$ rpm -qa | grep jdk

$ rpm -qa | grep openjdk

To remove the java installs

$ yum erase jre jdk openjdk

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to install and setup Fail2ban on CentOS?

Fail2ban is a software used to ban IP’s which shows strange behavior. It can be configured to reject IP’s for a certain amount of time.

To install Fail2ban we need to download the application from the source. Login as the root user and go to /opt

$ cd /opt

$ wget http://downloads.sourceforge.net/project/fail2ban/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2?use_mirror=transact

Next unzip the downloaded file

$ tar -xf fail2ban-0.8.4.tar.bz2

$ cd fail2ban-0.8.4
Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Java Tomcat – SEVERE: Catalina.stop: java.net.ConnectException: Connection refused

This error pops up when you try to stop the Tomcat server when the server has not started. If you restart the Tomcat server, the error vanishes.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Java: non-static method cannot be referenced from a static context

Main is a static code block and to call a method within the same class you need to declare the other method also as static if you would want to execute the method during run time without instantiating it as an object.

Static methods are class methods and the methods without static keyword in them are instance methods.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Java: Buffered Reader Vs. Scanner

Buffered Reader
– Buffered reader reads text from a character input stream and buffers those characters
– Buffered reader has a buffer size of 8 KB
– Buffered reader is synchronized and can be safely called from multiple threads
– To parse for primitive data types additional functions needs to be called

Scanner
– Scanner breaks down input into tokens and translates individual tokens according to their data type
– Scanner has a buffer size of 1KB
– Scanner is not synchronized
– Scanner can parse for primitive types and strings using regular expressions

Source:
http://docs.oracle.com/javase/6/docs/api/java/io/BufferedReader.html
http://docs.oracle.com/javase/tutorial/essential/io/scanning.html

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

XML (Extensible Markup Language) Vs. CSV (Comma Separated Values)

CSV is flat file with the data separated by commas. If we needn’t have to establish a relationship in the data presented in the CSV file, then we can go with storing the data as CSV and manipulate the content for display in the web pages.

XML allows hierarchical representation of data. Data in XML is more readable when it comes to presenting the data. Data can easily be validated with XSD and can be accessed with a couple of lines of code. Huge advantage of XML is its flexibility to establish relationship in data.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to setup Rails on WAMP server using HTTP Proxy module?

To setup Rails on windows after Ruby and Rails setup,

i) Edit hosts file in windows environment and set the server name in the hosts file to

127.0.0.1 myrails

In this example, i have used “myrails” as the server name for the project.

ii) Edit httpd configuration setting on WAMP to make sure proxy and proxy_http module is turned on (check if it those lines are not commented out)

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to install Ruby, Rails and MySQL on Ubuntu Server?

For this tutorial we will be using Ruby 1.9.3 and Rails 3.2.1

First thing update
$ sudo apt-get update

Next, we are going to install git, RVM which is essential for the build

$sudo apt-get install build-essential git-core curl

RVM stands for Ruby Version Manager that is used for installing and managing multiple versions of Ruby at one point of time.
Continue Reading…

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Kurinchi Calendar
June 2017
M T W T F S S
« Apr    
 1234
567891011
12131415161718
19202122232425
2627282930