Install Eclipse for C/C++ Windows Edition

We have a C++ project based on Linux system, so we need a good Editor but not Visual Studio since the C++ is for Linux.

And, we do not want to use Ubuntu but just use Windows 7. So we decide to download Eclipse for C/C++ Windows Edition from Eclipse official site. (Note: our Windows 7 is 64-bit so we chose Eclipse 64-bit edition)

Please know also “[Canada] University of Waterloo Computer Science Club (http)” is the server for downloading Eclipse.

After you download, unzip it and double click eclipse.exe to run, but you might see the following error message:

eclipse4c00

Then just like install Eclipse for Java, we have to install Java runtime environment or JDK. Just check our posts for Eclipse for Java installation.

OK, we install JRE.

eclipse4c01

After JRE installation, we then can continue to install Eclipse for C/C++:

eclipse4c02

Specify a work folder:

eclipse4c03

After some while for installation process, the Eclipse install successfully.

eclipse4c04

Java 7 Released!

Oracle release Java 7 Standard Edition in 2011 July 28! This is a big news for programmers.

“We are excited to announce Java 7 is released!

With years of hard work from our dedicated engineers, the largest team ever to work on the Java language and platform, as well as valuable input from the Java community, we are moving Java forward with this release.

This release contains new language features (JSR 334), support for dynamic languages (JSR 292), a new multicore-ready API (JSR 166), new I/O APIs (JSR 203), and many other new features.”

java7logo

(from Oracle official site)

Java 7 SE downloading link: Java 7 downloads

The Java 6 was released in 2006 Dec 11, there have been almost 5 years passed. The time is long, but the next version Java 8 expected to be released on late of 2012.

Java programmers must check the important technology changes in Java 7:

Highlights of Technology Changes in Java SE 7

Swing
IO and New IO
Networking
Security
Concurrency Utilities
Rich Internet Applications (RIA)/Deployment
Requesting and Customizing Applet Decoration in Dragg able Applets
Embedding JNLP File in Applet Tag
Deploying without Codebase
Handling Applet Initialization Status with Event Handlers
Java 2D
Java XML – JAXP, JAXB, and JAX-WS
Internationalization
java.lang Package
Multithreaded Custom Class Loaders in Java SE 7
Java Programming Language
Binary Literals
Strings in switch Statements
The try-with-resources Statement
Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking
Underscores in Numeric Literals
Type Inference for Generic Instance Creation
Improved Compiler Warnings and Errors When Using Non-Reifiable Formal Parameters with Varargs Methods
Java Virtual Machine (JVM)
Java Virtual Machine Support for Non-Java Languages
Garbage-First Collector
Java HotSpot Virtual Machine Performance Enhancements
JDBC

All features please visit Oracle official site.

Beginning Java 03 – Install Eclipse IDE 2

OK, let us continue to install Java Runtime Environment:

After you downloaded the Java file, our file name is “jre-6u25-windows-x64.exe” (IF you downloaded a 32-bit Java program, you should have different name, for example, “chromeinstall-6u25.exe” if you used Chrome browser)

Double click the “jre-6u25-windows-x64.exe” file to start the installation of Java:

eclipse08

Click “Install” button:

eclipse09

OK, just wait a few minutes, when you see the following screen then your JRE installation should be done.

eclipse10

After you done the JRE installation, you still can not run the Eclipse installation because your Windows 7 can not give a PATH to let Eclipse installation program to know where your JRE location is now.

OK, firstly we need to know where our JRE is:

For 64-bit:

eclipse11_1

For 32-bit:

eclipse11

We can see the Javaw.exe file which was requested is located in “C:\Program Files\Java\jre6\bin” (64-bit) or “C:\Program Files (x86)\Java\jre6\bin” (32-bit).

Now we should tell the proper Java path to Eclipse:

Go to your Eclipse folder and open the file eclipse.ini using a text editor.

In our Windows 7, we used Notepad to open eclipse.ini, by default, all content in this .ini file looks like they are in one line, but actually they are not, there is line break character which the Notepad program can not recognize them correctly.

In eslipse.ini file, default content is the following:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m

Locate the line of “-vmargs”, just above this line, add the following content (Note, you should add the correct folder which in your computer):

-vm
C:\Program File\Java\jre6\bin\server\jvm.dll

The following is all content after you added your setting, just for you copy conveniently.

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jre6\bin\server\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m

Save the eclipse.ini file, and double click esclipse.exe now.

Bingo! We see the running screen:

eclipse14

If you can not see but maybe similar with below shown, you must input something wrong in eclipse.ini file, for the following screen shot showing, it must input a folder which include 32-bit JRE but not 64-bit JRE.

eclipse12

Anyway, if you can see the correct Eclipse start screen, then we can follow the wizard, leave the default setting or you input your folder:

eclipse15

After you specified the Workspace folder, Eclipse will continue to loading something for we using Eclipse:

eclipse16

Soon, you will see the Eclipse IDE face !

eclipse17

OK, Eclipse IDE for Java Developer Windows 64-bit installation done !

Beginning Java 02 – Install Eclipse IDE 1

This time we will try to install a Java IDE tool. For a Java beginner who never used Java development tools, to install a Java development environment is not that easy which you think.

But before we write any code, we need a tool to write the code, Simply, you can use anyone text editor to write a Java program, for example, you can use Notepad in Windows to write Java.

However, there are lots of professional IDE software which is free to use. The most popular IDE tool is Eclipse:
Eclipse is an open source community, whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

(Why named Eclipse? An eclipse is in which the Moon passes through the shadow cast by Earth ? We don’t know now, maybe there was some reason, but we don’t want to spend more time to research where the name came from currently.)

