• 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

how to get file names in jar

 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have few png images in jar and I want to get their names. On J2SE I used File class, but on midp1.0 isn't File class. Any suggestion?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Um, wouldn't you already know what you put in your jar file?
You can't put in dynamic files into your jar file, and you won't be able to access someone else's jar file, so it is your and you should know what you pu tinto it.
Just my opinion.
Mark
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made midlet which shows few images as a slideshow. My chef has source codes and wants to create another application just by changing images. I'd like to develop midlet which loads file names and than shows images, so that my chef can only copy images and build (without changing source code).
Do I make myslef clear?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see two options:
1) Make defining the file names a part of the build process -- when your chef(?) builds the application, he needs to edit some text file listing all the images the midlet should display.
2) Rip the images out of the JAR file and place them on a web server for download. For example, the midlet could be pointed to a "gallery" URL where it would download a "gallery descriptor" document (lists the URLs and names for the images that are part of that particular gallery) and then proceed to download each individual image file. The midlet could store these images and the descriptor into RMS for persistent storage.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, Lasse, I like your Images on a web server idea the best. Other than that, you will not be able to dynamically create a Jar file with file names you don't know, and expect to be able to find out what those filenames are.
Mark
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lasse, thank for your reply, but I said that I want my chef not to edit src code. Application should find filenames itself. And downloading from internet is for this type application the worst solution, 'cause it's offline midlet and downloading brings more problems ect.
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like Mark and Lasse had stated, there is no way to dynamically discover filenames in a MIDP JAR file. I would suggest to write a more flexible build solution: You can write an ANT task which would re-generate part of your source code based on your current image names. That is not that difficult and would save you (or your client) from editing the source code.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I just wanted to know if it is possible or not. Never mind. I wanted to help my chef with building new slideshow apps as easy as possible. It seems, that the easiest way how to do it is modifying source code. After all, it is just few (5-10) lines.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another idea... You could enforce a naming convention for the images (e.g. slide-1, slide-2, slide-3, ...) and have your MIDlet try to "guess" the names by reading files in order until slide-n is missing.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good idea. I'll do it...
reply
    Bookmark Topic Watch Topic
  • New Topic