Ajp 2
Ajp 2
Ajp 2
A Study on
Java Code for Finding a Ip address using swing
Micro Project Report
Submitted in November 2024 by the group of CO Students
Certificate
Certificate
Certificate
Certificate
3 Flow chart 3
6 Evaluation Sheet 6
• Abstract:
The IP Finder Tool is a simple Java application designed to allow users to convert a given domain name
(URL) into its corresponding IP address. The tool uses the Java Swing framework for the graphical user
interface (GUI) and the InetAddress class for DNS (Domain Name System) resolution. Users can enter a
URL (e.g., www.example.com) in a text field and, upon clicking the "Find IP" button, the application
performs a lookup and displays the IP address associated with the domain.
This project showcases the basic principles of networking in Java, focusing on DNS resolution through
the InetAddress API, and it provides a straightforward interface for resolving domain names to their
respective IP addresses. In cases where the URL is invalid or cannot be resolved, the tool handles the
error gracefully by showing an error message to the user.
The IP Finder Tool serves as a valuable utility for network troubleshooting, web development, and
general educational purposes, as it helps users better understand how domain names are mapped to IP
addresses. Additionally, it demonstrates the use of Java for creating cross-platform desktop applications
with network functionality.
Key Features:
• User-friendly GUI: A simple interface with a text field for entering URLs and a button to initiate
the IP resolution.
• Error Handling: Provides user-friendly error messages in case of invalid URLs or resolution
failures.
• Cross-Platform: Built using Java, ensuring compatibility across multiple platforms (Windows,
macOS, Linux).
Applications:
• Useful for developers and network administrators who need to quickly find the IP address of a
website.
• Educational tool for understanding DNS resolution and Java network programming concepts.
• Aim:
The primary aim of the IP Finder Tool project is to provide a simple and intuitive application that allows
users to resolve domain names (URLs) to their corresponding IP addresses. By leveraging Java's
networking libraries, particularly the InetAddress class, the tool enables users to enter a URL and retrieve
the associated IP address with a simple click of a button.
Specifically, the project aims to:
1. Simplify Domain Name Resolution: The tool provides an easy-to-use interface for resolving
domain names (e.g., www.google.com) to their IP addresses (e.g., 142.250.185.206), making it
accessible to users without requiring technical knowledge of networking.
3. Create a User-friendly GUI: By implementing a graphical user interface (GUI) with Java Swing,
the project ensures that the tool is easy to interact with, even for users who are not familiar with
command-line tools.
4. Serve as a Practical Utility: The tool is intended to be a useful utility for network administrators,
web developers, and general users who need to quickly find the IP address associated with a given
URL for troubleshooting, testing, or educational purposes.
• Main Content:
The IP Finder Project is a Java application that allows users to resolve a given domain name (URL) into its
corresponding IP address. It uses Java Swing to create a simple graphical user interface (GUI) with a
JTextField for URL input, a JButton to trigger the action, and JOptionPane to display the result. The
program utilizes InetAddress.getByName() to perform domain name resolution. If the URL is valid, it
shows the IP address; if not, it handles errors using UnknownHostException and displays an error message.
This project demonstrates basic networking, GUI development, and exception handling in Java
• Flow chart:
Start
Is URL valid?
yes No
End
• Program:-
import javax.swing.*;
import java.awt.event.*;
import java.net.*;
JLabel l;
JTextField tf;
JButton b;
IPFinder(){
l.setBounds(50,70,150,20);;
tf=new JTextField();
tf.setBounds(50,100,200,20);
b.setBounds(50,150,80,30);
b.addActionListener(this);
add(l);
add(tf);
add(b);
setSize(300,300);
setLayout(null);
setVisible(true);
try {
InetAddress ia=InetAddress.getByName(url);
String ip=ia.getHostAddress();
JOptionPane.showMessageDialog(this,ip);
JOptionPane.showMessageDialog(this,e1.toString());
new IPFinder();
• Output:
• Conclusion:
The IP Finder Project is a simple yet effective Java application that demonstrates the resolution of
domain names (URLs) to their corresponding IP addresses. By leveraging Java Swing for the graphical
user interface (GUI) and Java Networking features (specifically the InetAddress class), the program
provides an easy-to-use tool for users to quickly find the IP address of any valid website or server.
References:
➢ https://www.javatpoint.com/ip-finder-in-java
➢ https://www.javatpoint.com/java-swing
• Evaluation Sheet for the micro project:
Prof.T. R. Kawade.
Department of Computer Engineering,
Sir Dr. M.S.Gosavi Polytechnic Institute,
Nashik Road Nashik