The below batch script helps to read the selected trailing lines from Log File

@echo off
setlocal EnableDelayedExpansion
set "cmd=findstr /R /N "^^" C:\Users\Mugil\Desktop\test.txt | find /C ":""

for /f %%a in ('!cmd!') do set totalLines=%%a
rem echo "totalLines-"%totalLines%

@set linesToConsider=4
set /a lineToStart="%totalLines%-%linesToConsider%" 

rem echo "lineToStart-"%lineToStart%

set content=
for /f "skip=%lineToStart% delims=" %%i in ('type C:\Users\Mugil\Desktop\test.txt') do set content=!content! %%i

@echo "content - "%content%

If NOT "%content%"=="%content:SUCCESS=%" (
    echo Build Successful
) else (
    echo Build Failed


1.Compile the Files which should be added.


Incase you are working in eclipse the same thing can be seen under the bin directory in the Navigator need to navigate to the folder to access the class files.

Incase if you are going to run the jar file the main class which should be called should be added to JAR file as meta-data through META-DATA/MANIFEST.There should be a Carriage Return Empty line in Manifest.txt to get read properly


Main-Class: com.mugil.util.Test

3.Create JAR file using the Below command

jar cfm Test.jar manifest.txt com/mugil/util/*

The Above command should be executed from bin directory in our case

* specifies the list of all files in that folder

4.To Run this JAR file

 java -jar Test.jar

When you run the Created Jar file it should be exactly placed in the folder from where the com folder starts.

jar cfm Test.jar manifest.txt com/mugil/util/*

The letters “m” and “f” must appear in the same order that “manifest” and “jarfile” appear.

It is a metadata file that contains name-value pairs organized in different sections.

If a JAR file is intended to be used as an executable file, the manifest file specifies the main class of the application. The manifest file is named MANIFEST.MF

Other uses are:

  1. store hashes of stored files for signature validation
  2. sealing jar files (i.e. ensure that only classes from this jar file are loaded in the packages defined in this jar file).
  3. store version/product/producer information to be readable at runtime

The Main class to be called once the JAR is executed is defined as below

If an application is bundled in a JAR file, the Java Virtual Machine needs to be told what the entry point to the application is. An entry point is any class with a public static void main(String[] args) method

Manifest-Version: 1.0
Main-Class: com.mugil.util.Test