WAY TO INCLUDE EXTERNAL JAR FILES(LIB)INSIDE PROJECT JAR
WAY TO INCLUDE EXTERNAL JAR FILES(LIB)IN PROJECT JAR
when we create a project using net beans IDE the jar will be created automatically inside a dist folder which will be located inside the project folder itself .But this JAR will not contain the external jars which you have added for your projects.(jars inside the library folder).
You can create a project jar that includes the external jars using the following step:
1.Go to the project folder which you have created using netbeans IDE.
2.create a new folder named 'NewDist' inside the project folder directory.
3.create a file named 'JarMaker.bat' in the folder which you craeted(NewDist).
4.copy the below code in the file.
Code:
-------
@echo off
echo * -------------------------------------------------------- *
echo * - JarMaker V 2.0.0 - For Netbeans Projects - *
echo * -------------------------------------------------------- *
echo 1) Creating Temporary Directory
mkdir classes
echo 2) Copying Library Jars
xcopy /s /y ..\dist\lib\*.jar classes >> nul
cd classes
echo 3) Deflating Library Jars (this may take a while)
for /f %%a IN ('dir /b *.jar') do jar xf %%a >> nul
del *.jar >> nul
cd ..
echo 4) Deflating Main Program Jar
xcopy /y ..\dist\*.jar classes >> nul
cd classes
for /f %%a IN ('dir /b *.jar') do jar xf %%a >> nul
del *.jar >> nul
echo 5) Creating Unique Jar (this may take a while)
jar cvfm ../dist.jar META-INF/manifest.mf ./ >> nul
for /f %%a IN ('dir /b ..\..\dist\*.jar') do ren ..\dist.jar %%a >> nul
cd ..
echo 6) Removing Temporary Files
rmdir /s /q classes >> nul
echo * -------------------------------------------------------- *
echo * - JarMaker V 2.0.0 - Process Complete - *
echo * -------------------------------------------------------- *
5.Just double click on the file and wait...
At the end of the process a file named YourProjectName.jar will be created inside 'NewDist' directory.
5.This jar will include your external jars which you have added in Library folder
Comments
Post a Comment