write and run a php file in Ubuntu Linux

to write a php file type following in Applications->Accessories->Terminal:
gedit first.php

then text editor opens type the following code:



save and  type  php first.php in terminal

then you will get output:

Hello World  $example

java program compile and run in Ubuntu Linux

Steps to run JAVA program in Ubuntu:
1. Go to Applications > Accessories > Terminal, to open terminal window.
2. Type the following in command line
gedit Welcome.java
3. Enter the code bellow in the editor.
 class Welcome
{
    public static void main (String []args)
    {
    System.out.println("Welcome to UBUNTU");
    }
}

4. Save the file and close to return to terminal window.
5. Firstly compile the code using the following command
javac Welcome.java
That would produce an class file you may need to run the program.
7. Now run this executable using the following command
java Welcome
8. Output should show as follows:
Welcome to UBUNTU

c c++ compile and run in Ubuntu Linux

If you are a developer you need C and C++ Compiler for your development work.In ubuntu you can install the build-essential for C and C++ compilers.

Install C and C++ Compilers in Ubuntu
sudo aptitude install build-essential
This will install all the required packages for C and C++ compilers
Testing C and C++ Programs
Compiling Your first C Programs
Now you need to open first.c file
sudo gedit first.c
add the following lines save and exit the file

Firstly compile the code using the following command
cc -c first.c
that would produce an object file you may need to add to the library.
then create an executable using the following command
cc -o first first.c
Now run this executable using the following command
./first
Output should show as follows
Hello, world

Compiling your first C++ program

If you want to run c++ program follow this procedure
g++ is the compiler that you must use.
you should use a .cpp file extension rather than a .c one
You need to create a file
sudo gedit first.cpp
add the following lines save and exit the file

Run your C++ Program using the following command
g++ first.cpp -o test
./test
Output should show as follows
Hello World!

Monday 26 September 2011

write and run a php file in Ubuntu Linux

to write a php file type following in Applications->Accessories->Terminal:
gedit first.php

then text editor opens type the following code:



save and  type  php first.php in terminal

then you will get output:

Hello World  $example

java program compile and run in Ubuntu Linux

Steps to run JAVA program in Ubuntu:
1. Go to Applications > Accessories > Terminal, to open terminal window.
2. Type the following in command line
gedit Welcome.java
3. Enter the code bellow in the editor.
 class Welcome
{
    public static void main (String []args)
    {
    System.out.println("Welcome to UBUNTU");
    }
}

4. Save the file and close to return to terminal window.
5. Firstly compile the code using the following command
javac Welcome.java
That would produce an class file you may need to run the program.
7. Now run this executable using the following command
java Welcome
8. Output should show as follows:
Welcome to UBUNTU

c c++ compile and run in Ubuntu Linux

If you are a developer you need C and C++ Compiler for your development work.In ubuntu you can install the build-essential for C and C++ compilers.

Install C and C++ Compilers in Ubuntu
sudo aptitude install build-essential
This will install all the required packages for C and C++ compilers
Testing C and C++ Programs
Compiling Your first C Programs
Now you need to open first.c file
sudo gedit first.c
add the following lines save and exit the file

Firstly compile the code using the following command
cc -c first.c
that would produce an object file you may need to add to the library.
then create an executable using the following command
cc -o first first.c
Now run this executable using the following command
./first
Output should show as follows
Hello, world

Compiling your first C++ program

If you want to run c++ program follow this procedure
g++ is the compiler that you must use.
you should use a .cpp file extension rather than a .c one
You need to create a file
sudo gedit first.cpp
add the following lines save and exit the file

Run your C++ Program using the following command
g++ first.cpp -o test
./test
Output should show as follows
Hello World!