CE 232 - Week 10 - Unit 6 - Java Utilities - JAR Files 2024 Final
CE 232 - Week 10 - Unit 6 - Java Utilities - JAR Files 2024 Final
Java archive (jar) files are compressed files that can store one or
many files.
Jar files normally contain java or class files, but other files may
also be included.
Jar files can be run on Windows by double clicking jar files if the
JVM is installed.
WHY USE A JAR FILE?
For example, using the applet tag for your Foo.jar archive, you would use
the following:
<applet code=TicTacToe.class
archive=”Foo.jar"
width=120 height=120>
</applet>
CREATING JAR FILES: ADVANCED METHOD
The more formal and complete way to create a jar file is described in the
following slides.
Note that the more complex your process, the more difficulty a
beginning Java user is going to have with it.
CREATE MANIFEST.MF
Create a new notepad file named manifest.mf. This file contains a signal
line that points out the main class. Here is the signal line.
Main-Class:<Space>name of main class
<blank line>
Blank line must be included because some Windows OS versions need it.
For example: myClass is my main Class. So manifest.mf is following.
Main-Class: myClass
<blank line is here>
JAR FILE AND JAR COMMANDS
Next, create a jar file using the “jar” command in java. Here is the
command.
jar cvmf <the jar file name>.jar manifest.mf A.class
B.class……..
There are spaces between each file and class name.
Here are the basic jar commands
Create Jar file => jar cf jar-file input-file
View Jar file => jar tf jar-file
Extract Jar file => jar xf jar-file
JAR SUBDIRECTORIES
Java is one of the best languages for AI projects. Its infrastructure is well
embedded with intelligent software to enhance AI programming. It has
amazing features like better interaction with users, ease of debugging,
easy-to-code features, standard widget tools, and a lot more. The use of
Java just brings perfection to the Artificial Intelligence process.
WEB APPLICATIONS
Java is just perfect for developing web applications because of its ability to interact
with a large number of systems. It allows us to create dynamic web applications that
interact with interfaces. The presence of JSP, web servers, spring, and Hibernate
provides feasibility in the web development process. There are several advantages of
using Java for web development:
Presence of a wide range of APIs
Excellent IDEs and tools
Reusability of code
Enhanced security features
BIG DATA TECHNOLOGY
From the top 10 list of java application, choose one application and conduct a small
research. In your findings, write about it: what it is? Advantages, Disadvantages (if any).
Future improvements.Your personal conclusion.
Submission date: 10th January 2024 (during lecture)
Format: printed document not more than 5 pages, 12 font size, Times New Roman,
double space.
THANK YOU!
Any questions?
TUTORIAL SESSION
class Main {
public static void main(String[] args) {
if(a!=0.0){
double d = (b*b)-(4*a*c);
if (d==0.0){
System.out.println("The roots are real and equal.");
double r = -b/(2*a);
TUTORIAL SESSION
System.out.println("The roots are "+ r+"and"+ r);
}else if(d>0.0){
System.out.println("The roots are real and distinct.");
double r1 = (-b+(Math.sqrt(d)))/(2*a);
double r2 = (-b-(Math.sqrt(d)))/(2*a);
System.out.println("The root1 is: "+ r1);
System.out.println("The root2 is: "+ r2);
}else{
System.out.println("The roots are imaginary.");
double rp = -b/(2*a);
double ip = Math.sqrt(-d)/(2*a);
System.out.println("The root1 is: "+ rp+ "+ i"+ip);
System.out.println("The root2 is: "+ rp+ "- i"+ip);
}
}else{
System.out.println("Not a quadratic equation.");
}
}
}
TUTORIAL SESSION
Java program to print the numbers from a given number n till 0 using recursion
TUTORIAL SESSION
class Main {
public static void main(String[] args) {
print_till_zero(8);
class Main {
public static void main(String[] args) {