4 PDF
4 PDF
4 PDF
The mostly used approach is by extending HttpServlet because it provides http request specific method
such as doGet(), doPost(), doHead() etc.
Here, we are going to use apache tomcat server in this example. The steps are as follows:Hello Java Program
for Beginners
The Sun Microsystem defines a unique standard to be followed by all the server vendors. Let's see the
directory structure that must be followed to create the servlet.
2 |M.sc sem I OOPs USING JAVA
As you can see that the servlet class file must be in the classes folder. The web.xml file must be under the
WEB-INF folder.
2)Create a Servlet
There are three ways to create the servlet.
The HttpServlet class is widely used to create the servlet because it provides methods to handle http requests such
as doGet(), doPost, doHead() etc.
In this example we are going to create a servlet that extends the HttpServlet class. In this example, we are inheriting
the HttpServlet class and providing the implementation of the doGet() method. Notice that get request is the
default request.
DemoServlet.java
1. import javax.servlet.http.*;
2. import javax.servlet.*;
3. import java.io.*;
4. public class DemoServlet extends HttpServlet{
5. public void doGet(HttpServletRequest req,HttpServletResponse res)
6. throws ServletException,IOException
3 |M.sc sem I OOPs USING JAVA
7. {
8. res.setContentType("text/html");//setting the content type
9. PrintWriter pw=res.getWriter();//get the stream to write the data
10.
11. //writing html in the stream
12. pw.println("<html><body>");
13. pw.println("Welcome to servlet");
14. pw.println("</body></html>");
15.
16. pw.close();//closing the stream
17. }}
2) weblogic.jar Weblogic
3) javaee.jar Glassfish
4) javaee.jar JBoss
1. set classpath
2. paste the jar file in JRE/lib/ext folder
Put the java file in any folder. After compiling the java file, paste the class file of servlet in WEB-
INF/classes directory.
The web container uses the Parser to get the information from the web.xml file. There are many xml parsers
such as SAX, DOM and Pull.
There are many elements in the web.xml file. Here is given some necessary elements to run the simple
servlet program.
web.xml file
1. <web-app>
2.
3. <servlet>
4. <servlet-name>sonoojaiswal</servlet-name>
5. <servlet-class>DemoServlet</servlet-class>
6. </servlet>
7.
8. <servlet-mapping>
9. <servlet-name>sonoojaiswal</servlet-name>
10. <url-pattern>/welcome</url-pattern>
11. </servlet-mapping>
12.
13. </web-app>
<url-pattern> is sub element of <servlet-mapping>. This pattern is used at client side to invoke the servlet.
To start Apache Tomcat server JAVA_HOME and JRE_HOME must be set in Environment variables.
Go to My Computer properties -> Click on advanced tab then environment variables -> Click on the new
tab of user variable -> Write JAVA_HOME in variable name and paste the path of jdk folder in variable
value -> ok -> ok -> ok.
Go to My Computer properties:
Write JAVA_HOME in variable name and paste the path of jdk folder in variable value:
After setting the JAVA_HOME double click on the startup.bat file in apache tomcat/bin.
Changing the port number is required if there is another server running on the same system with same
port number.Suppose you have installed oracle, you need to change the port number of apache tomcat
because both have the default port number 8080.
Open server.xml file in notepad. It is located inside the apache-tomcat/conf directory . Change the
Connector port = 8080 and replace 8080 by any four digit number instead of 8080. Let us replace it by
9999 and save this file.
6 |M.sc sem I OOPs USING JAVA
But there are several ways to deploy the project. They are as follows:
You can also create war file, and paste it inside the webapps directory. To do so, you need to use jar tool
to create the war file. Go inside the project directory (before the WEB-INF), then write:.
First of all, follow the following steps to install Eclipse Glassfish Tools plugin into Eclipse IDE.
If the Servers view is not opened, try to open it first. Click Windows->Show Views -
> Servers from Eclipse main menu.
In the Servers view, right click on the blank area, select New->Server in the context menu. It
starts a New Server wizard to set up a server instance.
In the New Server wizard, the first step is Define a New Server, select Glassfish in the server
type tree, and click Next button.
In the Glassfish runtime properties step, you can name the server instance, select the Glassfish
location from local machine, and choose a JDK 8 to run Glassfish, click Next button.
7 |M.sc sem I OOPs USING JAVA
In the Glassfish Application Server properties step, it allows you to setup domain info and the
administration properties, let’s use the default values, click Finish button.
It is easy to control the application server in the Servers view, such as start, stop, restart, deploy
and undeploy, etc.
Right click the Glassfish node, and select Start to start Glassfish server. After it is started
successfully, under the Glassfish node, it will include the resources in the Glassfish server.
To stop Glassfish Server, just click Stop in the context menu, or select Glassfish node, and click
the stop button in the toolbar of the Servers view.
Ok, let’s try to run our sample application on the Glassish server.
In the Project or Packages view, right click the project node, and click Run As…-> Run on
Server in the context menu.
In the Run on Server dialog, select Glassfish, and click Finish button. Wait for seconds, it will
build, package and deploy the application into Glassfish server.
When it is done, you will see there is a Deployed Applications under the Glassfish node in
the Servers view. Expand this node, there is a jakartaee8-starter node, it is our application
running on the Glassfish server.
Creating servlet example in eclipse ide, saves a lot of work to be done. It is easy and simple to create a
servlet example. Let's see the steps, you need to follow to create the first servlet example.
Now tomcat server has been started and project is deployed. To access the servlet write the url pattern
name in the URL bar of the browser. In this case Hello then enter.
For configuring the tomcat server in eclipse IDE, click on servers tab at the bottom side of the IDE ->
right click on blank area -> New -> Servers -> choose tomcat then its version -> next -> click on
Browse button -> select the apache tomcat root folder previous to bin -> next -> addAll -> Finish.
For creating a web project click on File Menu -> New -> web project -> write your project name e.g. first -> Finish.
For creating a html file, right click on WebRoot -> New -> html -> write your html file name e.g. MyHtml.html ->
Finish.
As you can see that a servlet file is created named Hello.java. Now let's write the servlet code here.
Now let's make the MyHtml.html file as the default page of our project. For this, open web.xml file and change the
welcome file name as MyHtml.html in place of index.jsp.
The default port of myeclipse tomcat is 8080, if you have installed oracle on your system, the port no. will conflict
so let's first change the port number of myeclipse tomcat server. For changing the port number click on the start
server icon at the left hand side of browser icon -> myeclipse tomcat -> Configure server connector -> change the
port number as 8888 in place of 8080 -> apply -> ok.
Now change the port number as 8888 in place of 8080 -> apply -> ok.
Now port number have been changed. For starting the server Right click on your project -> Run As -> MyEclipse
server application.
As you can see that default page of your project is open, write your name -> go.
When a user clicks a Submit button, information entered in a display page is sent to a servlet. The
servlet processes the incoming data and orchestrates a response by generating content. Once the
content is generated, the servlet creates a response page, usually by forwarding the content to a JSP.
The response is sent back to the client, which sets up the next user interaction.
The following illustration shows the information flow to and from the servlet.
- or -
URL Rewriting
In URL rewriting, we append a token or identifier to the URL of the next Servlet or the next resource. We
can send parameter name/value pairs using the following format:
url?name1=value1&name2=value2&??
A name and a value is separated using an equal = sign, a parameter name/value pair is separated from
another parameter using the ampersand(&). When the user clicks the hyperlink, the parameter name/value
pairs will be passed to the server. From a Servlet, we can use getParameter() method to obtain a parameter
value.
11 |M.sc sem I OOPs USING JAVA
index.html
1. <form action="servlet1">
2. Name:<input type="text" name="userName"/><br/>
3. <input type="submit" value="go"/>
4. </form>
FirstServlet.java
1. import java.io.*;
2. import javax.servlet.*;
3. import javax.servlet.http.*;
4.
5.
6. public class FirstServlet extends HttpServlet {
7.
8. public void doGet(HttpServletRequest request, HttpServletResponse response){
12 |M.sc sem I OOPs USING JAVA
The HTTP client sends the request to the server in the form of request message which includes following
information:
o The Request-line
o The analysis of source IP address, proxy and port
o The analysis of destination IP address, protocol, port and host
o The Requested URI (Uniform Resource Identifier)
o The Request method and Content
o The User-Agent header
o The Connection control header
o The Cache control header
The HTTP request method indicates the method to be performed on the resource identified by
the Requested URI (Uniform Resource Identifier). This method is case-sensitive and should be used in
uppercase.
HTTP Description
Request
POST Asks the server to accept the body info attached. It is like GET request with extra info sent with
the request.
HEAD Asks for only the header part of whatever a GET would return. Just like GET but with no body.
TRACE Asks for the loopback of the request message, for testing or troubleshooting.
PUT Says to put the enclosed info (the body) at the requested URL.
OPTIONS Asks for a list of the HTTP methods to which the thing at the request URL can respond
GET POST
1) In case of Get request, only limited amount of data can In case of post request, large amount of data can
be sent because data is sent in header. be sent because data is sent in body.
2) Get request is not secured because data is exposed in Post request is secured because data is not
URL bar. exposed in URL bar.
4) Get request is idempotent . It means second request will Post request is non-idempotent.
be ignored until response of first request is delivered
5) Get request is more efficient and used more than Post. Post request is less efficient and used less than
get.
1. GET/RegisterDao.jsp?name1=value1&name2=value2
As we know that data is sent in request header in case of get request. It is the default request type. Let's
1. POST/RegisterDao.jsp HTTP/1.1
2. Host: www. javatpoint.com
3. name1=value1&name2=value2
As we know, in case of post request original data is sent in message body. Let's see how information is
passed to the server in case of post request.
15 |M.sc sem I OOPs USING JAVA
(6) cookies
A cookie is a small piece of information that is persisted between the multiple client requests.
A cookie has a name, a single value, and optional attributes such as a comment, path and domain qualifiers,
a maximum age, and a version number.
Types of Cookie
There are 2 types of cookies in servlets.
1. Non-persistent cookie
2. Persistent cookie
Non-persistent cookie
It is valid for single session only. It is removed each time when user closes the browser.
Persistent cookie
It is valid for multiple session . It is not removed each time when user closes the browser. It is removed
only if user logout or signout.
Advantage of Cookies
1. Simplest technique of maintaining the state.
2. Cookies are maintained at client side.
Disadvantage of Cookies
1. It will not work if cookie is disabled from the browser.
2. Only textual information can be set in Cookie object.
Note: Gmail uses cookie technique for login. If you disable the cookie, gmail won't work.
Cookie class
javax.servlet.http.Cookie class provides the functionality of using cookies. It provides a lot of useful
methods for cookies.
Constructor Description
Cookie(String name, String value) constructs a cookie with a specified name and value.
There are given some commonly used methods of the Cookie class.
Method Description
public void setMaxAge(int expiry) Sets the maximum age of the cookie in seconds.
public String getName() Returns the name of the cookie. The name cannot be changed after creation.
1. Cookie ck[]=request.getCookies();
2. for(int i=0;i<ck.length;i++){
3. out.print("<br>"+ck[i].getName()+" "+ck[i].getValue());//printing name and value of cookie
4. }
index.html
FirstServlet.java
1. import java.io.*;
2. import javax.servlet.*;
19 |M.sc sem I OOPs USING JAVA
3. import javax.servlet.http.*;
4.
5.
6. public class FirstServlet extends HttpServlet {
7.
8. public void doPost(HttpServletRequest request, HttpServletResponse response){
9. try{
10.
11. response.setContentType("text/html");
12. PrintWriter out = response.getWriter();
13.
14. String n=request.getParameter("userName");
15. out.print("Welcome "+n);
16.
17. Cookie ck=new Cookie("uname",n);//creating cookie object
18. response.addCookie(ck);//adding cookie in the response
19.
20. //creating submit button
21. out.print("<form action='servlet2'>");
22. out.print("<input type='submit' value='go'>");
23. out.print("</form>");
24.
25. out.close();
26.
27. }catch(Exception e){System.out.println(e);}
28. }
When we are targeting a web server, then the server will have an IP address, and we can access that IP
address directly on the internet. This attack will work if the person has a real IP and if the person is on the
same network. If we can ping the person, even if it's a personal computer, then we can run all of the attacks
and all of the information-gathering methods that we're going to learn about.
20 |M.sc sem I OOPs USING JAVA
We are going to be targeting our Metasploitable device. Before we start working on it, we will just check
the network settings. Just to verify it, it is set to NAT, and it is on the same network as the Kali machine.
This Kali machine is going to be our attacking machine. If we do ifconfig on the Metasploitable machine,
we will be able to see the IP address of it as shown in the following screenshot:
In the above screenshot, we can see that 10.0.2.4 is the IP of Metasploitable device. Now, if we go to Kali
machine, we should be able to ping it. In the following screenshot, we can see that when we ping on the
IP, we are getting responses back from the machine. Now, we can try and test its security as shown with
Again, we can use these attacks and these approaches against any computer that we can ping. Server-side
attacks work against a normal computer, websites, web servers, people, as long as we can ping them. Just
to convey this idea, we will see the Metasploitable machine. It is just a normal virtual machine that we can
use right here to do anything we want. Using the -ls command, we can list it, and we can even install a
graphical interface. Then we will be able to use it in the way we use in Kali machine. But it has a web server.
If we try to navigate to the server, we will see that it has websites that we can actually read and browse.
We're going to have a look at these websites and see how we can pen test them in the later chapters as
we can see in the following screenshot:
is a computer, and if we can ping the IP, we can use server-side attacks. These attacks mostly work against
server because server always has real IPs. If the person is in the same network as we are, then we can ping
them to do all of these attacks as well
**Http Session **
In such case, container creates a session id for each user.The container uses this id to identify the particular
user.An object of HttpSession can be used to perform two tasks:
1. bind objects
2. view and manipulate information about a session, such as the session identifier, creation time, and last
accessed time.
21 |M.sc sem I OOPs USING JAVA
The HttpServletRequest interface provides two methods to get the object of HttpSession:
1. public HttpSession getSession():Returns the current session associated with this request, or if the request
does not have a session, creates one.
2. public HttpSession getSession(boolean create):Returns the current HttpSession associated with this
request or, if there is no current session and create is true, returns a new session.
index.html
1. <form action="servlet1">
2. Name:<input type="text" name="userName"/><br/>
3. <input type="submit" value="go"/>
4. </form>
FirstServlet.java
1. import java.io.*;
2. import javax.servlet.*;
3. import javax.servlet.http.*;
4.
5.
6. public class FirstServlet extends HttpServlet {
7.
8. public void doGet(HttpServletRequest request, HttpServletResponse response){
22 |M.sc sem I OOPs USING JAVA
9. try{
10.
11. response.setContentType("text/html");
12. PrintWriter out = response.getWriter();
13.
14. String n=request.getParameter("userName");
15. out.print("Welcome "+n);
16.
17. HttpSession session=request.getSession();
18. session.setAttribute("uname",n);
19.
20. out.print("<a href='servlet2'>visit</a>");
21.
22. out.close();
23.
24. }catch(Exception e){System.out.println(e);}
25. }
26.
27. }
SecondServlet.java
1. import java.io.*;
2. import javax.servlet.*;
3. import javax.servlet.http.*;
4.
5. public class SecondServlet extends HttpServlet {
6.
7. public void doGet(HttpServletRequest request, HttpServletResponse response)
8. try{
9.
10. response.setContentType("text/html");
11. PrintWriter out = response.getWriter();
12.
13. HttpSession session=request.getSession(false);
14. String n=(String)session.getAttribute("uname");
15. out.print("Hello "+n);
16.
17. out.close();
18.
19. }catch(Exception e){System.out.println(e);}
23 |M.sc sem I OOPs USING JAVA
20. }
21.
22.
23. }
web.xml
1. <web-app>
2.
3. <servlet>
4. <servlet-name>s1</servlet-name>
5. <servlet-class>FirstServlet</servlet-class>
6. </servlet>
7.
8. <servlet-mapping>
9. <servlet-name>s1</servlet-name>
10. <url-pattern>/servlet1</url-pattern>
11. </servlet-mapping>
12.
13. <servlet>
14. <servlet-name>s2</servlet-name>
15. <servlet-class>SecondServlet</servlet-class>
16. </servlet>
17.
18. <servlet-mapping>
19. <servlet-name>s2</servlet-name>
20. <url-pattern>/servlet2</url-pattern>
21. </servlet-mapping>
22.
23. </web-app>
(8) Declarations
When we encounter declarations, we need to lay out storage for the declared variables.
For every local name in a procedure, we create a ST(Symbol Table) entry containing:
The production:
24 |M.sc sem I OOPs USING JAVA
1. D → integer, id
2. D → real, id
3. D → D1, id
ENTER is used to make the entry into symbol table and ATTR is used to trace the data type.
***Expressions****
Expressions
An expression is a formula in which operands are linked to each other by the use of operators to compute
a value. An operand can be a function reference, a variable, an array element or a constant.
1. a-b;
In the above expression, minus character (-) is an operator, and a, and b are the two operands.
o Arithmetic expressions
o Relational expressions
o Logical expressions
o Conditional expressions
25 |M.sc sem I OOPs USING JAVA
Each type of expression takes certain types of operands and uses a specific set of operators. Evaluation of
a particular expression produces a specific value.
For example:
1. x = 9/2 + a-b;
The entire above line is a statement, not an expression. The portion after the equal is an expression.
Arithmetic Expressions
An arithmetic expression is an expression that consists of operands and arithmetic operators. An arithmetic
expression computes a value of type int, float or double.
When an expression contains only integral operands, then it is known as pure integer expression when it
contains only real operands, it is known as pure real expression, and when it contains both integral and
real operands, it is known as mixed mode expression.
The expressions are evaluated by performing one operation at a time. The precedence and associativity of
operators decide the order of the evaluation of individual operations.
When individual operations are performed, the following cases can be happened:
o When both the operands are of type integer, then arithmetic will be performed, and the result of the
operation would be an integer value. For example, 3/2 will yield 1 not 1.5 as the fractional part is ignored.
o When both the operands are of type float, then arithmetic will be performed, and the result of the operation
would be a real value. For example, 2.0/2.0 will yield 1.0, not 1.
o If one operand is of type integer and another operand is of type real, then the mixed arithmetic will be
performed. In this case, the first operand is converted into a real operand, and then arithmetic is performed
26 |M.sc sem I OOPs USING JAVA
to produce the real value. For example, 6/2.0 will yield 3.0 as the first value of 6 is converted into 6.0 and then
arithmetic is performed to produce 3.0.
Relational Expressions
o A relational expression is an expression used to compare two operands.
o It is a condition which is used to decide whether the action should be taken or not.
o In relational expressions, a numeric value cannot be compared with the string value.
o The result of the relational expression can be either zero or non-zero value. Here, the zero value is equivalent
to a false and non-zero value is equivalent to true.
Relational Description
Expression
x%2 = = 0 This condition is used to check whether the x is an even number or not. The relational
expression results in value 1 if x is an even number otherwise results in value 0.
27 |M.sc sem I OOPs USING JAVA
a!=b It is used to check whether a is not equal to b. This relational expression results in 1 if a is
not equal to b otherwise 0.
a+b = = x+y It is used to check whether the expression "a+b" is equal to the expression "x+y".
1. #include <stdio.h>
2. int main()
3. {
4.
5. int x=4;
6. if(x%2==0)
7. {
8. printf("The number x is even");
9. }
10. else
11. printf("The number x is not even");
12. return 0;
13. }
Output
Logical Expressions
o A logical expression is an expression that computes either a zero or non-zero value.
o It is a complex test condition to take a decision.
Logical Description
Expressions
( x > 4 ) && ( x < 6 It is a test condition to check whether the x is greater than 4 and x is less than 6. The result
) of the condition is true only when both the conditions are true.
x > 10 || y <11 It is a test condition used to check whether x is greater than 10 or y is less than 11. The
result of the test condition is true if either of the conditions holds true value.
28 |M.sc sem I OOPs USING JAVA
! ( x > 10 ) && ( y = It is a test condition used to check whether x is not greater than 10 and y is equal to 2. The
=2) result of the condition is true if both the conditions are true.
1. #include <stdio.h>
2. int main()
3. {
4. int x = 4;
5. int y = 10;
6. if ( (x <10) && (y>5))
7. {
8. printf("Condition is true");
9. }
10. else
11. printf("Condition is false");
12. return 0;
13. }
Output
1. #include <stdio.h>
2. int main()
3. {
4. int x = 4;
5. int y = 9;
6. if ( (x <6) || (y>10))
7. {
8. printf("Condition is true");
9. }
10. else
11. printf("Condition is false");
12. return 0;
13. }
Output
Conditional Expressions
o A conditional expression is an expression that returns 1 if the condition is true otherwise 0.
29 |M.sc sem I OOPs USING JAVA
The above expression is a conditional expression which is evaluated on the basis of the value of the exp1
expression. If the condition of the expression exp1 holds true, then the final conditional expression is
represented by exp2 otherwise represented by exp3.
1. #include<stdio.h>
2. #include<string.h>
3. int main()
4. {
5. int age = 25;
6. char status;
7. status = (age>22) ? 'M': 'U';
8. if(status == 'M')
9. printf("Married");
10. else
11. printf("Unmarried");
12. return 0;
13. }
Output
The JSP Standard Tag Library (JSTL) represents a set of tags to simplify the JSP development.
Advantage of JSTL
1. Fast Development JSTL provides many tags that simplify the JSP.
2. Code Reusability We can use the JSTL tags on various pages.
3. No need to use scriptlet tag It avoids the use of scriptlet tag.
30 |M.sc sem I OOPs USING JAVA
JSTL Tags
There JSTL mainly provides five types of tags:
Core tags The JSTL core tag provide variable support, URL management, flow control, etc. The URL for the
core tag is http://java.sun.com/jsp/jstl/core. The prefix of core tag is c.
Function The functions tags provide support for string manipulation and string length. The URL for the
tags functions tags is http://java.sun.com/jsp/jstl/functions and prefix is fn.
Formatting The Formatting tags provide support for message formatting, number and date formatting, etc.
tags The URL for the Formatting tags is http://java.sun.com/jsp/jstl/fmt and prefix is fmt.
XML tags The XML tags provide flow control, transformation, etc. The URL for the XML tags
is http://java.sun.com/jsp/jstl/xml and prefix is x.
SQL tags The JSTL SQL tags provide SQL support. The URL for the SQL tags
is http://java.sun.com/jsp/jstl/sql and prefix is sql.
For creating JSTL application, you need to load the jstl.jar file.
c:out It display the result of an expression, similar to the way <%=...%> tag work.
c:import It Retrives relative or an absolute URL and display the contents to either a String in
'var',a Reader in 'varReader' or the page.
c:remove It is used for removing the specified scoped variable from a particular scope.
31 |M.sc sem I OOPs USING JAVA
c:catch It is used for Catches any Throwable exceptions that occurs in the body.
c:if It is conditional tag used for testing the condition and display the body content only if
the expression evaluates is true.
c:choose, c:when, It is the simple conditional tag that includes its body content if the evaluated condition
c:otherwise is true.
c:forEach It is the basic iteration tag. It repeats the nested body content for fixed number of times
or over collection.
c:redirect It redirects the browser to a new URL and supports the context-relative URLs.
JDK is an implementation of any one of the below given Java Platforms released by Oracle corporation:
The JDK contains a private Java Virtual Machine (JVM) and a few other resources such as an
interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc) etc. to
complete the development of a Java Application.
32 |M.sc sem I OOPs USING JAVA
Components of JDK
Following is a list of primary components of JDK:
appletviewer: This tool is used to run and debug Java applets without a web browser.
idlj: An IDL-to-Java compiler. This utility generates Java bindings from a given Java IDL file.
jabswitch: It is a Java Access Bridge. Exposes assistive technologies on Microsoft Windows systems.
java: The loader for Java applications. This tool is an interpreter and can interpret the class files
generated by the javac compiler. Now a single launcher is used for both development and
deployment. The old deployment launcher, jre, no longer comes with Sun JDK, and instead it
has been replaced by this new java loader.
javac: It specifies the Java compiler, which converts source code into Java bytecode.
javadoc: The documentation generator, which automatically generates documentation from source
code comments
jar: The specifies the archiver, which packages related class libraries into a single JAR file. This tool
also helps manage JAR files.
javah: the C header and stub generator, used to write native methods.
jinfo: This utility gets configuration information from a running Java process or crash dump.
jmap: Oracle jmap - Memory Map- This utility outputs the memory map for Java and can print shared
object memory maps or heap memory details of a given process or core dump.
jps: Java Virtual Machine Process Status Tool lists the instrumented HotSpot Java Virtual Machines
(JVMs) on the target system.
jstack: It is a utility that prints Java stack traces of Java threads (experimental).
Policytool: It specifies the policy creation and management tool, which can determine policy for a Java
runtime, specifying which permissions are available for code from various sources.
VisualVM: It is a visual tool integrating several command-line JDK tools and lightweight [clarification
needed] performance and memory profiling capabilities
xjc: It is the part of the Java API for XML Binding (JAXB) API. It accepts an XML schema and
generates Java classes.