Wednesday, August 26, 2009

JAVA Prelude

JAVA
At the beginning Java was designed to control electronic devices remotely, then it has been taken again to make it good programming language for the network. It is interpreted and compiled at the same time. It can be used both for applet (small Java applications embedded in html documents) development or general application development.
Java code is designed for a virtual machine ( a machine that doesn' t exist ) based in the POSIX specification, although some Java processors are being designed that will able to run Java code directly.



The advantage of using a virtual machine is that you can design it as simple as you want. Then implementing interpreters for several machines you can run the same code over different platforms , one of the best things of this language.
Java code (bytecodes) are really small, ideal for transmission over the network.



The System class embeds some of the virtual machine specifications, while Runtime class has the specific-platform behavior.






Applet design is only one of the possible applications of Java.
Java applets are, basically, Java programs embedded in a Internet browser page.
The program can be as complicated as you want, but there are some security restrictions, for example it is impossible to write to the local drive, or get the user name of the system (thing that you can do in a local, not applet, Java application ).

JavaScript vs Java.
JavaScript can be used to add simple programs and functions to HTML pages. It's not compiled, so the performance is not very high.
Another difference is that JavaScript has to be embedded with the html page, the code has to be inside the same file, Java applets are in different .class files.
JavaScript has a limited amount of API functions, too far in complexity and extension from the Java API.
How to begin to work with Java.
First you need two things :
-The Java development kit for your platform, provided by JavaSoft.
-Some kind of graphical environment to work with, like JPAD or Kawa.
( JDK is only a command oriented, and really difficult to work with in a medium o large size project. )
Then you should read the documentation about the Java language and the Java API, in order to begin to write Java code.

No comments:

Post a Comment