You Are Here:

Community: Developer Discussion Boards

#1 Old incorrect manifest file - 2004-03-25, 08:49

Join Date: Mar 2003
Posts: 4
nicotine
Offline
Registered User
Hi!

I must read the user attributes from the manifest.mf file using
Class.getResourceAsStream() -method. I am using my midlet as the class loader. The code that should read the file is:

myMidlet.getClass().getResourceAsStream("/META-INF/MANIFEST.MF");

The problem is that the read manifest is not the one that is found on my package. Presumeably it reads the 1st occurrence that is found. So how can I read the correct manifest file?

ps. I am not allowed to read the params from JAD-file.
Reply With Quote

#2 Old 2004-03-25, 13:13

Join Date: May 2003
Posts: 35
manik_jandial
Offline
Registered User
dont know how u have done it ....below is the code that reads the manifest file correctly

only u need to give path of ur manifest file:


private void readTextFile() {
ReaderClass rd = new ReaderClass();
try {
Class c = rd.getClass();
InputStream is = c.getResourceAsStream("/Manifest.mf");
helpstring = new StringBuffer();
byte b[] = new byte[1];
while (is.read(b) != -1) {
helpstring.append(new String(b));
}
is.close();
}
catch (IOException e) {
e.printStackTrace();
}
System.out.println(helpstring)
}


u can parse the helpstring variable to get the fields u require

i hope it helps....

rgds

manik
Reply With Quote

#3 Old 2004-03-30, 15:13

Join Date: Mar 2003
Posts: 4
nicotine
Offline
Registered User
I did it nearly that way. Using "/manifest.mf" did not found anything. In your your application it really works?

Using "/META-INF/MANIFEST.MF" finds the incorrect file.
The found manifest includes only lines:

Manifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)

Thanks anyway for your efforts!

Eny other suggestions?
Reply With Quote

#4 Old Does it have to be in the manifest? - 2004-03-30, 17:56

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
Taking into consideration that the manifest is an integral part of the provisioning/installation process of MIDlets, and apparently you can't really know what's going on with it, why don't you just put those attributes in another text file you bundle with your jar?

shmoove
Reply With Quote

#5 Old 2004-09-24, 20:28

Join Date: Apr 2003
Posts: 58
colinlawrence
Offline
Regular Contributor
Although I agree with shmoove, and have since moved my properties to a properties file, the question remains outstanding. Why can't the manifest be read from a resource input stream like anything else?

Anyone?

-c
Reply With Quote

#6 Old 2004-09-26, 15:54

Join Date: Aug 2003
Posts: 232
Location: uk
Send a message via ICQ to alex_crowther
alex_crowther's Avatar
alex_crowther
Offline
Regular Contributor
Some things to be aware of:

Entries in the manifest are rewritten by jar.exe, that is they are not in the same order that you put them in once in the jar file, not sure if jar removes any fields.

Also, some operators but a size limit on the size of the manifest and the size of the jad so I would recommend against using the manifest as a text resource file.

For the same reason I would recommend against using the jad file.

Use a separate text file, that way if you need to deal with UTF-8 fonts (for localisation) you won't have to worry about it breaking the manifest or jad file.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia