public static File createJarPackage ( IResource resource ) { JarModule jarModule = new JarModule ( resource ) ; try { PlatformUI . getWorkbench ( ) . getProgressService ( ) . run ( false , true , jarModule ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } File jarFile = jarModule . getJarFile ( ) ; if ( jarFile == null ) { ErrorMessageDialog . display ( "Run on Hadoop" , "Unable to create or locate the JAR file for the Job" ) ; return null ; } return jarFile ; }
Static way to create a JAR package for the given resource and showing a progress bar