Header Ads Widget

Responsive Advertisement

How to write down all jar files name in text format in lib folder

Here’s how you can list all JAR files in a lib folder and write them to a text file using the Command Prompt for Windows and the terminal for Linux:

For Windows:

  1. Open Command Prompt:

Ø  Press Win + R, type cmd, and hit Enter.

  1. Navigate to the lib Folder: Use the cd command to go to the directory containing your lib folder. For example, if the lib folder is in C:\Projects\MyApp, you would type:

bash

cd path\to\your\lib

 

Example:

cd C:\Projects\MyApp\lib

 

  1. List All JAR Files and Write to a Text File: Use the dir command with redirection (>) to write the names of all .jar files into a text file. Here's the command:

bash

dir /b *.jar > jar-files.txt

 

Example:

dir /b *.jar > jarlist.txt

 

Ø  dir /b: Lists only the filenames (without extra details like size or date).

Ø  *.jar: Filters only JAR files.

Ø  > jarlist.txt: Redirects the output to a file named jarlist.txt in the current directory.

  1. Open the Output File: After running the command, you'll have a jarlist.txt file in your lib folder containing the list of all JAR files.

Example:

If you have JAR files like example1.jar, example2.jar, the contents of jarlist.txt will look like this:

example1.jar

example2.jar

 


For Linux:

  1. Open Terminal:

Ø  You can open a terminal using Ctrl + Alt + T.

  1. Navigate to the lib Directory:

Ø  Use the cd command to move to your lib directory. For example:

bash

cd /path/to/your/lib

 

  1. List All JAR Files and Write to a Text File:

Ø  Use the ls command:

bash

ls *.jar > jar-files.txt

 

Ø  Explanation:

ü  ls *.jar: This lists all .jar files in the current folder.

ü  > jar-files.txt: This redirects the output to a text file named jar-files.txt.

  1. Check the jar-files.txt File:

Ø  The file jar-files.txt will be created in the lib directory with the list of all .jar files.

Both methods work similarly across Windows and Linux, allowing you to easily export a list of JAR files to a text file.

  

Post a Comment

0 Comments