Package java.util.jar

Examples of java.util.jar.Manifest


      File file = new File(userDir, "jboss-messaging.jar");
      assertTrue(file.exists());

      // Open the jar and load MANIFEST.MF
      JarFile jar = new JarFile(file);
      Manifest manifest = jar.getManifest();
     
      // Open a connection and get ConnectionMetaData
      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
      Connection conn = cf.createConnection();
      assertNotNull(conn);
      ConnectionMetaData meta = conn.getMetaData();
     
      // Compare the value from ConnectionMetaData and MANIFEST.MF
      Attributes attrs = manifest.getMainAttributes();
     
      log.info("META--> " + meta.getJMSMajorVersion());
      log.info("META--> " + meta.getJMSMinorVersion());
      log.info("META--> " + meta.getJMSProviderName());
      log.info("META--> " + meta.getJMSVersion());
View Full Code Here


        }
    }

    private static void buildManifest(HashMap<String, String> argMap)
            throws Exception {
        Manifest m = new Manifest();
        Attributes a = m.getMainAttributes();
        a.put(Attributes.Name.MANIFEST_VERSION, "1.0");
        //a.put("Built-By", "manningr"); // argMap.get(BUILT_BY_KEY)
        a.put("Application-Version", argMap.get(VERSION_KEY));
        a.put(Attributes.Name.CLASS_PATH,
                "lib/antlr-2.7.5H3.jar "
                + "lib/commons-cli.jar "
                + "lib/commons-logging-1.0.4.jar "
                + "lib/forms.jar "
                + "lib/fw.jar "
                + "lib/hibernate3.jar "
                + "lib/jxl.jar "
                + "lib/log4j.jar "
                + "lib/nanoxml-2.1.jar "
                + "lib/openide.jar  "
                + "lib/openide-loaders.jar "
                + "lib/org-netbeans-modules-editor-fold.jar "
                + "lib/org-netbeans-modules-editor.jar "
                + "lib/org-netbeans-modules-editor-lib.jar "
                + "lib/org-netbeans-modules-editor-util.jar "
                + "lib/syntax.jar ");
        a.put(Attributes.Name.MAIN_CLASS,
              "net.sourceforge.squirrel_sql.client.Main");
        m.write(System.out);
    }
View Full Code Here

            showUsage();
            WrapperManager.stop( 1 );
            return// Will not get here
        }
       
        Manifest manifest;
        try
        {
            manifest = jarFile.getManifest();
        }
        catch ( IOException e )
        {
            m_outError.println( WrapperManager.getRes().getString(
                    "Unable to access the jar''s manifest file {0} : {1}", args[0], e ) );
            showUsage();
            WrapperManager.stop( 1 );
            return// Will not get here
        }
       
        Attributes attributes = manifest.getMainAttributes();
        String mainClassName = attributes.getValue( "Main-Class" );
        String classPath = attributes.getValue( "Class-Path" );

        if ( WrapperManager.isDebugEnabled() )
        {
View Full Code Here

    /**
     * Generate output JAR-file and packages
     */
    public void outputToJar() throws IOException {
  // create the manifest
  final Manifest manifest = new Manifest();
  final java.util.jar.Attributes atrs = manifest.getMainAttributes();
  atrs.put(java.util.jar.Attributes.Name.MANIFEST_VERSION,"1.2");

  final Map map = manifest.getEntries();
  // create manifest
  Enumeration classes = _bcelClasses.elements();
  final String now = (new Date()).toString();
  final java.util.jar.Attributes.Name dateAttr =
      new java.util.jar.Attributes.Name("Date");
View Full Code Here

         if (child.exists())
         {
            InputStream fis = new FileInputStream(child);
            try
            {
               return new Manifest(fis);
            }
            finally
            {
               close(fis);
            }
View Full Code Here

      if(file == null)
      {
         return null;
      }

      Manifest mf = VFSUtils.readManifest(file);
      Attributes attrs = mf.getMainAttributes();
      String className = attrs.getValue(Attributes.Name.MAIN_CLASS);
      return className;
   }
View Full Code Here

      // Default to the jboss client main
      String mainClassName = "org.jboss.client.AppClientMain";

      if (file != null)
      {
         Manifest mf = VFSUtils.readManifest(file);
         Attributes attrs = mf.getMainAttributes();
         String className = attrs.getValue(Attributes.Name.MAIN_CLASS);
         if (className != null)
         {
            mainClassName = className;
         }
View Full Code Here

         entry = jin.getNextEntry();
      }
      /* Explicity write out the META-INF/MANIFEST.MF so that any headers such
      as the Class-Path are see for the unpackaged jar
      */
      Manifest mf = jin.getManifest();
      if (mf != null)
      {
         File file = new File(dest, "META-INF/MANIFEST.MF");
         File parent = file.getParentFile();
         if( parent.exists() == false )
         {
            parent.mkdirs();
         }
         OutputStream out = new FileOutputStream(file);
         mf.write(out);
         out.flush();
         out.close();
      }
   }
View Full Code Here

    FileOutputStream stream = null;
    JarOutputStream out = null;
    try {
      // Open stream for jar file
      stream = new FileOutputStream(file);
      out = new JarOutputStream(stream, new Manifest());
      // Use now as last modified date of resources
      long now = System.currentTimeMillis();
      // Add all languages
      for (String langKey : languageKeys) {
        Locale locale = getLocaleOrNull(langKey);
View Full Code Here

      if(file == null)
      {
         return null;
      }

      Manifest mf = VFSUtils.readManifest(file);
      Attributes attrs = mf.getMainAttributes();
      return attrs.getValue(Attributes.Name.MAIN_CLASS);
   }
View Full Code Here

TOP

Related Classes of java.util.jar.Manifest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.