org.eclipse.ui.jarpackager ÆÐŰÁö´Â ÇÁ·Î±×·¡¹ÖÇÏ¿© ÆÄÀÏÀ» Jar ÆÄÀÏ·Î ³»º¸³»´Â À¯Æ¿¸®Æ¼¸¦ Á¦°øÇÕ´Ï´Ù. ´ÙÀ½Àº JarPackageData Ŭ·¡½ºÀÇ »ç¿ëÀ» ´ë·«ÀûÀ¸·Î ¼³¸íÇÏ´Â ÄÚµå ½º´ÏÆêÀÔ´Ï´Ù.
void createJar(IType mainType, IFile[] filestoExport) {
Shell parentShell= ...;
JarPackageData description= new JarPackageData();
IPath location= new Path("C:/tmp/myjar.jar");
description.setJarLocation(location);
description.setSaveManifest(true);
description.setManifestMainClass(mainType);
description.setElements(filestoExport);
IJarExportRunnable runnable= description.createJarExportRunnable(parentShell);
try {
new ProgressMonitorDialog(parentShell).run(true,true, runnable);
} catch (InvocationTargetException e) {
// An error has occurred while executing the operation
} catch (InterruptedException e) {
// operation has been canceled.
}
}
JarPackageDataÀÇ Ç÷¯±×ÀΠƯÁ¤ ¼ºêŬ·¡½º¸¦ ÀÛ¼ºÇϱâ À§ÇÑ Ãß°¡ API°¡ Á¦°øµË´Ï´Ù. ÀÌ API¸¦ »ç¿ëÇÏ¿© ´Ù¸¥ Ç÷¯±×ÀÎÀº ÀÚ½ÅÀÇ Jar ³»º¸³»±â/°¡Á®¿À±â ¸¶¹ý»ç¸¦ ±¸ÇöÇϰí JarPackageData ¿ÀºêÁ§Æ®ÀÇ ÄÁÅÙÃ÷¸¦ ÇØ´ç Jar ¼³¸í ÆÄÀÏ¿¡ ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù.
JARÀÌ JarPackageData¸¦ ÅëÇØ ¼³¸íµÇ¸é JarWriter¸¦ »ç¿ëÇÏ¿© ÇÁ·Î±×·¥¿¡ µû¶ó ÀÛ¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.