Preview

operating system

Powerful Essays
Open Document
Open Document
1156 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
operating system
CS 2203: Operating Systems
Centre for Advance Studies in Engineering (CASE)
Hand-out 8: Lab 08 Instructions

March 2014
Computer Science Department
Instructor: Shehreyar Rashid

Lab 8: Introduction to Java and Sockets
Objectives




Write, compile, and execute Java programs in Linux using command line.
Use an IDE to write, compile, and execute Java programs in Linux.
Learn to write client-server application using Sockets.

Credits: This lab uses material from Silberschatz, Galvin, Gagne Operating System Concepts,
8th Edition (2011, Wiley).

Java Program Using Command Line
In this section, we learn to write, compile, and execute a Java program in Ubuntu (Linux). We have download JDK and Netbeans in to lab computers. The lab instructor will help you to know the locations for the JDK, and Netbeans IDE to download and work.
1.
2.
3.
4.

Open a terminal and go to the directory containing JDK. tar xvzf (decompress the file into a folder). mv jdk1.7.0 13 ~/jdk1.7 (move the folder into your home directory). gedit ~/.bashrc (bashrc file contains verious commands and environment variables for the shell). 5. Type in the following command at the end of the file: export JAVA_HOME=~/jdk1.7/bin/java export PATH=$PATH:~/jdk1.7/bin
6. Save and exit from gedit.
7. source ~/.bashrc (make sure the newly declared environment variables are available for the current terminal).
8. Now create a File named \Hello.java" and type in the following code: public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
9. Save and exit from gedit.
10. javac Hello.java (compile a java source code into a byte code).
11. java Hello (execute a java program).
12. Task! Now modify your program and print “Hello World!” 10 times using a for loop.
13. Task! Now create another java program which prints n!.

CS 2203: Operating Systems
Centre for Advance Studies in Engineering (CASE)
Hand-out 8: Lab 08

You May Also Find These Documents Helpful

  • Satisfactory Essays

    linux

    • 456 Words
    • 2 Pages

    1. What change is necessary to make sendmail listen to all network traffic on port 25? What file would you edit?…

    • 456 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    operating system

    • 464 Words
    • 2 Pages

    1. What is the application Zenmap GUI typically used for? Describe a scenario in which you would use this type of application.…

    • 464 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Prg420 Syllabus

    • 1691 Words
    • 7 Pages

    Horton, I. (2005). Ivor Horton’s Beginning Java 2, JDK (5th ed.). Indianapolis, IN: Wiley Publishing.…

    • 1691 Words
    • 7 Pages
    Satisfactory Essays
  • Good Essays

    Operating System

    • 1099 Words
    • 5 Pages

    Answer: d. It redirects the output of one command to the input of another command.…

    • 1099 Words
    • 5 Pages
    Good Essays
  • Satisfactory Essays

    References: Deitel, H.M., & Deitel, P.J. (2002). Java: How to program (6th ed.). Upper Saddle River, NJ: Pearson Education.…

    • 253 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    operating system

    • 778 Words
    • 5 Pages

    Sol: To know how many processes are created we modified the program using getpid() and printf(). Please find the modified program below…

    • 778 Words
    • 5 Pages
    Satisfactory Essays
  • Better Essays

    Windows NT is a unique and powerful operating system. It has been an entirely different operating system than Microsoft's initial Windows desktops operating systems. It was simply better and more secure ("Survey of operating Systems" pg125.) Windows NT offers you a high degree of performance and a wealth of capabilities and features. ("Windows NT 101", 1998.) NT supports two file systems: NtFS4 and FAT16. It can use up to 4 Gigabytes of RAM and also uses virtual memory. Windows NT doesn't work well with legacy applications it can work with some applications, they need to be tested to see if it will run (Survey of Operating Systems" pg130.) This operating system was designed to run on multiple instruction set architectures and multiple hardware platforms within each architecture. The platform dependencies are largely hidden from the rest of the system by a kernel mode module called the HAL. Windows NT's kernel mode code further distinguishes between the "kernel," whose prime purpose is to implement processor-architecture-dependent functions, and the "executive."…

    • 1312 Words
    • 4 Pages
    Better Essays
  • Good Essays

    Jlex

    • 1777 Words
    • 8 Pages

    JLex is a scanner generator that produces Java code. Here's a picture illustrating how to create and run a program using JLex:…

    • 1777 Words
    • 8 Pages
    Good Essays
  • Satisfactory Essays

    OCJA exam prep

    • 5816 Words
    • 24 Pages

    2. Which statement represents a valid statement that will allow for the inclusion of classes from the java.util package?…

    • 5816 Words
    • 24 Pages
    Satisfactory Essays
  • Powerful Essays

    Except for those constraints imposed by the Internet environment, Java gives the programmer, full control.…

    • 7148 Words
    • 27 Pages
    Powerful Essays
  • Better Essays

    Java is simple such as it does not have any pointers, it has automatic memory allocation and garbage collector, and it has multiple inheritance with interfaces. Java is a platform-independent. Every Java source code is compiled to Java bytecode, which can be executed on any platform that has its own JVM without compilation.…

    • 2088 Words
    • 9 Pages
    Better Essays
  • Satisfactory Essays

    Operating Systems

    • 1251 Words
    • 6 Pages

    4.1 Provide two programming examples in which multithreading does not provide better performance than a single-threaded solution…

    • 1251 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    operating system

    • 464 Words
    • 2 Pages

    1. AIM: To write a C program to simulate the shortest job first algorithm with preemption.…

    • 464 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    operating system

    • 364 Words
    • 2 Pages

    Modern OS are interrupt driven. Events are almost signaled by the occurrence of an interrupt or a trap, which caused either by an error or by a specific request from a user program that an OS service be performed .Dual-mode Operation allows OS to protect itself and other system components whereas Multimode Operation increasingly CPUs support multi-mode operations.…

    • 364 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Modern Operating System

    • 3667 Words
    • 15 Pages

    1. The operating system is the most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing inputfrom the keyboard, sending output to the display screen, keeping track of filesand directories on the disk, and controlling peripheral devices such as disk drives and printers.…

    • 3667 Words
    • 15 Pages
    Powerful Essays