×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    4

    Batch external files with the jar

    Hello everyone,

    i'm developing a learning application with NetBeans and Midlet 2.1.

    in this application i read data from outside the jar using JSR 75 API.

    the problem is that the user should download my application and the data set separately such that:
    1. first he install the application jar
    2. extract the data set to drive ememory card/mass storage) on the phone

    so is there a way to batch the data set with the installation jar , in a way that when the user install the application the data set extracted from the jar to specific location

    thanks in advance

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Batch external files with the jar

    I am a little confused. Do you want to package the data in the same JAR file as you MIDlet, or are you talking about separate files?

    First off, does the dataset have to be available for other applications? If not, you could package the files inside the JAR file as resources and then get access to the data using getResourceAsStream().
    Note however, that if your dataset is really large, the JAR file could get too big and you would have problems in installing it on the certain phones.

    You could also let the user to download the data when he opens your application the first time. Your application would receive the data for example over HTTP connection and could then store the data in a specific location for later use. Would that work for you?

    Hartti

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    4

    Re: Batch external files with the jar

    Many thanks for your fast response

    First: yes my data set (a set of tap delimiter text files) are really big (4.5 MB), so as you said it is not possible to include it in the jar file all the time

    the second solution is good but is not what i'm looking for as i need the users to work offline

    so what i'm looking for is to batch the data set with the jar file , such that when the program installed in the phone the data set extracted from the jar file into specific location on the phone and to be deleted from the jar file

  4. #4
    Registered User
    Join Date
    Nov 2010
    Posts
    4

    Re: Batch external files with the jar

    Another thing , i think your first suggestion is good but i'm doubting some thing with it

    when the user run the application does the loader extract the jar somewhere? i mean if my data set contains 10 files and the user want to Fitch the data from one of them,only this one extracted? or all the jar should be extracted?

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: Batch external files with the jar

    The .jar is not "extracted". At least on most phones, the .jar file is kept intact when the application is installed.

    I don't think that you can automatically fetch your external data files at the time when the application is installed on most phones, when it is a Java app, but you can do it when the application is launched for the first time.

    If your application was a "native" C/C++ application (Symbian C++ or Qt, depending on the device), then the Symbian installation routines allow you to at installation time to run something that goes to the network to fetch data files.

    It may be possible, for compatible phones, to write a Symbian installer which has a Symbian component to fetch the data, and which includes and installs the Java app. Of course, then the app will not be possible to install on non-Symbian phones in the same way.

    I suggest you include a subset of the data with your application (.jar), and when the application first is run by the user, you then load the rest (you could do it in a background thread, I supposes, so as not to lock up the application while the downloading takes place).

  6. #6
    Registered User
    Join Date
    Nov 2010
    Posts
    4

    Re: Batch external files with the jar

    thanks hartti , and petrib

    after trails and error, i included the data with the jar and read it using getResourceAsStream() as hartti suggest.
    and i found that the loader fetch only the file contains the data at the run time not all files


    so i suppose this thread closed

    thanks a gain.

Similar Threads

  1. adding of external jar file to project jar-file to run in emulator fails
    By anand_misier in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2011-11-23, 05:41
  2. Running external downladed jar within another jar
    By eyalmnm in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2010-11-09, 09:36
  3. Inluding external jar files in build file HELP
    By Vignesh.M in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2008-12-17, 14:06
  4. Classpath for external Jar files. Pl Help.
    By kiyer_dev in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-09-13, 20:10
  5. Batch files, delay and the control keys
    By bbqpete in forum General Messaging
    Replies: 1
    Last Post: 2002-06-12, 00:10

Posting Permissions

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