You can download Eclipse IDE from their download page, However, if you are a Java beginner, you might be confused by their downloading list. see below screen shot from their site:

eclipse00

You can see there are at least 3 options you can choose for Java: Eclipse IDE for Java Developers; Eclipse IDE for Java EE Developers and Eclipse Classic. So what the difference are between them?

Eclipse group provides a compare page here:

eclipse01

Normally, for a Java beginner, you better choose Eclipse IDE for Java Developers or Eclipse Classic.

OK, after you downloaded a package, please unzip it, move the package to C:\eclipse folder is recommended by lots of developers.

By the way for our case, we downloaded the Eclipse IDE for Java Developers Windows 64 bits package.

Installation steps:

double click eclipse.exe file, we start to the installation:

eclipse02

Strange we see Eclipse is still a “Unknown Publisher”. But this is not important.

Just click the Run button, maybe you will see the following error message:

A Java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
C:\eclipse\jre\bin\javaw.exe
javaw.exe in your curent PATH

eclipse03

We really can not find C:\eclipse\jre folder. So let us go back to Eclipse’s download page to try find more information, At once we noticed there is a tips information on the right side of their page:

eclipse04

Then we come to the Java Runtime Environment web page. We read the following content:

The Eclipse IDE requires that a Java Runtime Environment (JRE) be installed on your machine to run. Java SE 5 or greater is recommended.

There are many different implementations of the Java Platform running atop a variety of operating systems. We focus Eclipse IDE testing on a handful of popular combinations of operating system and Java Platform; these are our reference platforms. Eclipse undoubtedly runs fine in many operating environments beyond the reference platforms we test. However, since we do not systematically test them we cannot vouch for them.

The Eclipse IDE is tested and validated on the following reference platforms:

eclipse05

We are using Windows 7 64-bit Operating System, so we choose the first line shown on above: the JRE from Sun’s Java 5 Update 22 or from IBM’s Java SR11.

Let us go to find Sun’s JRE now. The thing you have to know is that Oracle Corporation had acquired Sun Microsystems in 2009–2010, so we find the download  information on Oracle’s website:

eclipse06

When we click “Java Runtime Environment (JRE)”, we will be navigated to Java.com page

eclipse07 

Note:
If you click the “Free Java Download” button shown in above image , you will get a 32-bit JRE what ever your Windows 7 is 64-bit or 32-bit. But, since we are using Eclipse IDE for 64-bit Operating System, We should download a 64-bit JRE:

DO NOT click “Free Java Download” button, but look at left side on the same screen, click “All Java Downloads” link:

eclipse07_1

( Of course if you are using 32-bit OS, just click the “Free Java Download” button to continue. )

Now we will see a download page for All Java Downloads:

eclipse07_2

For our case, we downloaded “Windows 7, XP Offline (64-bit)”.

Let us stop here for this article. We will continue to discuss the left steps in our next article. Welcome back soon!

Hello World Example in Different Languages

If you are learning C, C++ or even Java, the first code example might be similar, they are all a example named Hello World.

We found a interesting article which collects all Hello World example in different languages.

For example:

In C:

#include <stdio.h>
 
int main(void)
{
  printf("Hello world\n");
  return 0;
}

In C++:

#include <iostream>
 
int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}

In Java:

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello world!");
   }
}

Please read more in all other languages from Wikipedia

Beginning Java 01

Who made Java ?

James Gosling, Mike Sheridan and Patrick Naughton started to create the Java language project in June 1991.

Why created Java language project ?

Java was originally designed for interactive television, but seems it is “Over Qualified”, it is too advance for television industry at the time. Gosling aimed to implement a virtual machine and a language that had a familiar C/C++ style of notation.

Why named Java ?

Java was not called Java originally, it was Oak since there was an Oak tree was outside of James Gosling’ office. Later Oak changed to Green, finally named to Java from a list of random words. So we know the name Java was just from a choose randomly.

When the first Java version released ?

Sun Microsystems released the first public implementation as Java 1.0 in 1995. James Gosling was working for them at that time.

What is J2EE, J2ME, J2SE, Java EE, Java ME, Java SE ?

Simply, J2EE targeted enterprise applications, J2ME is for mobile applications (Mobile Java). J2SE designated the Standard Edition. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

Java Icon ?

322px-java-logo.svg-1         java_logo

Java supports C++ style pointers?

Like C# (Actually C# learn from Java, but Java originally learn lots of stuff from C++), Java does not support C/C++ style pointer arithmetic.

Default file extension name?

A suffix .java

“main” is NOT a keyword in Java.

The method name "main" is not a keyword in the Java language (Actually in C#, “main” is not a keyword either, but normally in C# we use Main (capital) for a method name). Java classes that run in managed environments such as applets and Enterprise JavaBean do not use or need a main() method. A java program may contain multiple classes that have main methods, which means that the VM needs to be explicitly told which class to launch from.

What is JRE?

JRE is Java Runtime Environment. End-users use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a Web browser for Java applets.

What is JDK?

JDK is Java Development Kit. Sun distributes a superset of the JRE called JDK, which includes development tools such as the Java compiler, Javadoc, Jar, and debugger.

Java Target platforms.

Sun defined four editions of Java targeting platforms:

Java Card —  which is for smartcards.
Java ME — Java Platform, Micro Edition,  targeting environments with limited resources.
Java SE — Java Platform, Standard Edition, targeting workstation environments.
Java EE — Java Platform, Enterprise Edition, targeting large distributed enterprise or Internet environments.