SlideShare a Scribd company logo
1 of 18
Object Oriented
Programming – Java
By Daniel :
- javac
-java
-javah
-javadoc
-appletviewer
javac
 javac stands for Java Compiler
 The javac tool reads class and interface definitions, written in the Java
programming language, and compiles them into bytecode class files.
 There are two ways to pass source code file names to javac:
o For a small number of source files, simply list the file names on the
command line.
o For a large number of source files, list the file names in a file,
separated by blanks or line breaks.
javac (Cont..)
 Source code file names must have .java suffixes, class file names must have .class
suffixes, and both source and class files must have root names that identify the class.
For example, a class called MyClass would be written in a source file called
MyClass.java and compiled into a bytecode class file called MyClass.class.
 Inner class definitions produce additional class files. These class files have names
combining the inner and outer class names, such as MyClass$MyInnerClass.class.
 You should arrange source files in a directory tree that reflects their package tree. For
example, if you keep all your source files in /workspace, the source code for
com.mysoft.mypack.MyClass should be in
/workspace/com/mysoft/mypack/MyClass.java.
 By default, the compiler puts each class file in the same directory as its source file. You
can specify a separate destination directory with -d option
After using the javac command
as follow:
$ Javac car.java
We get car.class file ready to
be used by the launcher
(Car.class)
The work of the javac
javac
Sets the destination directory for class files. The
destination directory must already exist; javac will not
create the destination directory.
If a class is part of a package, javac puts the class file in a
subdirectory reflecting the package name, creating
directories as needed.
For example, if you specify -d /home/myclasses and the
class is called com.mypackage.MyClass, then the class
file is called
/home/myclasses/com/mypackage/MyClass.class.
java
java - Java application launcher
 The java tool launches a Java application. It does this by starting a Java
runtime environment, loading a specified class, and invoking that class's main
method.
 The method must be declared public and static , it must not return any value, and
it must accept a String array as a parameter. The method declaration must look
like the following: public static void main(String dims[]) By default, the first
non-option argument is the name of the class to be invoked.
 A fully-qualified class name should be used. If the -jar option is specified, the
first non-option argument is the name of a JAR archive containing class and
resource files for the application, with the startup class indicated by the Main-
Class manifest header.
 The Java runtime searches for the startup class, and other classes used, in three
sets of locations: the bootstrap class path, the installed extensions, and the user
class path. Non-option arguments after the class name or JAR file name are passed
to the main function.
What does the java launcher do?
java is called as ‘java launcher because It does this by starting a Java
runtime environment, loading a specified class, and invoking that class's
main method. This method must have the following signature: public static
void main(String[]). It has to be static and public. This means that it’ll have
the job of loading the .class file and making it ready for execution by the
Java Virtual Machine (JVM).
$ java runCar --runCar if the class with the main method:
javah
javah - C header and stub file generator
 The javah command generates C header and source files that
are needed to implement native methods. The generated
header and source files are used by C programs to reference
instance variables of an object from native source code. The
.h file contains a structure definition whose layout parallels
that of the corresponding class. The fields in the structure
correspond to instance variables in the class.
 The name of the header file and the structure declared
within it are derived from the name of the class. If the class
passed to javah is inside a package, the package name is
prepended to both the header file name and the structure
name. Underscores ( _ ) are used as name delimiters.
Javah (cont..)
 By default, javah creates a header file for each class listed on
the command line and puts the files in the current directory.
Use the -stubs option to create source files. Use the -o
option to concatenate the results for all listed classes into a
single file.
 The new native method interface, Java Native Interface
(JNI), does not require header information or stub files. The
javah command can still be used to generate native method
function prototypes needed for JNI-style native methods.
javah produces JNI-style output by default, and places the
result in the .h file.
 The javah_g version is a non-optimized version of javah
suitable for use with debuggers like jdb.
$ Javah runCar
This will create an header file for the class runCar that
can help in implementing the java code in C language. And
this command must be done on the class with the main
method, for our case now it is runCar.
After $ javah runCar we get:
Now we’ll try viewing what contained in the runCar.h file
$ cat runCar.h
This is how the runCar.h file looks like. Interesting, isn’t it?
javadoc
javadoc - Java API documentation generator
 The Javadoc tool parses the declarations and documentation comments
in a set of Java source files and produces a corresponding set of HTML
pages describing (by default) the public and protected classes, nested
classes (but not anonymous inner classes), interfaces, constructors,
methods, and fields.
 You can run the Javadoc tool on entire packages, individual source files,
or both. In the first case, you pass in as an argument to javadoc a series
of package names. In the second case, you pass in a series of source
(.java) file names. See EXAMPLES at the end of this document.
 NOTE - When you pass in package names to the Javadoc tool, it
currently processes all .java classes in the specified package directories,
even if the
 java files are code examples or other classes that are not actually
