Call jar file from a java program


Complete source code below will show you, how to open or call a jar file (java executable file) from a java program.

Download MyJarFile.jar that will use in this tutorial.Place this file at the same location with java file below before compile and execute it.

*********************************************************************
COMPLETE SOURCE CODE FOR : CallJarFile.java
*********************************************************************


import java.awt.Desktop;

import java.io.File;

public class CallJarFile
{
public static void main(String[]args)
{
try
{
//Call MyJarFile.jar
Desktop.getDesktop().open(new File("MyJarFile.jar"));
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}


*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************

RELAXING NATURE VIDEO