Network programming in java - PPT with Easy Programs and examples of Java InetAddress Class and java socket programming example.
Learn more @ http://java2all.com/technology/network-programming
The presentation given at MSBTE sponsored content updating program on 'Advanced Java Programming' for Diploma Engineering teachers of Maharashtra. Venue: Guru Gobind Singh Polytechnic, Nashik
Date: 22/12/2010
Session: Java Network Programming
This document provides an overview of socket programming in Java. It defines a socket as an endpoint for two-way communication between programs over a network. The key classes for socket programming in Java are Socket for clients and ServerSocket for servers. It describes how to establish connections between clients and servers using these classes, set up input and output streams, and properly close connections. TCP sockets provide reliable, ordered connections while UDP sockets are unreliable and unordered. Exceptions that can occur during network programming are also listed.
Socket programming in Java allows applications to communicate over the internet. Sockets are endpoints for communication that are identified by an IP address and port number. A socket connection is established between a client and server socket. The server creates a welcoming socket to accept client connection requests, then a separate connection socket to communicate with that client. Data can be sent bidirectionally over the connected sockets as input/output streams. UDP uses datagram sockets without a connection, requiring the explicit destination address on each message.
The document provides an overview of networking basics in Java, including concepts like sockets, client-server communication, TCP and UDP protocols, HTTP protocol, domain name service (DNS), and classes used for networking in Java like InetAddress, Socket, ServerSocket, and URL. Key topics covered include how sockets work, the differences between TCP and UDP, how HTTP requests and responses are handled, and how DNS is used to map domain names to IP addresses. Example code is provided to demonstrate using InetAddress and Sockets in Java programs.
This document provides an overview of client-server networking concepts in Java. It discusses elements like network basics, ports and sockets. It explains how to implement both TCP and UDP clients and servers in Java using socket classes. Sample code is provided for an echo client-server application using TCP and a quote client-server application using UDP. Exception handling for sockets is also demonstrated.
This document discusses sockets programming in Java. It covers server sockets, which listen for incoming client connections, and client sockets, which connect to servers. It describes how to create server and client sockets in Java using the ServerSocket and Socket classes. Examples are provided of simple Java programs to implement a TCP/IP server and client using sockets.
This document provides information about networking basics including client-server computing, sockets, TCP, UDP, ports, proxies, and internet addressing. It discusses how client-server computing uses clients and servers, how sockets provide endpoints for communication, and how TCP and UDP are used for reliable and unreliable data transmission respectively. It also covers common port numbers, how proxies cache requests and act as intermediaries, and how internet addresses are represented in IPv4 and IPv6 formats. The document is intended as a teaching aid for a class on advanced Java programming and networking concepts.
When we desire a communication between two applications possibly running on different machines, we need sockets. This presentation aims to provide knowledge of basic socket programming to undergraduate students. Basically, this presentation gives the importance of socket in the area of networking and Unix Programming. The presentation of Topic (Sockets) has designed according to the Network Programming Subject, B.Tech, 6th Semester syllabus of Punjab Technical University Kapurthala, Punjab.
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
The document discusses threads and multithreading in Java. It defines a thread as a single sequential flow of control within a program. Multithreading allows a program to be divided into multiple subprograms that can run concurrently. Threads have various states like newborn, runnable, running, blocked, and dead. The key methods for managing threads include start(), sleep(), yield(), join(), wait(), notify(). Synchronization is needed when multiple threads access shared resources to prevent inconsistencies. Deadlocks can occur when threads wait indefinitely for each other.
Class <class name> contains a main method that declares instance variables and calls other methods without creating objects. The main method has a string array as a parameter and does not return a value. Import is used to include packages that contain classes needed for input/output and other operations.
This document discusses TCP/IP networking concepts in Java like sockets, datagrams, ports and protocols. It provides code examples for socket programming in Java using TCP for client-server applications and UDP for datagram transmissions. It also recommends books that cover Java networking topics in more detail.
Threads allow multiple tasks to run concurrently within a single Java program. A thread represents a separate path of execution and threads can be used to improve performance. There are two main ways to create threads: by extending the Thread class or implementing the Runnable interface. Threads transition between different states like new, runnable, running, blocked, and terminated. Synchronization is needed to prevent race conditions when multiple threads access shared resources simultaneously. Deadlocks can occur when threads wait for each other in a circular manner.
Streams are used to transfer data between a program and source/destination. They transfer data independently of the source/destination. Streams are classified as input or output streams depending on the direction of data transfer, and as byte or character streams depending on how the data is carried. Common stream classes in Java include FileInputStream, FileOutputStream, FileReader, and FileWriter for reading from and writing to files. Exceptions like FileNotFoundException may occur if a file cannot be opened.
The document discusses exception handling in Java. It defines exceptions as runtime errors that occur during program execution. It describes different types of exceptions like checked exceptions and unchecked exceptions. It explains how to use try, catch, throw, throws and finally keywords to handle exceptions. The try block contains code that might throw exceptions. The catch block catches and handles specific exceptions. The finally block contains cleanup code that always executes regardless of exceptions. The document provides examples of exception handling code in Java.
This document discusses delegates and events in C#. It explains that a delegate is an object that can refer to a method. There are four steps to using delegates: declaration, defining delegate methods, instantiation, and invocation. Delegates can be singlecast or multicast. Events are declared using an event keyword and a delegate type, and allow an object to notify other objects when an event occurs. Multicast delegates can invoke multiple methods by adding delegate instances together using + operator and removing them using - operator.
Provides information about Threads in Java. different ways of creating and running the thread and also provides the information about Life Cycle of the Thread
This document discusses the structure of a C++ program. It begins by defining software and the different types. It then discusses key concepts in C++ like classes, objects, functions, and headers. It provides examples of a class declaration with private and public sections, member functions, and a main function. It also discusses practical training resources available for learning C++ including e-learning websites, e-assignments, e-content, and mobile apps.
HTTP requests and responses follow a generic message format that includes a start line, message headers, an optional message body, and optional trailers. The start line indicates the request method and URI for requests or the HTTP version and status code for responses. Headers provide additional metadata about the message, sender, recipient, or content. The body carries request data or response content. Trailers are rarely used and provide additional headers after chunked content.
This document discusses I/O streams in Java. It defines streams as sequences of bytes that flow from a source to a destination. Streams can be categorized as character streams for text data or byte streams for raw binary data. Streams are also categorized as data streams that act as sources or destinations, or processing streams that alter or manage stream information. The Java IO package contains classes for defining input and output streams of different types.
Variables are containers that store information in PHP. PHP variables are case sensitive and can contain strings, integers, floats, Booleans, arrays and objects. Variables start with a $ sign followed by a name. Variable names must begin with a letter or underscore and can contain alphanumeric characters and underscores. Variables can be assigned values using common operators like assignment, addition, subtraction etc. Variables can have different scopes like local, global and static. Constants are similar to variables but their values cannot be changed once defined.
Overview of Java RMI remoting.
RMI is a lightweight Java technology that provides access to remote methods, similar to RPC, but object-oriented. RMI basically provides remote object access for a client and object registration for servers.
RMI is both a Java API (java.rmi.* package) as well as a transport protocol definition for transporting RMI calls through a network.
RMI is a Java technology since it requires that client and server objects run in a JVM (Java Virtual Machine). By using IIOP as transport protocol, however, it is possible to connect RMI-clients to non-Java server objects (e.g. CORBA).
RMI defines the elements client, server, RMI registry where servers register their services and possibly a plain vanilla web server that can be used by clients to dynamically load object classes to access servers.
This document discusses servlets, which are Java programs that extend the capabilities of web servers to enable dynamic web content. Servlets run on the server-side and generate HTML responses to HTTP requests from clients. The document covers the basics of servlets, how they interface with web servers, their lifecycle including initialization and destruction, advantages over previous technologies like CGI, and implementation details.
An interface defines a contract that specifies functionality without implementation. It defines a set of methods that classes implement. Interfaces allow for multiple inheritance by allowing a class to implement multiple interfaces. Interfaces cannot contain data members, constructors, destructors, or static members. Both interfaces and abstract classes cannot be instantiated but interfaces only define method signatures while abstract classes can contain implementations. A class implements an interface by listing the interface name after the class name and providing implementations for all interface methods.
Constructor is a special method in Java that is used to initialize objects. It has the same name as the class and is invoked automatically when an object is created. Constructors can be used to set default values for objects. A class can have multiple constructors as long as they have different parameters. Constructors are used to provide different initial values to objects and cannot return values.
This document provides an overview of Java input/output (I/O) concepts including reading from and writing to the console, files, and streams. It discusses different I/O stream classes like PrintStream, InputStream, FileReader, FileWriter, BufferedReader, and how to read/write characters, bytes and objects in Java. The document also introduces new I/O features in Java 7 like try-with-resources for automatic resource management.
This document discusses socket programming concepts in Java including server-client communication using sockets, the InetAddress class and its methods like getLocalHost(), getByName(), and getAllByName(), and the Socket and ServerSocket classes. It provides code examples to demonstrate how to use these classes and methods to establish connections between a client and server and exchange data over the network.
This is all about socket programming in java using TCP and UDP socket and an example of simple Echo Server.
Also includes concepts of the socket, Socket class and methods and use of those.
Packages in Java allow grouping of related classes and interfaces to avoid naming collisions. Some key points about packages include:
- Packages allow for code reusability and easy location of files. The Java API uses packages to organize core classes.
- Custom packages can be created by specifying the package name at the beginning of a Java file. The class files are then compiled to the corresponding directory structure.
- The import statement and fully qualified names can be used to access classes from other packages. The classpath variable specifies locations of package directories and classes.
The document discusses threads and multithreading in Java. It defines a thread as a single sequential flow of control within a program. Multithreading allows a program to be divided into multiple subprograms that can run concurrently. Threads have various states like newborn, runnable, running, blocked, and dead. The key methods for managing threads include start(), sleep(), yield(), join(), wait(), notify(). Synchronization is needed when multiple threads access shared resources to prevent inconsistencies. Deadlocks can occur when threads wait indefinitely for each other.
Class <class name> contains a main method that declares instance variables and calls other methods without creating objects. The main method has a string array as a parameter and does not return a value. Import is used to include packages that contain classes needed for input/output and other operations.
This document discusses TCP/IP networking concepts in Java like sockets, datagrams, ports and protocols. It provides code examples for socket programming in Java using TCP for client-server applications and UDP for datagram transmissions. It also recommends books that cover Java networking topics in more detail.
Threads allow multiple tasks to run concurrently within a single Java program. A thread represents a separate path of execution and threads can be used to improve performance. There are two main ways to create threads: by extending the Thread class or implementing the Runnable interface. Threads transition between different states like new, runnable, running, blocked, and terminated. Synchronization is needed to prevent race conditions when multiple threads access shared resources simultaneously. Deadlocks can occur when threads wait for each other in a circular manner.
Streams are used to transfer data between a program and source/destination. They transfer data independently of the source/destination. Streams are classified as input or output streams depending on the direction of data transfer, and as byte or character streams depending on how the data is carried. Common stream classes in Java include FileInputStream, FileOutputStream, FileReader, and FileWriter for reading from and writing to files. Exceptions like FileNotFoundException may occur if a file cannot be opened.
The document discusses exception handling in Java. It defines exceptions as runtime errors that occur during program execution. It describes different types of exceptions like checked exceptions and unchecked exceptions. It explains how to use try, catch, throw, throws and finally keywords to handle exceptions. The try block contains code that might throw exceptions. The catch block catches and handles specific exceptions. The finally block contains cleanup code that always executes regardless of exceptions. The document provides examples of exception handling code in Java.
This document discusses delegates and events in C#. It explains that a delegate is an object that can refer to a method. There are four steps to using delegates: declaration, defining delegate methods, instantiation, and invocation. Delegates can be singlecast or multicast. Events are declared using an event keyword and a delegate type, and allow an object to notify other objects when an event occurs. Multicast delegates can invoke multiple methods by adding delegate instances together using + operator and removing them using - operator.
Provides information about Threads in Java. different ways of creating and running the thread and also provides the information about Life Cycle of the Thread
This document discusses the structure of a C++ program. It begins by defining software and the different types. It then discusses key concepts in C++ like classes, objects, functions, and headers. It provides examples of a class declaration with private and public sections, member functions, and a main function. It also discusses practical training resources available for learning C++ including e-learning websites, e-assignments, e-content, and mobile apps.
HTTP requests and responses follow a generic message format that includes a start line, message headers, an optional message body, and optional trailers. The start line indicates the request method and URI for requests or the HTTP version and status code for responses. Headers provide additional metadata about the message, sender, recipient, or content. The body carries request data or response content. Trailers are rarely used and provide additional headers after chunked content.
This document discusses I/O streams in Java. It defines streams as sequences of bytes that flow from a source to a destination. Streams can be categorized as character streams for text data or byte streams for raw binary data. Streams are also categorized as data streams that act as sources or destinations, or processing streams that alter or manage stream information. The Java IO package contains classes for defining input and output streams of different types.
Variables are containers that store information in PHP. PHP variables are case sensitive and can contain strings, integers, floats, Booleans, arrays and objects. Variables start with a $ sign followed by a name. Variable names must begin with a letter or underscore and can contain alphanumeric characters and underscores. Variables can be assigned values using common operators like assignment, addition, subtraction etc. Variables can have different scopes like local, global and static. Constants are similar to variables but their values cannot be changed once defined.
Overview of Java RMI remoting.
RMI is a lightweight Java technology that provides access to remote methods, similar to RPC, but object-oriented. RMI basically provides remote object access for a client and object registration for servers.
RMI is both a Java API (java.rmi.* package) as well as a transport protocol definition for transporting RMI calls through a network.
RMI is a Java technology since it requires that client and server objects run in a JVM (Java Virtual Machine). By using IIOP as transport protocol, however, it is possible to connect RMI-clients to non-Java server objects (e.g. CORBA).
RMI defines the elements client, server, RMI registry where servers register their services and possibly a plain vanilla web server that can be used by clients to dynamically load object classes to access servers.
This document discusses servlets, which are Java programs that extend the capabilities of web servers to enable dynamic web content. Servlets run on the server-side and generate HTML responses to HTTP requests from clients. The document covers the basics of servlets, how they interface with web servers, their lifecycle including initialization and destruction, advantages over previous technologies like CGI, and implementation details.
An interface defines a contract that specifies functionality without implementation. It defines a set of methods that classes implement. Interfaces allow for multiple inheritance by allowing a class to implement multiple interfaces. Interfaces cannot contain data members, constructors, destructors, or static members. Both interfaces and abstract classes cannot be instantiated but interfaces only define method signatures while abstract classes can contain implementations. A class implements an interface by listing the interface name after the class name and providing implementations for all interface methods.
Constructor is a special method in Java that is used to initialize objects. It has the same name as the class and is invoked automatically when an object is created. Constructors can be used to set default values for objects. A class can have multiple constructors as long as they have different parameters. Constructors are used to provide different initial values to objects and cannot return values.
This document provides an overview of Java input/output (I/O) concepts including reading from and writing to the console, files, and streams. It discusses different I/O stream classes like PrintStream, InputStream, FileReader, FileWriter, BufferedReader, and how to read/write characters, bytes and objects in Java. The document also introduces new I/O features in Java 7 like try-with-resources for automatic resource management.
This document discusses socket programming concepts in Java including server-client communication using sockets, the InetAddress class and its methods like getLocalHost(), getByName(), and getAllByName(), and the Socket and ServerSocket classes. It provides code examples to demonstrate how to use these classes and methods to establish connections between a client and server and exchange data over the network.
The document discusses techniques, challenges, and best practices for handling input/output (I/O) operations in Java. It covers the different types of I/O, how Java supports I/O through streams and readers/writers, issues with streams, alternatives like NIO that support non-blocking I/O using buffers and channels, and "Hiranya's Laws" with guidelines for proper I/O handling.
The document discusses socket programming and provides an overview of client-server applications using sockets. It describes how sockets allow for interprocess communication using the client-server model. The key steps for creating TCP and UDP client and server applications in both C and Java programming languages are outlined, including how to create sockets, bind sockets, connect sockets, send and receive data. Code examples of a TCP client and server application written in C are also provided.
This document provides an overview of Java sockets including how they allow for client-server communication over networks, the lifecycle of a socket server, and code examples for a socket server and clients. It discusses how sockets provide connection-oriented and connectionless services in Java using classes like ServerSocket and Socket. Diagrams depict the use cases and classes for a socket server that handles weather requests from multiple clients. Code for a WeatherSocketServer class and examples of client requests are also included.
This document discusses Java networking and client/server communication. A client machine makes requests to a server machine over a network using protocols like TCP and UDP. TCP provides reliable data transmission while UDP sends independent data packets. Port numbers map incoming data to running processes. Sockets provide an interface for programming networks, with ServerSocket and Socket classes in Java. A server program listens on a port for client connections and exchanges data through input/output streams. Servlets extend web server functionality by executing Java programs in response to client requests.
Lecture 8 from the IAG0040 Java course in TTÜ.
See the accompanying source code written during the lectures: https://github.com/angryziber/java-course
This document discusses socket programming in Java. It begins by defining what a socket is - the combination of an IP address and port number used to uniquely identify an endpoint in a network connection. It then covers the basics of client-server socket programming using both TCP and UDP, including creating and using sockets, streams, and datagrams. Example code is provided for both TCP and UDP client and server implementations in Java using sockets to send and receive data. The document concludes with references for more information on socket programming.
The document discusses Java networking concepts including sockets, TCP, UDP, client-server programming, and key networking classes like InetAddress, ServerSocket, Socket, DatagramSocket, and DatagramPacket. It provides code examples for basic TCP and UDP client-server applications in Java using sockets to demonstrate sending and receiving data over a network.
The document discusses network programming and client-server computing. It explains that network programming involves writing programs that execute across multiple connected devices. It then describes the key elements of client-server computing including clients, servers, and the network. It also provides an overview of TCP and UDP networking protocols, explaining that TCP provides reliable connections while UDP provides faster unreliable connections. The document also discusses network classes in Java for TCP and UDP communication and how sockets work for client-server applications.
The document discusses network programming in Java using the java.net package. It covers using TCP and UDP for network communication. TCP provides reliable, ordered streams between hosts using sockets, while UDP provides simpler datagram transmission that is unreliable but can be broadcast. The InetAddress class represents IP addresses, and sockets are used for both TCP clients/servers and UDP communication.
This document discusses Java networking concepts and classes. It begins with an overview of sockets and protocols like TCP and IP. It then describes the InetAddress class for representing IP addresses and domain names. Client sockets using the Socket class are explained for connecting to servers. The core networking classes in java.net are listed, including Socket, ServerSocket, and InetAddress. An example program demonstrates looking up domain information using a Socket to connect to a WHOIS server.
This document provides an overview of networking concepts in Java including TCP/IP and UDP protocols, internet addressing, sockets, URLs, and how to implement client-server communication using TCP and UDP sockets. Key topics covered include the difference between TCP and UDP, how sockets connect applications to networks, internet addressing with IPv4 and IPv6, and examples of writing basic TCP and UDP client-server programs in Java.
The document discusses Java networking and socket programming. It defines key concepts like sockets, which represent endpoints in two-way communication between programs. Sockets use IP addresses and port numbers to identify connections. The Java Socket class implements network communication, while ServerSocket allows programs to listen for client connections. Examples demonstrate how to create sockets on the client and server sides to establish TCP connections between programs.
This document discusses networking concepts in Java including:
- Computer networking allows computers to send and receive messages over the Internet through an Internet Service Provider using technologies like dialup, DSL, or cable modem.
- Java networking allows sharing of resources and centralized software management between connected devices.
- IP addresses uniquely identify computers on the Internet and are assigned to each network node, while domain names provide friendly names that map to IP addresses via DNS servers.
- Common network protocols like TCP and UDP define rules for communication, with TCP being connection-oriented and reliable and UDP being connectionless and faster.
- Client-server models involve clients making requests to servers which provide shared resources, with ports identifying applications and IP addresses locating
The document contains a lab manual for computer networks that lists various experiments to be conducted. It includes experiments on socket programming, TCP and UDP communication using one-way and two-way protocols, file transfer using TCP, sliding window protocols, broadcasting, checksum calculations, routing algorithms, and remote method invocation. The experiments are scheduled to take place between December 2012 to February 2013. The lab manual provides details of each experiment such as its aim, algorithm, source code, and expected output.
Java networking allows connecting computing devices to share resources using sockets and protocols. Key concepts include IP addresses and port numbers to identify devices, connection-oriented protocols like TCP for reliability, and connectionless protocols like UDP for speed. The Socket class represents an endpoint for communication between applications, while the ServerSocket class allows creating a server to accept client connections. URL and URI classes handle uniform resource locators and identifiers to access resources on the internet.
Java networking allows connecting computing devices to share resources using sockets and protocols. Key concepts include IP addresses, port numbers, MAC addresses, connection-oriented vs connection-less protocols, and sockets. Java provides the Socket, ServerSocket, DatagramSocket, and DatagramPacket classes for networking. An example client-server program demonstrates a client sending a message to a server using sockets. The URL class represents web addresses and contains information like the protocol, server, port, and file name.
This document provides an overview and introduction to network theory and Java programming. It discusses key topics like network communication models (OSI and TCP/IP), protocols, ports, sockets, firewalls, proxies, and an overview of Java. The document also provides code samples for basic Java socket programming including using ServerSocket for servers and Socket for clients. It explains concepts like connection-oriented and connectionless sockets in UDP and TCP. The objective is to help readers understand network environments and be able to develop basic networking applications in Java.
The document discusses different types of sockets in Java network programming:
- TCP/IP client socket and TCP/IP server socket are used for reliable, bidirectional stream-based connections between hosts using TCP/IP. The client socket connects to the server socket.
- A Java DatagramSocket class represents a connectionless socket for sending and receiving datagram packets without reliability or sequencing. Commonly used DatagramSocket constructors are described.
- An example program is provided to demonstrate passing a message from a server to a client using sockets, showing the client and server code.
The document discusses Java UDP sockets and networking. It explains how to use the InetAddress class to represent IP addresses, and the DatagramSocket and DatagramPacket classes to send and receive UDP datagrams. It provides code examples for both client and server implementations of UDP networking in Java using these classes.
A socket is an endpoint for communication between two programs over a network. It represents a connection between a client program and a server program. The server runs on a specific machine and port, listening for connection requests from clients. Clients know the server's hostname and port number to request a connection. If accepted, the server gets a new socket to communicate with that client while listening for new connections, and the client can use its socket to communicate with the server. Sockets are identified by their paired IP addresses and port numbers to allow multiple connections. The Java Socket class implements sockets to allow platform-independent network communication between Java programs.
Advanced Java Programming: Introduction and Overview of Java Networking 1. In...KuntalVasoya
Advanced Java Programming: Introduction and Overview of Java Networking
1. Introduction to Advanced Java Programming
Advanced Java programming delves deeper into the concepts and technologies that allow developers to create robust, high-performance, and scalable applications. It includes topics like networking, database connectivity, multithreading, and distributed computing. This guide will focus on Java Networking, one of the critical areas in advanced Java.
2. Overview of Java Networking
Java Networking is a concept that allows communication between two or more computers (nodes) over a network. Java provides a robust set of classes and interfaces in the java.net package to facilitate network programming.
3. Key Concepts in Java Networking
Conclusion
Java Networking is a powerful tool for building networked applications. By understanding and utilizing the classes and interfaces provided in the java.net package, developers can create applications that communicate effectively over a network. This introduction covers the basics and some advanced concepts, providing a foundation for further exploration into Java networking.
What is Java Networking?
Java networking is a concept of connecting two or more computing devices together to share resources. In the Java programming language, networking can be achieved through classes and methods provided by the java.net package.
Key Concepts in Java Networking
Sockets:
Definition: A socket is an endpoint for communication between two machines.
Types:
Client Socket (Socket): Used to create a connection to the server.
Server Socket (ServerSocket): Used to listen for incoming connections.
IP Address:
Definition: An Internet Protocol address (IP address) is a unique address that identifies a device on the internet or a local network.
Types:
IPv4: 32-bit address (e.g., 192.168.1.1)
IPv6: 128-bit address (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334)
Ports:
Definition: A port is a number that identifies a specific process or service on a computer.
Range: 0 to 65535, with well-known ports ranging from 0 to 1023 (e.g., HTTP uses port 80).
Protocols:
TCP (Transmission Control Protocol): Provides reliable, ordered, and error-checked delivery of data.
UDP (User Datagram Protocol): Provides a connectionless, non-guaranteed communication method.
Core Classes in Java Networking
InetAddress:
Represents an IP address.
Key Methods:
getByName(String host): Returns an InetAddress object for the specified host name.
getHostAddress(): Returns the IP address as a string.
Socket:
Represents a client socket.
Key Methods:
connect(SocketAddress endpoint): Connects the socket to the specified endpoint.
getInputStream(): Returns an input stream for reading data from the socket.
getOutputStream(): Returns an output stream for writing data to the socket.
Java networking is a concept of connecting two or more computing devices together to share resources. In the Java programming language, networking can be achieved through cl
This document discusses network programming in Java. It shows how to get the local host address and address of google.com. It defines a server as a program that listens on a TCP port for connections and a client as a program that initiates connections. It demonstrates how to create a server socket to listen on a port and how a client socket can connect to an IP address and port. It also discusses Java I/O streams for input and output and how to handle files in Java including checking if a directory exists, creating it if not, opening output streams to write to files, and approaches for reading from files.
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
Java Hibernate Introduction, Architecture and Example with step by step guidance to run the program especially for students and teachers.
Learn More @ http://java2all.com/technology/hibernate
This document provides an overview of web application development and servlet technology. It discusses the history and evolution of web pages to dynamic web applications. It then defines web applications and the request-response model. Common Gateway Interface (CGI) is introduced as the first technique for dynamic content, along with its limitations which led to the creation of servlets. Key servlet concepts like the servlet interface, generic servlet, HTTP servlet, and servlet lifecycle methods are covered. The document also examines the HttpServletRequest and HttpServletResponse interfaces and their various methods. Finally, it discusses session tracking approaches including cookies and the session API.
The document describes the steps to develop a simple remote method invocation (RMI) application in Java. It includes:
1. Defining a remote interface with methods like addition, subtraction etc.
2. Implementing the interface in a class that defines the method bodies.
3. Creating a server class that binds the remote object to the registry.
4. Making a client class that looks up the remote object and calls methods.
5. Compiling the classes, running the registry, then server and client separately to test the application.
The document discusses Remote Method Invocation (RMI) in Java. RMI allows objects running in one Java virtual machine to invoke methods on objects running in another Java VM. It has four layers: application layer, proxy layer, remote reference layer, and transport layer. The RMI architecture contains an RMI server, RMI client, and RMI registry. The server creates remote objects and registers them with the registry. The client looks up remote objects by name in the registry and invokes methods on them.
Jdbc example program with access and MySqlkamal kotecha
The document provides examples of using JDBC to connect to and interact with Microsoft Access and MySQL databases. It includes steps to create databases and tables in Access and MySQL, as well as code samples demonstrating how to connect to the databases using JDBC, execute queries using Statement and PreparedStatement, and retrieve and display result sets. Key aspects like loading the appropriate JDBC driver and connection strings for different databases are also explained.
The document discusses several JDBC APIs used for connecting Java applications to databases. The Connection interface is used to create a connection to a database and execute SQL statements. The Statement interface executes static SQL queries and retrieves results. The PreparedStatement interface executes dynamic queries with IN parameters by using placeholder values set using methods like setInt() and setString(). Examples of using these interfaces will be provided in subsequent chapters.
JDBC provides a standard interface for connecting to and working with databases in Java applications. There are four main types of JDBC drivers: Type 1 drivers use ODBC to connect to databases but are only compatible with Windows. Type 2 drivers use native database client libraries but require the libraries to be installed. Type 3 drivers use a middleware layer to support multiple database types without native libraries. Type 4 drivers connect directly to databases using a pure Java implementation, providing cross-platform compatibility without additional layers.
The document discusses three ways to handle errors in JSP:
1. Using Java exception handling mechanisms like try/catch blocks.
2. Specifying an error page using the errorPage attribute in the page directive.
3. Configuring error pages in the web deployment descriptor (web.xml) by mapping exceptions to error pages.
JSP stands for Java Server Pages and enables developers to embed Java code directly into HTML pages. JSP pages have a .jsp extension and allow for platform-independent development since Java code can run on any system. The JSP request is sent to the web server, which passes the .jsp file to the JSP servlet engine. If it is the first request, the JSP file is parsed into a servlet class file; otherwise, an instantiated servlet handles the request. The servlet output is then sent to the user's browser.
The document discusses String handling in Java. It describes how Strings are implemented as objects in Java rather than character arrays. It also summarizes various methods available in the String and StringBuffer classes for string concatenation, character extraction, comparison, modification, and value conversion. These methods allow extracting characters, comparing strings, modifying strings, and converting between string and other data types.
The document discusses Java wrapper classes. Wrapper classes wrap primitive data types like int, double, boolean in objects. This allows primitive types to be used like objects. The main wrapper classes are Byte, Short, Integer, Long, Character, Boolean, Double, Float. They provide methods to convert between primitive types and their wrapper objects. Constructors take primitive values or strings to create wrapper objects. Methods like parseInt() convert strings to primitive types.
The document discusses Java packages and classes. It describes common Java API packages like java.lang, java.util, java.io, java.awt, and java.net and what types of classes they contain. It also provides examples of using packages like Vector, Random, Date, and Calendar classes and their key methods. The Calendar class allows interpreting dates and times, defining constants used for components like MONTH, DATE, HOUR, etc.
Interfaces define methods that classes can implement. Classes implementing interfaces must define all interface methods. Interfaces can extend other interfaces, requiring implementing classes to define inherited methods as well. Interface variables are implicitly public, static, and final. A class can implement multiple interfaces and override methods with the same name across interfaces. Partial interface implementation requires the class to be abstract.
ppt of class and methods in java,recursion in java,nested class,java,command line argument,method overloading,call by value,call by reference,constructor overloading core java ppt
The document discusses control structures in Java, including selection (if/else statements), repetition (loops like while and for), and branching (break and continue). It provides examples of if/else, switch, while, do-while, for, and break/continue statements. The key structures allow sequencing, selecting between alternatives, and repeating actions in a program.
This document provides step-by-step instructions for creating a simple JavaServer Pages (JSP) web application using MyEclipse. It describes how to open MyEclipse, create a new web project, add JSP files to the project, deploy the project to a Tomcat server, and view the application in a web browser by entering the URL. The instructions include screenshots indicating where to click or enter information at each step.
The development of smart cities holds immense significance in shaping a nation's urban fabric and effectively addressing urban challenges that profoundly impact the economy. Among these challenges, road accidents pose a significant obstacle to urban progress, affecting lives, supply chain efficiency, and socioeconomic well-being. To address this issue effectively, accurate forecasting of road accidents is crucial for policy formulation and enhancing safety measures. Time series forecasting of road accidents provides invaluable insights for devising strategies, enabling swift actions in the short term to reduce accident rates, and informing well-informed road design and safety management policies for the long term, including the implementation of flyovers, and the enhancement of road quality to withstand all weather conditions. Deep Learning's exceptional pattern recognition capabilities have made it a favored approach for accident forecasting. The study comprehensively evaluates deep learning models, such as RNN, LSTM, CNN+LSTM, GRU, Transformer, and MLP, using a ten-year dataset from the esteemed Smart Road Accident Database in Hubballi-Dharwad. The findings unequivocally underscore LSTM's superiority, exhibiting lower errors in both yearly (RMSE: 0.291, MAE: 0.271, MAPE: 6.674%) and monthly (RMSE: 0.186, MAE: 0.176, MAPE: 5.850%) variations. Based on these compelling findings, the study provides strategic recommendations to urban development authorities, emphasizing comprehensive policy frameworks encompassing short-term and long-term measures to reduce accident rates alongside meticulous safety measures and infrastructure planning. By leveraging insights from deep learning models, urban development authorities can adeptly shape the urban landscape, fostering safer environments and contributing to global safety and prosperity.
Electrical and Electronics Engineering: An International Journal (ELELIJ)elelijjournal653
Call For Papers...!!!
Electrical and Electronics Engineering: An International Journal (ELELIJ)
Web page link: https://wireilla.com/engg/eeeij/index.html
Submission Deadline: June 08, 2025
Submission link: [email protected]
Contact Us: [email protected]
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
First Review PPT gfinal gyft ftu liu yrfut goSowndarya6
CyberShieldX provides end-to-end security solutions, including vulnerability assessment, penetration testing, and real-time threat detection for business websites. It ensures that organizations can identify and mitigate security risks before exploitation.
Unlike traditional security tools, CyberShieldX integrates AI models to automate vulnerability detection, minimize false positives, and enhance threat intelligence. This reduces manual effort and improves security accuracy.
Many small and medium businesses lack dedicated cybersecurity teams. CyberShieldX provides an easy-to-use platform with AI-powered insights to assist non-experts in securing their websites.
Traditional enterprise security solutions are often expensive. CyberShieldX, as a SaaS platform, offers cost-effective security solutions with flexible pricing for businesses of all sizes.
Businesses must comply with security regulations, and failure to do so can result in fines or data breaches. CyberShieldX helps organizations meet compliance requirements efficiently.
Impurities of Water and their Significance.pptxdhanashree78
Impart Taste, Odour, Colour, and Turbidity to water.
Presence of organic matter or industrial wastes or microorganisms (algae) imparts taste and odour to water.
Presence of suspended and colloidal matter imparts turbidity to water.
本資料「To CoT or not to CoT?」では、大規模言語モデルにおけるChain of Thought(CoT)プロンプトの効果について詳しく解説しています。
CoTはあらゆるタスクに効く万能な手法ではなく、特に数学的・論理的・アルゴリズム的な推論を伴う課題で高い効果を発揮することが実験から示されています。
一方で、常識や一般知識を問う問題に対しては効果が限定的であることも明らかになりました。
複雑な問題を段階的に分解・実行する「計画と実行」のプロセスにおいて、CoTの強みが活かされる点も注目ポイントです。
This presentation explores when Chain of Thought (CoT) prompting is truly effective in large language models.
The findings show that CoT significantly improves performance on tasks involving mathematical or logical reasoning, while its impact is limited on general knowledge or commonsense tasks.
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyYannis
The doctoral thesis trajectory has been often characterized as a “long and windy road” or a journey to “Ithaka”, suggesting the promises and challenges of this journey of initiation to research. The doctoral candidates need to complete such journey (i) preserving and even enhancing their wellbeing, (ii) overcoming the many challenges through resilience, while keeping (iii) high standards of ethics and (iv) scientific rigor. This talk will provide a personal account of lessons learnt and recommendations from a senior researcher over his 30+ years of doctoral supervision and care for doctoral students. Specific attention will be paid on the special features of the (i) interdisciplinary doctoral research that involves Information and Communications Technologies (ICT) and other scientific traditions, and (ii) the challenges faced in the complex technological and research landscape dominated by Artificial Intelligence.
International Journal of Advance Robotics & Expert Systems (JARES)jaresjournal868
Call For Papers!!!
International Journal of Advance Robotics & Expert Systems (JARES)
Web page Link: http://airccse.com/jares/index.html
Submission Deadline :June17, 2025
submission Link: http://airccse.com/submission/home.html
Contact Us : [email protected] or [email protected] or [email protected]
May 2025: Top 10 Cited Articles in Software Engineering & Applications Intern...sebastianku31
The International Journal of Software Engineering & Applications (IJSEA) is a bi-monthly open access peer-reviewed journal that publishes articles which contribute new results in all areas of the Software Engineering & Applications. The goal of this journal is to bring together researchers and practitioners from academia and industry to focus on understanding Modern software engineering concepts & establishing new collaborations in these areas.
3. Network Programming Introduction
Java supports Network Programming to communicate
with other machines.
Let`s start with Network Programming Introduction.
http://www.java2all.com
4. Network Programming Introduction
As we all know that Computer Network means a group of
computers connect with each other via some medium and transfer
data between them as and when require.
Java supports Network Programming so we can make such
program in which the machines connected in network will send and
receive data from other machine in the network by programming.
The first and simple logic to send or receive any kind of data
or message is we must have the address of receiver or sender. So
when a computer needs to communicate with another computer, it`s
require the other computer’s address.
Java networking programming supports the concept of
socket. A socket identifies an endpoint in a network. The socket
communication takes place via a protocol.
http://www.java2all.com
5. The Internet Protocol is a lower-level, connection less (means
there is no continuing connection between the end points) protocol for
delivering the data into small packets from one computer (address) to
another computer (address) across the network (Internet). It does not
guarantee to deliver sent packets to the destination.
The most widely use a version of IP today is IPv4, uses a 32 bit
value to represent an address which are organized into four 8-bits chunks.
However new addressing scheme called IPv6, uses a 128 bit value to
represent an address which are organized into four 16-bits chunks. The
main advantage of IPv6 is that it supports much larger address space than
does IPv4. An IP (Internet Protocol) address uniquely identifies the
computer on the network.
IP addresses are written in a notation using numbers separated by
dots is called dotted-decimal notation. There are four 8 bits value between
0 and 255 are available in each IP address such as 127.0.0.1 means local-
host, 192.168.0.3 etc.
http://www.java2all.com
6. It`s not an easy to remember because of so many numbers, they
are often mapped to meaningful names called domain names such as
mail.google.com There is a server on Internet who is translate the host
names into IP addresses is called DNS (Domain Name Server).
NOTE: Internet is the global network of millions of computer and
the any computer may connect the Internet through LAN (Local Area
Network), Cable Modem, ISP (Internet Service Provider) using dialup.
When a user pass the URL like java2all.com in the web-browser
from any computer, it first ask to DNS to translate this domain name into
the numeric IP address and then sends the request to this IP address. This
enables users to work with domain names, but the internet operates on IP
addresses.
Here in java2all.com the “com” domain is reserved for commercial
sites; then “java2all” is the company name.
http://www.java2all.com
7. The Higher-level protocol used in with the IP are TCP (Transmission
Control Protocol) and UDP (User Datagram Protocol).
The TCP enables two host to make a connection and exchange the
stream of data, so it`s called Stream-based communication. TCP guarantees
delivery of data and also guarantees that streams of data will be delivered
in the same order in which they are sent. The TCP can detect the lost of
transmission and so resubmit them and hence the transmissions are
lossless and reliable.
The UDP is a standard, directly to support fast, connectionless host-
to-host datagram oriented model that is used over the IP and exchange the
packet of data so it`s called packet-based communication. The UDP cannot
guarantee lossless transmission.
JAVA supports both TCP and UDP protocol families.
http://www.java2all.com
9. Java InetAddress Class is used to encapsulate the two thing.
1. Numeric IP Address
2. The domain name for that address.
The InetAddress can handle both IPv4 and IPv6 addressses. It has
no visible constructors so to create its object, the user have to use one of
the available in-built static methods.
The commonly used InetAddress in-built methods are:
(1) getLocalHost(): It returns the InetAddress object that represents the
local host contain the name and address both. If this method unable to
find out the host name, it throw an UnknownHostException.
Syntax:
Static InetAddress getLocalHost() throws UnknownHostException
http://www.java2all.com
10. (2) getByName(): It returns an InetAddress for a host name passed to it as
a parameter argument. If this method unable to find out the host name, it
throw an UnknownHostException.
Syntax:
Static InetAddress getByName(String host_name) throws
UnknownHostException
(3) getAllByName(): It returns an array of an InetAddress that represent all
of the addresses that a particular name resolve to it. If this method can’t
find out the name to at least one address, it throw an
UnknownHostException.
Syntax:
Static InetAddress[] getAllByName(String host_name) throws
UnknownHostException
http://www.java2all.com
11. Program: Write down a program which demonstrate an InetAddress class.
import java.net.InetAddress;
import java.net.UnknownHostException;
public class InetAddress_Demo
{
public static void main(String[] args)
{
String name = “”;
try {
System.out.println(“HOST NAME - Numeric Address : “+InetAddress.getLocalHost());
InetAddress ip = InetAddress.getByName(name);
System.out.println(“HOST DEFAULT-NAME / IP :”+ip);
System.out.println(“HOST IP-ADDRESS : “+ip.getHostAddress());
System.out.println(“HOST DEFAULT-NAME : “+ip.getHostName());
}
catch (UnknownHostException e) {
System.out.println(“Not find the IP-ADDRESS for :”+name);
}
}
}
Output:
HOST NAME - Numeric Address : Ashutosh-
2c89cd5e0a/127.0.0.1
HOST DEFAULT-NAME / IP : localhost/127.0.0.1
HOST IP-ADDRESS : 127.0.0.1
HOST DEFAULT-NAME : localhost
http://www.java2all.com
13. socket programming in java is very important topic and concept of
network programming.
Java network Programming supports the concept of socket. A
socket identifies an endpoint in a network. The socket communication take
place via a protocol.
A socket can be used to connect JAVA Input/Output system to other
programs that may resides either on any machine on the Internet or on the
local machine.
http://www.java2all.com
14. TCP/IP Sockets:
TCP/IP sockets are used to implement point-to-point, reliable,
bidirectional, stream-based connections between hosts on the Internet.
There are two types of TCP sockets available in java:
(1) TCP/IP Client Socket
(2) TCP/IP Server Socket
(1) TCP/IP Client Socket:
The Socket class (available in java.net package) is for the Client Socket.
It is designed to connect to server sockets and initiate protocol exchange.
There are two constructers used to create client sockets type object.
(a) Socket(String host_name,int port) throws
UnknownHostException,IOException it creates a socket that is
connected to the given host_name and port number.
http://www.java2all.com
15. (b) Socket(InetAddress ip,int port) throws IOException it creates a
socket using a pre-existing InetAddress object and a port number.
(2) TCP/IP Server Socket:
The ServerSocket class (available in java.net package) is for the
Server. It is designed to be a “listener”, which waits for clients to connect
before doing anything and that listen for either local or remote client
programs to connect to them on given port.
When you create ServerSocket it will register itself with the system
as having an interest in client connection.
Syntax:
ServerSocket(int port) throws IOException
http://www.java2all.com
16. Program: Write down a program which demonstrate the Socket programming
for passing the message from server to client.
Client.java:
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
public class Client {
public static void main(String[] args) {
System.out.println(“Sending a request.....”);
try {
Socket s = new Socket(“127.0.0.1”,1564);
System.out.println(“connected successfully.....”);
BufferedReader br = new BufferedReader(new
InputStreamReader(s.getInputStream()));
System.out.println(“response from server...”);
System.out.println(“Client side : “+br.readLine()); s.close();
}
catch (UnknownHostException e) {
System.out.println(“Not find the IP-ADDRESS for :”+e);
}
catch (IOException e) {
System.out.println(“Not Found data for Socket : “+e);
}
}
}
http://www.java2all.com
17. Server.java:
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
public class Server
{
public static void main(String[] args)
{
try
{
ServerSocket ss = new ServerSocket(1564);
System.out.println("waiting for request....");
Socket s = ss.accept();
System.out.println("Request accepted");
PrintStream ps = new PrintStream(s.getOutputStream());
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Input the data at server : ");
ps.print(br.readLine());
s.close();
ss.close();
}
catch (Exception e)
{
System.out.println("Not Found data for Socket : "+e);
}
}
} http://www.java2all.com
18. For Output follow the below step:
(1) Run server.java
Console:
waiting for request....
(2) Run Client.java
Console:
waiting for request....
Request accepted
Input the data at server:
(3) Now enter the message at console
Input the data at server:
welcome at server
(4) Then press Enter.
http://www.java2all.com
19. (5) Sending a request.....
connected successfully.....
response from server...
Client side: welcome at server
Program 2: Write down a program for addition the two different
variable by Socket programming.
Program 3: Write down a program which demonstrate the Socket
programming for passing the message from client to server and also apply
EXIT properties.
http://www.java2all.com
21. Two variable addition and passing message from client to server
two different java socket programming example is given below but before
going through program directly you should have some knowledge about
Java Network Programming and Socket.
These both things are already available in previous chapter so you
can learn from there.
Now let`s move to program 1.
http://www.java2all.com
22. Program: Write down a program for addition the two different
variable by Socket programming.
Client_Addition.java:
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class Client_Addition
{
public static void main(String[] args) {
try {
Socket s = new Socket("127.0.0.1",1868);
PrintStream ps = new PrintStream(s.getOutputStream());
Scanner sc = new Scanner(System.in);
System.out.println("Enter first value: ");
int i1 = sc.nextInt();
ps.println(i1);
ps.flush();
System.out.println("Enter second value: ");
int i2 = sc.nextInt();
ps.println(i2);
ps.flush();
s.close();
}
catch (UnknownHostException e) {
System.out.println("Not find the IP-ADDRESS for :"+e);
}
catch (IOException e) {
System.out.println("Not Found data for Socket : "+e);
}
}
http://www.java2all.com
23. Server_Addition.java
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
public class Server_Addition
{
public static void main(String[] args)
{
try
{
System.out.println("Server run successfully......");
ServerSocket sc = new ServerSocket(1868);
Socket s = sc.accept();
BufferedReader br = new BufferedReader(new
InputStreamReader(s.getInputStream()));
int i1 = Integer.parseInt(br.readLine());
int i2 = Integer.parseInt(br.readLine());
System.out.println("Addition: "+(i1+i2));
s.close();
sc.close();
}
catch (IOException e)
{
System.out.println("Not Found data for Socket : "+e);
}
}
} http://www.java2all.com
24. For Output follow the below step:
(1) Run Server_Addition.java
Console:
Server run successfully......
(2) Run Client.java
Console:
Enter first value:
5
Enter second value:
25
(3) Now, press Enter
(4) Server run successfully......
Addition: 30
http://www.java2all.com
25. java socket programming example 2:
Program: Write down a program which demonstrate the Socket
programming for passing the message from client to server and also
apply EXIT properties.
Client.java:
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
public class Client
{
public static void main(String[] args) {
System.out.println("Sending a request.....");
Try {
Socket s = new Socket("127.0.0.1",1235);
System.out.println("connected successfully.....");
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
PrintStream ps = new PrintStream(s.getOutputStream());
BufferedReader brs = new BufferedReader(new
InputStreamReader(s.getInputStream()));
while(true)
{
System.out.println("input the data....");
String st = br.readLine();
ps.println(st);
http://www.java2all.com
27. Server.java:
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
public class Server
{
public static void main(String[] args) {
try {
ServerSocket ss = new ServerSocket(1235);
System.out.println("waiting for request....");
Socket s = ss.accept();
System.out.println("Request accepted");
BufferedReader br = new BufferedReader(new
InputStreamReader(s.getInputStream()));
while(true)
{
String st = br.readLine();
if(st.equals("exit")==true)
{
System.out.println("connection lost.....");
System.exit(1);
}
System.out.println("Message from client: "+st);
}
}
catch (IOException e) {
System.out.println("Not Found data for Socket : "+e);
}
}
}
http://www.java2all.com
28. For Output follow the below step:
(1) Put the both file in the bin folder at jdk.
For example: C:Program Files (x86)Javajdk1.6.0bin.
(2) Open Command Prompt & reach up to bin path.
http://www.java2all.com
29. (3) Compile the Server.java & Client.java
…bin>javac Server.java
…bin>javac Client.java
(4) Run the Server.java
…bin>java Server
http://www.java2all.com
30. (5) Open new command prompt:
(6) Now revise step-2.
(7) Run the Client.java.
…bin>java Client
http://www.java2all.com
31. Check the Message at Server Side Command Prompt.
(8) Write down the message on Client Side Command Prompt Like:
Input the data…
Ashutosh
(9) Now Press Enter & Check the Output at Both Windows.
http://www.java2all.com