can l call a java program by "java -jar xxx.ear"

Discussions

General J2EE: can l call a java program by "java -jar xxx.ear"

  1. can l call a java program by "java -jar xxx.ear" (2 messages)

    Hi all ejb experts

    It is very thankful if someone can help me sort out below problems.

    1) Within the "ear" file, can my ejb code read the content of the application.xml (more specifically, l want my ejb code get the value of "description" tag in the application.xml file.

    2) Can l run a java program within "ear" by the means of "java -jar xxx.ear" at command prompt.

    thanks a ton in advance
    dso
  2. -->The application.xml file is the deployment descriptor for Enterprise Application Archives. It is supposed to be used by the EJB container while working with your ear file. There is no implicit way of reading this file . Why do you need to read this file though.You could parse it out in your ejb like a regular file using DOM/SAx and read the element you are interested in

    --> The ear needs a EJB container to run in . Again why do you want to do this?? So you would not be able to do java -jar ..ear and run all the ejbs in them.

    As per java documentation on java.sun.com

    the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point.
    None of this is true when it comes to a ear file..
  3. My case is that l could like to have a single file storing the release information of my ejb app. Then my ejb app can get and use that release info in the ejb app. In the meantime, external program / startup script can get such info by calling a java class packaged within the "ear" file. Can anyone kindly propose a solution to me

    thx & regards
    dso