.::Introducing Java in 10 minutes::. by: +-----------------------------+ | Md. Tanvir Al Amin | | Student, Department of CSE | | BUET, Dhaka | | tanviralamin@gmail.com | | http://popel.vze.com | +-----------------------------+ What is Java : -------------- Java is a programming Lanugage. Who made it : ------------- Java is Made by Java Developer Team of Sun Microsystems. it is yet in development process, though some sort of stability has been reached. Why this name "Java" : ---------------------- Java << Oak << Star7 Long Long story..... What is Java's type : ---------------------- Java is Object Oriented Language. It Inherits properties mainly from C++ and SmallTalk. Object Oriented design is more precise in Java than C++. What version of Java : ---------------------- First Java Release was 1.0... After that version 1.1 came adding and subtracting functionalities. The Language adapted next major changes from 1.2---from that release the language is known as "Java 2" Java has many "Editions" also targeting different platforms of activation. "Java 2 Standard Edition" , "Java 2 Enterprise Edition" , "Java 2 Micro Edition" etc. Now we will use "Java 2 Standard Edition". Current version is 1.5 i.e Java 2 version 1.5. Before that Java 2 versions were 1.2 , 1.3 , 1.4 Why do we use Java when there is C++ : --------------------------------------- From the view of flexibility C++ is the best Language. It is suitable for any type of Programming. Fast comiled codes are produced for specific platforms, specific Operating Systems. But all of them are non-portable to different platforms. that means if you write a program for Windows XP and compile it on a machine using Windows XP, an executable file will be produced. But what if you take it to a linux machine ? or a Apple Macintosh ? It will simply not run (unless you use an emulator...but thats different situation) now, you ask questions, why do I compile programs for one platform and try to execute it on a different environment ? yeah, when you buy softwares you will buy platform specific versions. i.e when buying a game you will buy the linux version if you use linux, or buy Mac version if you use MacOS. But a great deal of software is suitable to make platform independent. Because they may be dirstributed over a network. For some software it would be really good, if we could compile it for any "generalized" computer.... i.e compile once....run anywhere....windows, linux, mac, unix, reactOS, BeOS, BSD, Fedora or anything else.... thats the buzz of Java. yes, Java is platform independent. It is the language for the Internet. Java programs run on a "Virtual Machine" --- that is a "same machine" concept for any platform. "Java Virtual Machine" is a software, to run any Java program on a system you need this software installed. This software does the translation between Java's own code and platform specific native codes. Technically this software is called "Java Runtime Environment" or jre. Java programs are not compiled to native codes. They are compiled to bytecodes in .CLASS files which is some sort of intermediate codes and then Interpreted by jre system when you run it. As they are interpreted, a program can have distributed nature... A program can be half downloaded from a server and start working before it is completely downloaded. Several Java based technology and program structure has been developed.... find them in Books. In web pages we use Java Applets which are small java programs maintained by the Browser and Server. Java Applet Virutal Machine is integrated into the browser. How to install Java : ----------------- To run any program of Java one should have the "Java Runtime Environment" (previously called "Java Virtual Machine") or jre software installed. Java programs need run time support from this software.But we will develop programs in java. So we need to install "jdk" (jdk = java development kit) as well as jre. >> Install jdk by downloading it from java.sun.com or from a cd. Try to get jdk 1.4 or later. >> it will install the virutal machine i.e jre also automatically. How to write Programs: ---------------------- The primitive method is: >> Use notepad or a text editor to write the source code/ >> save it >> use "javac" command in command prompt to compile it >> and use "java" command to run But now a days several IDE softwares (IDE = Integrated Development Environment) are present to offer you a visual essense of java programming, pop up menus of available classes and methods and facility of easy debugging. If you use these softwares to develop java programs you don't need to worry about the long lines like "java myclass.java" or "java -classpath c:\javaclasses myclass". IDE's will automatically do that for you. Suggested IDE's are: 1) JCreator -- Visual C++ like environment, easy to use, but you need a crack file 2) JBuilder version 9 or 10 -- Very friendly, but slow also. You need a high speed processor like atleast Pentium 3 or Athlon XP and 256 MB RAM to have good performance. And it will take much disk space to be installed. How a Java Program works : ------------------------- Maximum work in Java is done with the help of Java API. (API = Application Programming Interface) Java Programs rely on JRE (Java Runtime Environment). This software gives constant support when a Java program runs. [User] <---> [Java Program] <----> [Java Runtime Environment] [Java Runtime Environment] <---> [Operating System] <---> [Hardware] Memory management and freeing of allocated memory is automatic. This is the work of the Runtime Environment not your program. What can one do with Java: -------------------------- One can make both console application and GUI application (GUI = Graphical Use Interface) with java. Java supports many features through its API collection of classes. You can make multi threading softwares to use the full power of the processor and operating system. And java programs can be distributed in nature. Part of a program can run on a server and part on a remote machine. This type of common application we find in Java Applets. We see and Use Java Applets in many web sites witout proper knowledge. As java is platform independent no problem what the client machine is or the server machine is. Only important is the common interface posed by "Java Runtime Environment" General question about "Security" now arises -- how can one trust a software from a remote server -- the answer is given by the jre. jre will ensure your security -- it will not let java programs to do harm to your pc -- access files in an unauthorized way or get handle to the system. So theoretically it is not possible to write a virus in java or write an operating system. Highly distributed and Enterprise application can be developed with the Enterprise Edition. One can write softwares for new generation mobile phones, refrigerators, PDA, Pocket PC -- the requirement is that -- the targeted platform should have a Runtime Environment of "Java 2 Micro Edition". And Java is more Object Oriented that C++. So a broad range of Design can be be implemented with java easily. any questions or feedback ? feel free to ask.