Sunday, November 7, 2010

Installing JDK and JRE in UBUNTU Linux



You need to follow some simple steps for installing Sun Java Development Kit(JDK) & Java Runtime Environment(JRE) in Ubuntu Linux. They are:

Step 1: At the initial stage ,check whether the MULTIVERSE repository is enabled or not.
For this Click on 
System->Administration->Software Sources->Select Multiverse->Close.

Step 2: Open TERMINAL and type the following to install JDK and JRE :sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
Note: (1):
If you want to use red hat interface , press Ctrl+Alt+F1 and enter the user name and password. For returning to the previous interface , press Ctrl+Alt+F7.(2):You may need to update the runtime or development kit for the java language. For updation typesudo update-java-alternatives -s java-6-sun at the terminal.


Step 3: Set up the environment variable.
For this , do the following:
Type the following at the terminal:
vi $HOME/.bash_profile
Type the following in the opened text file:
export JAVA_home=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
Save and close the file. For this , press 
ESC and type :wq and press enter.
Warning: Linux is case-sensitive.So,take care of the case of the command entered.

Note: If you want to know the version of JRE installed , use the following command :
java -versionFOR COMPILING THE JAVA PROGRAM , GO TO THE SPECIFIED DIRECTORY AND TYPE
JAVAC FILENAME.JAVAFOR EXECUTING THE PROGRAM , TYPE
JAVA FILENAME

C Graphics Programming in UBUNTU


The solution for doing graphics programming in ubuntu is:
libgraph - library providing the TurboC graphics API ( graphics.h) in Linux using SDL.
For using this , you need to follow some simple steps as mentioned below:
First of all, you need to install the dependencies so that all the required compiler tools gets installed.For that you need to run the given command on the terminal:
sudo apt-get install build-essential
Next you need to install some packages. They are: libsdl-image1.2,libsdl-image1.2-dev,guile-1.8 and guile-1.8-dev. For that run the given command at the terminal:
sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev
Now, download and install libgraph-1.0.2.tar.gz from the link :
http://mirror.veriportal.com/savannah/libgraph/
Download this file in any folder and extract it in the home folder or on the desktop wherever you want.
Open the terminal and navigate to the folder where you have extracted libgraph-1.0.2 with the help of cd command. Install this using the commands given below:
./configure (Return)
sudo make (Return)
sudo make install (Return)
After this you can start your C graphics programming in linux. Now try writing a simple C graphics program by including the header file "graphics.h". You can do the programs as you in TURBO C.
For writing the programs you can use the "gedit" tool in ubuntu. For compiling the programs, navigate to the source program folder and use the following command:
gcc filename.c -lgraph
For executing the program, use the command ./a.out
The error “./a.out: error while loading shared libraries: libgraph.so.1: cannot open shared object file: No such file or directory” can be solved by
sudo cp /usr/local/lib/libgraph.* /usr/lib
If you still have any further doubts, then plz post here...hope i'll answer