Getting Started

Greetings.

In order to compile and run programs, one will have to have a programming environment in which the programs can be developed and executed. This much you might have guessed. However, the task at hand is to install such a environment on your terminal(the environment does not come to your terminal by itself.....I learned the hard way). Many tutorials exist on line that provide excellent tutorials on programming; many of them just breeze through the topic of setting up your environment. I am going to tell you how to do just that, for c++(.NET 4.0) and Java JDK 1.6+.

**********
***C++***
**********
I have found Visual Studio by Microsoft, by far, the best programming environment on Windows to develop and compile C++ programs. The Express Edition of Visual Studio can be found here. The installation is pretty straight forward. However one must register their Visual Studio 2010 Express Edition within a month of installing, thereby getting a key, which then allows the IDE(Integrated Development Environment) to be used for unlimited time. The link for getting the express key can be found here. To get started, start the IDE(duh!), go to
FILE->NEW->PROJECT and choose General from the installed templates menu and choose Empty Project from the Project Type Menu. Once done, get creative and enter your code, and compile and execute the program by hitting the F5 key. If everything goes well, a command prompt window should pop up(or a Windows GUI Application Window, if you used WINAPI), signaling the successful compile(ation?) of your program. Want to show off your program to your friends? Get the .exe file of the program by navigating to the Debug folder like this:
My Documents(Default)-> Visual Studio 2010-> projects->  PROJECT_NAME-> Debug -> .EXE!
Most people do not advocate the use of an IDE when in the beginning stages of programming, but Visual C++ 2010does not actually type out code for you(unlike Netbeans...more on this later). Instead, it color codes your variables, data types, functions and libraries, making your code much more cleaner and manageable.

For people using Linux, the G++ compiler will have to be installed. To get it, open up a terminal and paste this in:
sudo aptidute install g++
After which you will have the G++ compiler on your computer. To compile and run a C++ program, simply navigate to the folder where the .cpp file resides in you terminal and type
g++ FILE_NAME.cpp
And your program will successfully compile and execute!

*********
**JAVA**
*********

The best way to compile and run java programs on Windows is to get the Java Standard Edition JDK+JRE(Already present in Windows) from Sun's, cross that, ORACLE's website here ;) Download and install the latest JDK version(1.6 u22 at the time of writing), which is a fairly straight forward process. Now comes the challenging part. Navigate to-
Start->right click Computer->properties->Advanced System Settings(Omit for XP)->Advanced Tab->Environment Variables
Now in the User Variables section, click new and name this variable CLASSPATH in the variable name field. Paste the path for the lib folder in the JRE folder in your Java install directory in the variable value field. For me it is: C:\Program Files (x86)\Java\jdk1.6.0_20\jre\lib. Add a semicolon(;) after and before(if it does not exist) you paste the path, so that in the future other applications can add more links without conflicting with the path you just added. Should it already exist, just click edit to make sure this path is present in the variable value field. If not present, add the path. Now in the System Variables Section  click new and this time name the variable path. Set its value to the lib folder of your JDK. For me it is: C:\PROGRAM FILES (X86)\JAVA\JDK1.6.0_20\BIN. Add a semicolon, and click OK. Keep on clicking OK until there aren't anymore. Now to test if your environment is correctly set up, open up command prompt, navigate to the folder where you have the .java files. and type in
javac FILE_NAME.java
It everything works and no errors are found, a .class file will have been generated in your java projects directory. Now type:
java FILE_NAME
without any extension. IF the program executes properly, the output will show up. If the java command is not found or does not work, type:
set CLASSPATH =
and press enter, and then type
java FILE_NAME
If the system still cannot find the java command, the  you will have to go through the steps mentioned above again and again until you get you Environment working right.

If this seems like a great deal of work, use Netbeans! Download and install it. Choose the one with the Latest JDK and JRE, if you do not have them. Otherwise, just download the standalone Netbeans installer. After installation, run Netbeans. Now Go to
file -> new Project and under categories choose Java and under projects, choose Java application. Type in your code, and compile and run it by hitting the F6 button. You can get a .jar file that you can run anywhere(WORA FTW!)by hitting Shift + F11, and navigating to the dist folder of your project as shown below:
Documents -> NetBeansProjects -> PROJECT_NAME -> dist, where you will find the .jar file.

For Linux download and install the GCJ compiler for java by typing the following into a terminal:
sudo install gcj
To compile and execute java programs, navigate to the folder where your java files exist and type
gcj FILE_NAME.java
after which you should see your program execute.

I shall be covering Java installation on Mac on a  later date.

Happy Coding

Aravind Rao