Java: Introduction and Overview
Java: Introduction and Overview
Java: Introduction
and Overview
Java is Web-Enabled?
Java is Web-Enabled?
Java is Safe?
Java is Safe?
• Myth: Applets cannot harm your computer
– Denial of service
– Browser misconfiguration
– Implementation bugs
• Myth: Java is too restricted to be useful
– Restrictions apply only to applets, not regular Java
programs
– Digital signatures support relaxed restrictions
• Myth: Applets with digital signatures are no
more or less safe than ActiveX
– Relaxed security in applets not “all or nothing” as in
ActiveX
Java EE training: http://courses.coreservlets.com
Java is Cross-Platform?
• Truth: Java programs can compile to
machine-independent bytecode
Java Java Bytecode
Source Code
JIT Compiler
Compiler or Interpreter
(javac)
Java Bytecode Execution
Java is Cross-Platform?
• Myth: Write Once Run Anywhere
– Cross-platform code can be achieved, but you must test
on all platforms you will deliver on.
• Java apps can execute local code
• The graphics library behaves
slightly differently on different platforms
• The behavior of the thread scheduler
is only loosely defined
• Myth: Java will kill Microsoft
– There is also no longer immediate
danger of the reverse (Microsoft killing Java)
– Microsoft wavered between trying to fight Java and
joining it and making money by dominating the market.
With .NET, they are back to fighting it again.
Java EE training: http://courses.coreservlets.com
Java is Simple?
• Truth: Java greatly simplifies several
language features
– Java has automatic memory management
• Does Windows and takes out the garbage
• No dangling pointers. No memory leaks.
– Java simplifies pointer handling
• No explicit reference/dereference operations
– No makefiles for simple applications
– No header files
– C++ syntax streamlined
– C# is comparable to Java, at least as far as the core
language goes.
• For a comparison of Java and C# syntax/constructs, see
http://www.harding.edu/fmccown/java1_5_csharp_comparison.html
Java EE training: http://courses.coreservlets.com
Star Office
MS Office Competitor Written in Java
Getting Started
Eclipse: Overview
• Overview
– Eclipse is a a free open source IDE for Java. Support for
Java, HTML, CSS, JavaScript, C++, PHP, and more.
• Download from http://eclipse.org/
• Choose Java EE version
– As of July 2008, called "Eclipse Ganymede"
• Features
– Checks your syntax as you type
– Automatically compiles every time you save file
– Many tools: refactoring, visual GUI builders, debuggers,
templates for common tasks, etc.
• Low learning curve: beginners can use Eclipse without
knowing these tools
Java EE training: http://courses.coreservlets.com
Eclipse: Running Programs
• Executing program from existing project
– Open existing
project
– Double click
Java file to
bring it up in editor
– R-click anywhere
in code
– Select Run As Æ
Java Application
– Output goes in
Console at bottom
• Note: Class must
have a "main" method Java EE training: http://courses.coreservlets.com
• Note that the command is java, not javac, and that you
refer to Test, not Test.class
– To run applets
• Load the HTML page that refers to it
• File HelloWorld.java:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world.");
}
}
Java EE training: http://courses.coreservlets.com
Basic Hello World Application
(Continued)
• Compiling:
javac HelloWorld.java
• Running:
java HelloWorld
• Output:
Hello, world.
<BODY>
<H1>HelloWWW: Simple Applet Test.</H1>
</BODY>
</HTML>
Java EE training: http://courses.coreservlets.com
Questions?
Customized Java EE Training: http://courses.coreservlets.com/
Servlets, JSP, Struts, JSF/MyFaces/Facelets, Ajax, GWT, Java 5 or 6, etc. Spring/Hibernate coming soon.
Developed and taught by well-known author and developer. At public venues or onsite at your location.