members of the specified packages. It does not parse each .java file for
a package declaration; we may add this parsing in a future release.
javadoc (cont..)
During a run, the Javadoc tool automatically adds cross-
reference links to package, class and member names that are
being documented as part of that run. Links appear in several
places:
o Declarations (return types, argument types, field types)
o "See Also" sections generated from @see tags
o In-line text generated from {@link} tags
o Exception names generated from @throws tags
o Specified by links to members in interfaces and Overrides links
to members in classes
o Summary tables listing packages, classes and members
o Package and class inheritance trees
This is an example of a javadoc
class. Note that all the method
and classes are public in
nature. The comments starts as
/** and ends with */. To
generate documentation for
this code, do:
$ Javadoc MyClass.java
The documentation to
generated is per java standards
of documentation.
MyClass.java
After :
$ Javadoc MyClass.java
You should see:
Now our java documentation MyClass.html is ready to use:
appletviewer
appletviewer - Java applet viewer
The appletviewer command connects to the documents or
resources designated by urls and displays each applet referenced
by that document in its own window.
Note:
if the documents referred to by urls do not reference any applets
with the OBJECT, EMBED, or APPLET tag, appletviewer does
nothing. For details on the HTML tags that appletviewer
supports, see
http://java.sun.com/j2se/1.5.0/docs/tooldocs/appletviewertags
.html.
Command:
$ appletviewer MyClass.html
Thank you!
By Daniel Ilunga

More Related Content

What's hot

Consuming Libraries with CMake
Consuming Libraries with CMakeConsuming Libraries with CMake
Consuming Libraries with CMakeRichard Thomson
 
Unit2 java
Unit2 javaUnit2 java
Unit2 javamrecedu
 
JLIFF, Creating a JSON Serialization of OASIS XLIFF
JLIFF, Creating a JSON Serialization of OASIS XLIFFJLIFF, Creating a JSON Serialization of OASIS XLIFF
JLIFF, Creating a JSON Serialization of OASIS XLIFFDavid Filip
 
Ch23 xml processing_with_java
Ch23 xml processing_with_javaCh23 xml processing_with_java
Ch23 xml processing_with_javaardnetij
 
Unit3 packages & interfaces
Unit3 packages & interfacesUnit3 packages & interfaces
Unit3 packages & interfacesKalai Selvi
 
Object oriented programming in php 5
Object oriented programming in php 5Object oriented programming in php 5
Object oriented programming in php 5Sayed Ahmed
 
Java non access modifiers
Java non access modifiersJava non access modifiers
Java non access modifiersSrinivas Reddy
 
05 J2ME Wtk Command Line
05 J2ME Wtk Command Line05 J2ME Wtk Command Line
05 J2ME Wtk Command Linecorneliuskoo
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To AntRajesh Kumar
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, SerializationPawanMM
 
Oracle DBA interview_questions
Oracle DBA interview_questionsOracle DBA interview_questions
Oracle DBA interview_questionsNaveen P
 
Packages(9 cm604.26)
Packages(9 cm604.26)Packages(9 cm604.26)
Packages(9 cm604.26)myrajendra
 
Session 23 - JDBC
Session 23 - JDBCSession 23 - JDBC
Session 23 - JDBCPawanMM
 
3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivityweb360
 
Hdfs connector api
Hdfs connector apiHdfs connector api
Hdfs connector apiThang Loi
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in phpCPD INDIA
 

What's hot (20)

Consuming Libraries with CMake
Consuming Libraries with CMakeConsuming Libraries with CMake
Consuming Libraries with CMake
 
Unit2 java
Unit2 javaUnit2 java
Unit2 java
 
Access modifiers
Access modifiersAccess modifiers
Access modifiers
 
File class.48
File class.48File class.48
File class.48
 
JLIFF, Creating a JSON Serialization of OASIS XLIFF
JLIFF, Creating a JSON Serialization of OASIS XLIFFJLIFF, Creating a JSON Serialization of OASIS XLIFF
JLIFF, Creating a JSON Serialization of OASIS XLIFF
 
Ch23 xml processing_with_java
Ch23 xml processing_with_javaCh23 xml processing_with_java
Ch23 xml processing_with_java
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
Unit3 packages & interfaces
Unit3 packages & interfacesUnit3 packages & interfaces
Unit3 packages & interfaces
 
Object oriented programming in php 5
Object oriented programming in php 5Object oriented programming in php 5
Object oriented programming in php 5
 
Java non access modifiers
Java non access modifiersJava non access modifiers
Java non access modifiers
 
05 J2ME Wtk Command Line
05 J2ME Wtk Command Line05 J2ME Wtk Command Line
05 J2ME Wtk Command Line
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 
ACLs
ACLsACLs
ACLs
 
Session 22 - Java IO, Serialization
Session 22 - Java IO, SerializationSession 22 - Java IO, Serialization
Session 22 - Java IO, Serialization
 
Oracle DBA interview_questions
Oracle DBA interview_questionsOracle DBA interview_questions
Oracle DBA interview_questions
 
Packages(9 cm604.26)
Packages(9 cm604.26)Packages(9 cm604.26)
Packages(9 cm604.26)
 
Session 23 - JDBC
Session 23 - JDBCSession 23 - JDBC
Session 23 - JDBC
 
3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivity
 
Hdfs connector api
Hdfs connector apiHdfs connector api
Hdfs connector api
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 

Viewers also liked

Viewers also liked (6)

Features of java
Features of javaFeatures of java
Features of java
 
Features of java
Features of javaFeatures of java
Features of java
 
Java features
Java featuresJava features
Java features
 
Steganography Project
Steganography Project Steganography Project
Steganography Project
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 

Similar to Object Oriented Programming - Java (20)

Java packages
Java packagesJava packages
Java packages
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Packages and interface
Packages and interfacePackages and interface
Packages and interface
 
Java basics
Java basicsJava basics
Java basics
 
Class notes(week 7) on packages
Class notes(week 7) on packagesClass notes(week 7) on packages
Class notes(week 7) on packages
 
Javapackages 4th semester
Javapackages 4th semesterJavapackages 4th semester
Javapackages 4th semester
 
Java packages
Java packagesJava packages
Java packages
 
Java package
Java packageJava package
Java package
 
javapackage
javapackagejavapackage
javapackage
 
How to run java program without IDE
How to run java program without IDEHow to run java program without IDE
How to run java program without IDE
 
Java Packages
Java Packages Java Packages
Java Packages
 
Package in Java
Package in JavaPackage in Java
Package in Java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Scala presentationjune112011
Scala presentationjune112011Scala presentationjune112011
Scala presentationjune112011
 
Packages
PackagesPackages
Packages
 
20-packages-jar.ppt
20-packages-jar.ppt20-packages-jar.ppt
20-packages-jar.ppt
 
Java package
Java packageJava package
Java package
 
Lecture-12 Java Packages and GUI Basics.ppt
Lecture-12 Java Packages and GUI Basics.pptLecture-12 Java Packages and GUI Basics.ppt
Lecture-12 Java Packages and GUI Basics.ppt
 
Prg421
Prg421Prg421
Prg421
 
Class loader basic
Class loader basicClass loader basic
Class loader basic
 

More from Daniel Ilunga

Leadership seminar presentation - Daniel Ilunga
Leadership seminar presentation - Daniel IlungaLeadership seminar presentation - Daniel Ilunga
Leadership seminar presentation - Daniel IlungaDaniel Ilunga
 
GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsDaniel Ilunga
 
Third parties are actively seeking out end-user information using Facebook
Third parties are actively seeking out end-user information using FacebookThird parties are actively seeking out end-user information using Facebook
Third parties are actively seeking out end-user information using FacebookDaniel Ilunga
 
DMA controller intel 8257
DMA controller intel 8257DMA controller intel 8257
DMA controller intel 8257Daniel Ilunga
 

More from Daniel Ilunga (6)

Leadership seminar presentation - Daniel Ilunga
Leadership seminar presentation - Daniel IlungaLeadership seminar presentation - Daniel Ilunga
Leadership seminar presentation - Daniel Ilunga
 
GCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programsGCC Compiler as a Performance Testing tool for C programs
GCC Compiler as a Performance Testing tool for C programs
 
Six sigma
Six sigmaSix sigma
Six sigma
 
Memory management
Memory managementMemory management
Memory management
 
Third parties are actively seeking out end-user information using Facebook
Third parties are actively seeking out end-user information using FacebookThird parties are actively seeking out end-user information using Facebook
Third parties are actively seeking out end-user information using Facebook
 
DMA controller intel 8257
DMA controller intel 8257DMA controller intel 8257
DMA controller intel 8257
 

Recently uploaded

ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

Recently uploaded (20)

YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 

