• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem reading custom attributes from the manifest file

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a standalone sample code that I wrote (actual problem is far more complex), this doesn't work as expected. Been trying too long....
What can I do to make it work???

(1) manifest file (MANIFEST.MF)
=======================
Manifest-Version: 1.0
Created-By: 1.4.0_01-b03 (Sun Microsystems Inc.)
Main-Class: myprojects.readmanifest.ReadManifest
Built-By: manish

Java Code (ReadManifest.java)
==============================


Then I compile this and jar it using following comaand from the directory
which contains the classes and manifest file

>jar -cvfm readmanifest.jar MANIFEST.MF myprojects*

Verified that the manifest file contained in jar is the correct manifest
file. And run it as -

>java -jar readmanifest.jar

The output I get is -

Starting ReadManifest...
jar:file:/D:/Java/ReadManifest/classes/readmanifest.jar!/myprojects/readmani
fest/ReadManifest.class


{}
null
null

Now what could be the reason???

TIA,
- Manish
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got this working, used the code -



Now let me try to get it working in my original application.

- Manish
 
Greenhorn
Posts: 25
Mac OS X Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Late reply, but I ran into the same problem, so hopefully this will clarify the issue for other readers... The Attributes.get() method takes a constant object argument: an instance of the inner "Attributes.Name" class, not a String.  The Attributes.getValue() alternative takes a String, as you discovered.  So for example:


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic