×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    10

    Smile how to run JAR files with arguments?

    Hi everybody,

    Is it possible to run a jar file with arguments passed to its MAIN class?

    If yes can you help me on how to do it?

    Thanx

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: how to run JAR files with arguments?

    I dont think this can be done on Nokia, even using a C++ deamon in launching a midlet, you still have to get the Jams or MAms or whatver to launch the actuall jar/app file for you

    on RIM (blackberry) however, there was the notion of a "cldc library", this had a main method, and args could be passed and interpreted by the main method

    anyone know of other devices, environments in which you could do this? other than RIM?
    Jason Glass
    http://IChiBanComputers.Com

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    10

    Unhappy Re: how to run JAR files with arguments?

    Hi Jason Glass,

    u really crashed me!
    Theoratically, I think it is possible. How a mobile phone executes a jar file?

    Can we just pass parameters to the JAR file while calling?

  4. #4
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: how to run JAR files with arguments?

    sorry. as far as i know, on nokia there is no way, maybe someone will prove me wrong, and search the forum, as you might find something.

    as far as I know, when doing OTA or even just using a jar, you place what args you would like passed in the jad or jars manifest file, then you red them at runtime

    unfortunately, not dynamic, unless, you used a c++ exe or daemon, to tweak your jar or jad file just before runtime, inserting the args you want that are dynamic

    you could have two apps though, and pass args to the second app from the first, once the second is started, and notifies the first, kludgy but...
    Jason Glass
    http://IChiBanComputers.Com

  5. #5
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: how to run JAR files with arguments?

    Hello,

    In Series 40, there's no way.

    In Series 60, as far as I know there's a JAM api, but it is only used by people involved in the JVM project itself and therefore, internal. So, for the regular developer community, I'd agree with Jason that not even a C++ daemon would be useful.

    In Series 80, it is possible to pass arguments to Personal Profile applications only, not to midlets.

    Daniel

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

    Re: how to run JAR files with arguments?

    As Jason pointed already out, you can define some "arguments" in the JAD file along the required fields. The midlet can then access those properties with getAppProperty() method. Not exactly as dynamic as you are looking for, but this allows the developer to sign the midlet and then configure the midlet with need to sign the midlet again and again...

    Hartti

  7. #7
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: how to run JAR files with arguments?

    thanks dcrocha for

    In Series 80, it is possible to pass arguments to Personal Profile applications only, not to midlets.


    and thanks for confirmation hartti

    did you guys/girls like my idea about a C++ daemon, tweaking the jad file, before launching MIDlet, or is this unfeasible, wev'e all see where they are stored, but is that just an empty shell, and tewaking the jad wont work?
    Jason Glass
    http://IChiBanComputers.Com

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    10

    Re: how to run JAR files with arguments?

    thanx to all of you for the clarification!

    So, the best way is to communicate internally through a "localhost" channnel with the following steps:

    1- Application A runs Application B
    2- Application A sends to B the required arguments

    the question now is how to run Application B by Application A

    I think I better search for that, or, if any one would like to help by a reply then it is really appreciated!

  9. #9
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: how to run JAR files with arguments?

    Quote Originally Posted by Al Akaishi
    So, the best way is to communicate internally through a "localhost" channnel with the following steps:

    1- Application A runs Application B

    on Nokia, at least the device i have, java domain permissions will not let one midlet start or init another midlet, i do not know if that permission falls under a different domain, but I have never heard of it. I thnk the MAM or JAM has/wants to launch the java app.

    so direct launch of application from java is not possible, you might be able to perform a platformrequest with a file url and the name of the jad or jar, but will probably be interpreted by platform as an install and not a run/launch

    only other way, i tend to see in forums, is this:
    * second midlet has static PUSH reg. entry in jad file for xxx socket
    * first midlet connects to xxx socket, MAM or JAM launches the second midlet
    * first midlet passes info to second

    there is also possiblity of c++ daemon launching the java app, but still no args can be passed.
    This kinda answers all of the questions...possibly.
    Jason Glass
    http://IChiBanComputers.Com

  10. #10
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: how to run JAR files with arguments?

    al akaishi

    you probably already saw the link for the c++ daemon, else here it is

    http://www.symbian.com/developer/tec...ework_v1.1.zip
    Jason Glass
    http://IChiBanComputers.Com

  11. #11
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: how to run JAR files with arguments?

    Hi,

    Just a comment. I would be great to be able to pass JVM arguments for the JVM (maybe it does not make sense for KVM but it could be good for CLDC HI). Perhaps that will be possible in the future...

    BR

Similar Threads

  1. memory problem regarding creating jar files
    By gaziani007 in forum Mobile Java General
    Replies: 3
    Last Post: 2005-01-02, 08:50
  2. jad and jar files
    By colaloca in forum Mobile Java General
    Replies: 12
    Last Post: 2004-12-13, 23:41
  3. test jad and jar files
    By tuni0 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-01-14, 09:37
  4. About JAD and JAR files
    By simpleisgood in forum General Messaging
    Replies: 2
    Last Post: 2003-07-29, 02:31
  5. join two 64k jar files... possible?
    By atargame in forum Mobile Java General
    Replies: 1
    Last Post: 2003-06-16, 14:37

Posting Permissions

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