Object Oriented Programming - Java

  • 1. Object Oriented Programming – Java By Daniel : - javac -java -javah -javadoc -appletviewer
  • 2. javac  javac stands for Java Compiler  The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.  There are two ways to pass source code file names to javac: o For a small number of source files, simply list the file names on the command line. o For a large number of source files, list the file names in a file, separated by blanks or line breaks.
  • 3. javac (Cont..)  Source code file names must have .java suffixes, class file names must have .class suffixes, and both source and class files must have root names that identify the class. For example, a class called MyClass would be written in a source file called MyClass.java and compiled into a bytecode class file called MyClass.class.  Inner class definitions produce additional class files. These class files have names combining the inner and outer class names, such as MyClass$MyInnerClass.class.  You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files in /workspace, the source code for com.mysoft.mypack.MyClass should be in /workspace/com/mysoft/mypack/MyClass.java.  By default, the compiler puts each class file in the same directory as its source file. You can specify a separate destination directory with -d option
  • 4. After using the javac command as follow: $ Javac car.java We get car.class file ready to be used by the launcher (Car.class) The work of the javac
  • 5. javac Sets the destination directory for class files. The destination directory must already exist; javac will not create the destination directory. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -d /home/myclasses and the class is called com.mypackage.MyClass, then the class file is called /home/myclasses/com/mypackage/MyClass.class.
  • 6. java java - Java application launcher  The java tool launches a Java application. It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method.  The method must be declared public and static , it must not return any value, and it must accept a String array as a parameter. The method declaration must look like the following: public static void main(String dims[]) By default, the first non-option argument is the name of the class to be invoked.  A fully-qualified class name should be used. If the -jar option is specified, the first non-option argument is the name of a JAR archive containing class and resource files for the application, with the startup class indicated by the Main- Class manifest header.  The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path. Non-option arguments after the class name or JAR file name are passed to the main function.
  • 7. What does the java launcher do? java is called as ‘java launcher because It does this by starting a Java runtime environment, loading a specified class, and invoking that class's main method. This method must have the following signature: public static void main(String[]). It has to be static and public. This means that it’ll have the job of loading the .class file and making it ready for execution by the Java Virtual Machine (JVM). $ java runCar --runCar if the class with the main method:
  • 8. javah javah - C header and stub file generator  The javah command generates C header and source files that are needed to implement native methods. The generated header and source files are used by C programs to reference instance variables of an object from native source code. The .h file contains a structure definition whose layout parallels that of the corresponding class. The fields in the structure correspond to instance variables in the class.  The name of the header file and the structure declared within it are derived from the name of the class. If the class passed to javah is inside a package, the package name is prepended to both the header file name and the structure name. Underscores ( _ ) are used as name delimiters.
  • 9. Javah (cont..)  By default, javah creates a header file for each class listed on the command line and puts the files in the current directory. Use the -stubs option to create source files. Use the -o option to concatenate the results for all listed classes into a single file.  The new native method interface, Java Native Interface (JNI), does not require header information or stub files. The javah command can still be used to generate native method function prototypes needed for JNI-style native methods. javah produces JNI-style output by default, and places the result in the .h file.  The javah_g version is a non-optimized version of javah suitable for use with debuggers like jdb.
  • 10. $ Javah runCar This will create an header file for the class runCar that can help in implementing the java code in C language. And this command must be done on the class with the main method, for our case now it is runCar. After $ javah runCar we get:
  • 11. Now we’ll try viewing what contained in the runCar.h file $ cat runCar.h This is how the runCar.h file looks like. Interesting, isn’t it?
  • 12. javadoc javadoc - Java API documentation generator  The Javadoc tool parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages describing (by default) the public and protected classes, nested classes (but not anonymous inner classes), interfaces, constructors, methods, and fields.  You can run the Javadoc tool on entire packages, individual source files, or both. In the first case, you pass in as an argument to javadoc a series of package names. In the second case, you pass in a series of source (.java) file names. See EXAMPLES at the end of this document.  NOTE - When you pass in package names to the Javadoc tool, it currently processes all .java classes in the specified package directories, even if the  java files are code examples or other classes that are not actually members of the specified packages. It does not parse each .java file for a package declaration; we may add this parsing in a future release.
  • 13. javadoc (cont..) During a run, the Javadoc tool automatically adds cross- reference links to package, class and member names that are being documented as part of that run. Links appear in several places: o Declarations (return types, argument types, field types) o "See Also" sections generated from @see tags o In-line text generated from {@link} tags o Exception names generated from @throws tags o Specified by links to members in interfaces and Overrides links to members in classes o Summary tables listing packages, classes and members o Package and class inheritance trees
  • 14. This is an example of a javadoc class. Note that all the method and classes are public in nature. The comments starts as /** and ends with */. To generate documentation for this code, do: $ Javadoc MyClass.java The documentation to generated is per java standards of documentation. MyClass.java
  • 15. After : $ Javadoc MyClass.java You should see:
  • 16. Now our java documentation MyClass.html is ready to use:
  • 17. appletviewer appletviewer - Java applet viewer The appletviewer command connects to the documents or resources designated by urls and displays each applet referenced by that document in its own window. Note: if the documents referred to by urls do not reference any applets with the OBJECT, EMBED, or APPLET tag, appletviewer does nothing. For details on the HTML tags that appletviewer supports, see http://java.sun.com/j2se/1.5.0/docs/tooldocs/appletviewertags .html. Command: $ appletviewer MyClass.html