Presentation is loading. Please wait.

Presentation is loading. Please wait.

CISC124 From Thursday: Course Web Site:

Similar presentations


Presentation on theme: "CISC124 From Thursday: Course Web Site:"— Presentation transcript:

1 CISC124 From Thursday: Course Web Site:
Fall 2018 CISC124 2/1/2019 CISC124 From Thursday: Course Web Site: Lecture notes and other stuff will be, and is posted. Note Fall 2018 CISC124 - Prof. McLeod Prof. Alan McLeod

2 “To Do” List from Thursday
Review course web site. Check onQ login. Fill out lab section quiz in onQ. (106 done) Install Eclipse, if you want to use this IDE – see the Resources page. Start Exercise 1. This covers console I/O and will not be discussed in class. At a minimum – do Exercises 1 and 3 before starting assignment 1. Fall 2018 CISC124 - Prof. McLeod

3 Today “Hello World” Ritual! History of Java. How Java Works.
Start Class Structure. Emphasis on syntax for now. Fall 2018 CISC124 - Prof. McLeod

4 First Example – “Hello World” in Java
Let us have a quick look at Eclipse, create an empty project and add a program that displays “Hello World” to the console window. Tradition! Fall 2018 CISC124 - Prof. McLeod

5 First Java Program… What do you think?
How would you have done “Hello World” in Python? Is all this extra “stuff” necessary? Can any code be removed without breaking the program? Fall 2018 CISC124 - Prof. McLeod

6 A Very Brief History of Java
The language was first developed by James Gosling at Sun Microsystems in 1991. He was designing a language, called “Oak”, for the “Green Project”. The Green Project envisaged the centralized control of many processor-based devices in the home. “Oak” was designed to be a robust, efficient language with maximum portability to different processors. The Green Project flopped… Fall 2018 CISC124 - Prof. McLeod

7 Java History, Cont. What else happened in the early 90’s?
Internet use started to blossom in the early 90’s. Web pages had to do more than just display static text and graphics. Needed dynamic and interactive content. But, web pages are viewed on a wide variety of platforms, from Mac’s to Unix to IBM-PC’s. So any page-embedded language would need to run on all these platforms. Needed a robust, compact, multiplatform language, so let’s dust off Oak and call it something racy like “Java”! Fall 2018 CISC124 - Prof. McLeod

8 Java History, Cont. In 1994, Sun demonstrated the use of Java in small bundles of code embedded in a web page - called applets. Netscape browsers started supporting applets in 1995, starting Java’s rise to fame. Sun programmers continued to develop a code base for the language, adding many libraries. They showed that Java could be used for more than just applets, and that full-blown applications could be written in this high-level language. Fall 2018 CISC124 - Prof. McLeod

9 Slightly More Recent History
Early in 2010 Oracle acquired Sun Microsystems. Here’s a statement regarding Java from Oracle: “Oracle plans to accelerate investment in the Java platform for the benefit of customers and the Java community. Java is one of the computer industry’s best-known brands and the Java platform is one of the industry’s most widely deployed technologies. Oracle has been a leader in the Java community since the inception of the Java programming language and already has the world’s largest investment in the Java platform, which provides the foundation for its Oracle Fusion Middleware products and its next-generation enterprise applications. Oracle plans to not only broaden and accelerate its own investment in the Java platform, but also plans to increase the commitment to the community that helps make Java an ubiquitous, innovative platform unified around open standards.” Fall 2018 CISC124 - Prof. McLeod

10 Slightly More Recent History, Cont.
Oracle seems to be sticking with their promise as demonstrated with the releases of Java 7 & 8. Now, we are using Java 10. The second “incarnation” of JavaFX has also been released, replacing Swing. Now, Oracle is promising a new release of Java every 6 months. Fall 2018 CISC124 - Prof. McLeod

11 How Java Works The Java language standard (the syntax) is identical for all platforms. A compiler ( part of the “JDK”, or “Java Development Kit” – sometimes called javac.exe) which is designed to run on your development platform, compiles your source code (*.java file) to a byte code file (*.class file). The byte code file is platform-independent, and is the thing you would attach to your web page as an applet. Every browser written for every platform and OS, can have an embedded code processor called a JVM, or “Java Virtual Machine”, built-in. Fall 2018 CISC124 - Prof. McLeod

12 How Java Works, Cont. The JVM takes the byte code and executes it by generating the machine code that will be recognized by the platform that is running the browser. Local Client Remote File Server Browser HTML File Internet JVM Applet Applet Byte code files Fall 2018 CISC124 - Prof. McLeod

13 How Java Works, Cont. Of course it did not take long before people took the JVM out of the browser so that they could run stand-alone Java applications. This is the JRE or “Java Runtime Engine” (java.exe). The concept of write once, run anywhere is very appealing! “Save your $$!” And, Oracle distributes the JDK’s for free, making development on many platforms inexpensive. Java now has over 9 million application programmers worldwide. No other language has ever grown this quickly! Fall 2018 CISC124 - Prof. McLeod

14 How Java Works, Cont. So, Java can be used either to create applets for use in web pages or for stand-alone applications. Most “Integrated Development Environments” or IDEs will support the development of either kind of program. However applets have fallen out of favour in the last few years due to security concerns. Fall 2018 CISC124 - Prof. McLeod

15 Aside – Stand Alone Java Apps?
Pretty much every computer will have a version of the Java JRE installed for its web browser. Can you take advantage of that? Yes! One increasingly popular option is the use of executable JAR files. You can just double click on them and they run. Fall 2018 CISC124 - Prof. McLeod

16 How Java Works, Cont. All IDE’s, including Eclipse, must use the appropriate JDK in the background. Two components of the JDK are the programs “javac.exe” and “java.exe”. javac.exe is the byte code compiler, and java.exe is the JRE which executes the byte code file. “Compilation” is the process of converting the *.java file to a *.class file (the byte code file). This is done by calling javac.exe in the background, and supplying that program with all the required command line parameters. Fall 2018 CISC124 - Prof. McLeod

17 How Java Works, Cont. The java.exe program:
accepts the byte code file, links in any required libraries, creates executable code in memory converts it to machine language and sends it to the CPU. The java.exe program must know the right machine language commands for just the type of CPU it is designed for! Also called “Just in Time” compilation or “JIT”. Fall 2018 CISC124 - Prof. McLeod

18 Eclipse Source Text Editor text successful Bytecode binary Compiler
Executable not successful binary Linker Errors javac.exe Loader Library binary Output Data Input Data java.exe Fall 2018 CISC124 - Prof. McLeod

19 Questions: Suppose we have two kinds of errors:
Syntax errors Runtime errors What is the difference? Considering the two step process of running a Java program, at what stages will these errors be caught and who does the catching? Who does the fixing??? Fall 2018 CISC124 - Prof. McLeod


Download ppt "CISC124 From Thursday: Course Web Site:"

Similar presentations


Ads by Google