How to initialized main method in a deployed application

Hello,
I am trying to deploy a simple java application to OC4J, I created a jar file as my deployment profile and then I created EAR file and finally delpoyed succesfully, but I'm wondering how can I start my main method in deployed application, note that my application requires some input arguments as well. Any ideas how can I do that ?
Regards,
Hussam Galal

I might be missing the point of this post, but you can't 'start your main method' in any type of deployed application.
You must expose your methods via some mechanism. You could call your method via a JSP, wrap in an EJB and create a client to call it remotely etc.
What is in your JAR file? Just POJOs? If so you will have to wrap them in EJBs so they can be called, that or deploy a web application with some servlets or JSPs so they are accessible via some URL.

Similar Messages

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to get main method running in JavaApplet?

    We're currently building a Java Applet with JBuilder5. We can get the event handlers to work, but the we can't get the main method running. What is the problem? Any suggestions?
    Thanks for any helps!
    Miska

    I've searched the tutorials, but they don't say anything to me. Here's the code, it's a bit long but anyway... Could you tell what I should do next? How to use the threads and so on...
    Here's the code:
    package simu;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    public class Simulaattori extends Applet {
    boolean isStandalone = false;
    Button SIMtilaButton = new Button();
    Button VNStilaButton = new Button();
    Button kaasuButton = new Button();
    Button jarruButton = new Button();
    Label asetuslabel = new Label();
    TextField asetusarvoTextField = new TextField();
    Button asetusplusButton = new Button();
    Button asetusmiinusButton = new Button();
    Label nollaatrippilabel = new Label();
    Label trippilabel = new Label();
    Label matkalabel = new Label();
    Button ClrButton = new Button();
    TextField trippimatkaTextField = new TextField();
    TextField kokomatkaTextField = new TextField();
    Label nopeuslabel = new Label();
    TextField nopeusTextField = new TextField();
    Label KaasuJaJarrulabel = new Label();
    TextField kaasujajarruTextField = new TextField();
    /**Get a parameter value*/
    public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
    (getParameter(key) != null ? getParameter(key) : def);
    //Muuttujat
    boolean isSIM_ON;
    boolean isVNS_ON;
    boolean OnkoPoljettu;
    double asetusarvo;
    double voima;
    /**Construct the applet*/
    public Simulaattori() {
    isSIM_ON = false;
    isVNS_ON = false;
    OnkoPoljettu = false;
    voima = 0;
    asetusarvo = 0;
    DisableButtons_SimOff();
    /**Initialize the applet*/
    public void init() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    /**Component initialization*/
    private void jbInit() throws Exception {
    SIMtilaButton.setLabel("Sim ON/OFF");
    SIMtilaButton.setBounds(new Rectangle(12, 8, 112, 27));
    SIMtilaButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    SIMtilaButton_actionPerformed(e);
    this.setBackground(new Color(20, 197, 230));
    this.setLayout(null);
    VNStilaButton.setLabel("VNS ON/OFF");
    VNStilaButton.setBounds(new Rectangle(12, 46, 112, 29));
    VNStilaButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    VNStilaButton_actionPerformed(e);
    asetuslabel.setFont(new java.awt.Font("Serif", 1, 18));
    asetuslabel.setText("Asetusarvo:");
    asetuslabel.setBounds(new Rectangle(20, 99, 93, 17));
    asetusarvoTextField.setBounds(new Rectangle(19, 123, 94, 26));
    asetusplusButton.setLabel("+");
    asetusplusButton.setBounds(new Rectangle(19, 164, 44, 27));
    asetusplusButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    asetusplusButton_actionPerformed(e);
    asetusmiinusButton.setLabel("-");
    asetusmiinusButton.setBounds(new Rectangle(71, 164, 42, 27));
    asetusmiinusButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    asetusmiinusButton_actionPerformed(e);
    nollaatrippilabel.setFont(new java.awt.Font("Serif", 1, 18));
    nollaatrippilabel.setText("Nollaa trippi:");
    nollaatrippilabel.setBounds(new Rectangle(170, 10, 112, 22));
    trippilabel.setBounds(new Rectangle(170, 43, 112, 22));
    trippilabel.setText("Trippimittari");
    trippilabel.setFont(new java.awt.Font("Serif", 1, 18));
    matkalabel.setBounds(new Rectangle(170, 113, 112, 22));
    matkalabel.setText("Matkamittari");
    matkalabel.setFont(new java.awt.Font("Serif", 1, 18));
    ClrButton.setCursor(null);
    ClrButton.setFont(new java.awt.Font("Dialog", 0, 8));
    ClrButton.setLabel("CLR");
    ClrButton.setBounds(new Rectangle(282, 7, 52, 28));
    ClrButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    ClrButton_actionPerformed(e);
    trippimatkaTextField.setBounds(new Rectangle(170, 71, 102, 26));
    kokomatkaTextField.setBounds(new Rectangle(170, 140, 102, 26));
    nopeuslabel.setFont(new java.awt.Font("Serif", 1, 18));
    nopeuslabel.setText("Nopeusmittari");
    nopeuslabel.setBounds(new Rectangle(170, 188, 112, 22));
    nopeusTextField.setBounds(new Rectangle(170, 220, 102, 26));
    KaasuJaJarrulabel.setFont(new java.awt.Font("Serif", 1, 20));
    KaasuJaJarrulabel.setText("Kaasu & Jarru");
    KaasuJaJarrulabel.setBounds(new Rectangle(95, 285, 136, 26));
    kaasujajarruTextField.setBounds(new Rectangle(97, 317, 125, 27));
    kaasuButton.setLabel("Kaasu");
    kaasuButton.setBounds(new Rectangle(256, 282, 105, 29));
    kaasuButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    kaasuButton_actionPerformed(e);
    jarruButton.setBounds(new Rectangle(255, 317, 105, 29));
    jarruButton.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jarruButton_actionPerformed(e);
    jarruButton.setLabel("Jarru");
    this.add(SIMtilaButton, null);
    this.add(VNStilaButton, null);
    this.add(asetuslabel, null);
    this.add(asetusarvoTextField, null);
    this.add(asetusplusButton, null);
    this.add(asetusmiinusButton, null);
    this.add(nollaatrippilabel, null);
    this.add(trippilabel, null);
    this.add(ClrButton, null);
    this.add(trippimatkaTextField, null);
    this.add(matkalabel, null);
    this.add(kokomatkaTextField, null);
    this.add(nopeuslabel, null);
    this.add(nopeusTextField, null);
    this.add(KaasuJaJarrulabel, null);
    this.add(kaasujajarruTextField, null);
    this.add(kaasuButton, null);
    this.add(jarruButton, null);
    /**Get Applet information*/
    public String getAppletInfo() {
    return "Applet Information";
    /**Get parameter info*/
    public String[][] getParameterInfo() {
    return null;
    void SIMtilaButton_actionPerformed(ActionEvent e) {
    if (isSIM_ON) {
    DisableButtons_SimOff();
    isSIM_ON = false;
    else {
    EnableButtons_SimOn();
    isSIM_ON = true;
    void VNStilaButton_actionPerformed(ActionEvent e) {
    if (isVNS_ON) {
    isVNS_ON = false;
    DisableButtons_VNSOff();
    else {
    isVNS_ON = true;
    EnableButtons_VNSOn();
    //asetusarvoksi nykyinen nopeus
    asetusarvo = Nopeusmittari.AnnaNopeus();
    void ClrButton_actionPerformed(ActionEvent e) {
    //tripin nollaus
    Trippimittari.NollaaMittari();
    void asetusplusButton_actionPerformed(ActionEvent e) {
    asetusarvo = asetusarvo + 1;
    void asetusmiinusButton_actionPerformed(ActionEvent e) {
    asetusarvo = asetusarvo - 1;
    void kaasuButton_actionPerformed(ActionEvent e) {
    if (voima >= 0 && voima <= 90) {
    voima = voima + 10;
    else if (voima < 0) {
    voima = 0;
    //kaasun painaminen lopetaa vakionopeuden s��d�n
    isVNS_ON = false;
    void jarruButton_actionPerformed(ActionEvent e) {
    if (voima >= -90 && voima <= 0) {
    voima = voima - 10;
    //kaasujajarruTextField.setText(Double.toString(voima));
    else if (voima > 0) {
    voima = 0;
    //kaasujajarruTextField.setText(Double.toString(voima));
    //jarrun painaminen lopettaa vakionopeuden s��d�n
    isVNS_ON = false;
    void DisableButtons_SimOff() {
    SIMtilaButton.setEnabled(true);
    VNStilaButton.setEnabled(false);
    ClrButton.setEnabled(false);
    asetusplusButton.setEnabled(false);
    asetusmiinusButton.setEnabled(false);
    kaasuButton.setEnabled(false);
    jarruButton.setEnabled(false);
    void EnableButtons_SimOn() {
    SIMtilaButton.setEnabled(true);
    VNStilaButton.setEnabled(true);
    ClrButton.setEnabled(true);
    asetusplusButton.setEnabled(false);
    asetusmiinusButton.setEnabled(false);
    jarruButton.setEnabled(true);
    kaasuButton.setEnabled(true);
    void DisableButtons_VNSOff() {
    asetusmiinusButton.setEnabled(false);
    asetusplusButton.setEnabled(false);
    void EnableButtons_VNSOn() {
    asetusmiinusButton.setEnabled(true);
    asetusplusButton.setEnabled(true);
    public double AnnaVoima() {
    return voima;
    public boolean CheckPolkimet() {
    return OnkoPoljettu;
    public double AnnaAsetusarvo() {
    return asetusarvo;
    public boolean OnkoSIM_ON() {
    return isSIM_ON;
    public boolean OnkoVNS_ON() {
    return isVNS_ON;
    public void Alkutilaan() {
    isSIM_ON = false;
    isVNS_ON = false;
    OnkoPoljettu = false;
    voima = 0;
    asetusarvo = 0;
    DisableButtons_SimOff();
    public void NaytaNopeus(double nopeus) {
    nopeusTextField.setText(Double.toString(nopeus));
    public void NaytaKokoMatka(double matka) {
    kokomatkaTextField.setText(Double.toString(matka));
    public void NaytaTrippiMatka(double trippimatka) {
    trippimatkaTextField.setText(Double.toString(trippimatka));
    public void NaytaVoima() {
    kaasujajarruTextField.setText(Double.toString(voima));
    //P��OHJELMA
    public static void main(String[] args) {
    //Luodaan oliot
    Simulaattori simulaattori = new Simulaattori();
    Saadin saadin = new Saadin();
    Matkamittari matkamittari = new Matkamittari();
    Trippimittari trippimittari = new Trippimittari();
    Nopeusmittari nopeusmittari = new Nopeusmittari();
    Malli malli = new Malli();
    simulaattori.asetusmiinusButton.setEnabled(true);
    while (true) {
    simulaattori.Alkutilaan();
    while (simulaattori.OnkoSIM_ON()) {
    long alkuaika = System.currentTimeMillis();
    simulaattori.trippimatkaTextField.setText("TESTI");
    if (simulaattori.OnkoVNS_ON()) {
    //v�litet��n voima mallille, s��din laskee voiman
    malli.laske_nopeus( Saadin.LaskeVoima() );
    nopeusmittari.LaskeNopeus();
    matkamittari.LaskeMatka();
    trippimittari.LaskeMatka();
    simulaattori.NaytaNopeus(nopeusmittari.AnnaNopeus());
    simulaattori.NaytaKokoMatka(matkamittari.AnnaMatka());
    simulaattori.NaytaTrippiMatka(trippimittari.AnnaMatka());
    simulaattori.NaytaVoima();
    }else {
    //v�litet��n voima mallille
    malli.laske_nopeus((int) (simulaattori.AnnaVoima()) );
    nopeusmittari.LaskeNopeus();
    matkamittari.LaskeMatka();
    trippimittari.LaskeMatka();
    simulaattori.NaytaNopeus(nopeusmittari.AnnaNopeus());
    simulaattori.NaytaKokoMatka(matkamittari.AnnaMatka());
    simulaattori.NaytaTrippiMatka(trippimittari.AnnaMatka());
    long loppuaika = System.currentTimeMillis();
    long suoritusaika = loppuaika - alkuaika;
    while (suoritusaika < 100) {
    loppuaika = System.currentTimeMillis();
    suoritusaika = loppuaika - alkuaika;
    } //end while (simulaattori.OnkoSIM_ON())
    } //end while(1)
    A MAJOR THANK YOU if you can bear me with this...
    Miska

  • How to call a method in bean from application module Impl?

    i have to call a method which is in a bean from AppmoduleImpl class. Is it possible ?

    The model layer should never depend on a specific view layer - this breaks reusability.
    What you need to do is expose a service method on your AM. Then your view can call this method and pass a parameter into the model layer.

  • How to call Java methods from a Windows application?

    Hello all,
    At our company, we need to integrate our product which is a Java Swing application with a Windows application. Specifically, we are trying to call Java methods that reside in our application from the Lotus Notes email client application, which is a native Windows application. Such that when a user clicks a button in the Lotus Notes email client, it will trigger an event in our Swing application. Is this possible using JNI? Do you know of any resources or references relating to this kind of a project?
    Thanks,
    Mete Kural

    If there is some dll interface that lets Lotus Notes load up and use a DLL, then yes, this should be possible.

  • How to use protected method of a class in application

    Hi,
      will u please tell me how to use protected method of class in application. (class:cl_gui_textcontrol, method:limit_text)
    Thanks in advance,
    Praba.

    Hi Prabha,
    You can set the maximum number of characters in a textedit control in the CREATE OBJECT statement itself.
    Just see the first parameter in the method . I mean MAX_NUMBER_CHARS. Just set that value to the required number.
    Eg:
    data: edit type ref to CL_GUI_TEXTEDIT.
    create object edit
      exporting
        MAX_NUMBER_CHARS       = 10
       STYLE                  = 0
       WORDWRAP_MODE          = WORDWRAP_AT_WINDOWBORDER
       WORDWRAP_POSITION      = -1
       WORDWRAP_TO_LINEBREAK_MODE = FALSE
       FILEDROP_MODE          = DROPFILE_EVENT_OFF
        parent                 = OBJ_CUSTOM_CONTAINER
       LIFETIME               =
       NAME                   =
      EXCEPTIONS
        ERROR_CNTL_CREATE      = 1
        ERROR_CNTL_INIT        = 2
        ERROR_CNTL_LINK        = 3
        ERROR_DP_CREATE        = 4
        GUI_TYPE_NOT_SUPPORTED = 5
        others                 = 6
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    In this case, the max: number of characters will be set to 10.
    I hope your query is solved.
    Regards,
    SP.

  • Invoke jar main method in java code

    hi
    i have a jar that has a usage like this
    java -jar helper.jar arg1 arg2 etc...i want to invoke this helper main method in my java code.i've tried using reflection but it didn't quite work...
    String[] args = new String[]{"arg1","arg2"};
    Class c = Class.forName("com.helper.MainClass");
    Method mainMethod = c.getMethod("main", args.getClass());
    int mods = mainMethod.getModifiers();
    if(mainMethod.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) {
         throw new NoSuchMethodException("main");
    mainMethod.invoke(null, args);
    Exception in thread "main" java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at Test.callJarMain(Test.java:50)
    at Test2.main(Test.java:34)thoughts???

    phychem wrote:
    i want to use this jar in a non-static way.
    public void useJar(String args[]){
    //somehow invoke jar method here...
    Sorry, I still don't get it. I don't know what you mean by a non-static way of using jars. The main method for launching an application is static so if you call that method, you will be using a static method. I don't know what you mean by a "jar method" either. Methods are inside classes. So far, all I can guess is you want to invoke a method in a class that happens to be inside a jar. Since people do this all the time without reflection, I don't see the problem.

  • Invoking main method from cmd line (deployed as web app)

    I have a application deployed as a web application (war file).
    I want to create a regular java class with main method so that main can invoked
    on a command line.
    The main method wishes to share resources (DB connection pool etc) with the rest
    of the web application.
    Is it possible ? and how to invoke the main method inside the war(not jar) ?

    Hi,
    if you deployed this to OC4J, open EM
    http://server:port/em
    and get to the Web service. You can execute it from here to see if generally this is working, or if you have a proxy problem only
    Frank

  • Deploying an rich client (Applet and main method)in iPlanet.

    I would like to know how to deploy an applet client and a main() method client in the iPlanet Application Server. Adv. thnax for your replies.

    Dear punit,
    Thanx for ur reply.
    but then where will i mention the JNDI name which we usually supply in DD during the deployment of a WAR file.
    When i try to run the standalone appln. i get an error, because i have not supplied a jndi name in the server. where will client find out the jndi name from, because nothing is specified in the server(but in the case of servlet we spcify the JNDI name in DD XML file.)
    R u working currently on iAS6.0.
    Thanx and see if u can reply me ASAP.

  • Need help - how to run this particular method in the main method?

    Hi all,
    I have a problem with methods that involves objects such as:
    public static Animal get(String choice) { ... } How do we return the "Animal" type object? I understand codes that return an int or a String but when it comes to objects, I'm totally lost.
    For example this code:
    import java.util.Scanner;
    interface Animal {
        void soundOff();
    class Elephant implements Animal {
        public void soundOff() {
            System.out.println("Trumpet");
    class Lion implements Animal {
        public void soundOff() {
            System.out.println("Roar");
    class TestAnimal {
        public static void main(String[] args) {
            TestAnimal ta = new TestAnimal();
            ta.get(); // error
            // doing Animal a = new Animal() is horrible... :(                   
        public static Animal get(String choice) {
            Scanner myScanner = new Scanner(System.in);
            choice = myScanner.nextLine();
            if (choice.equalsIgnoreCase("meat eater")) {
                return new Lion();
            } else {
                return new Elephant();
    }Out of desperation, I tried "Animal a = new Animal() ", and it was disastrous because an interface cannot be instantiated. :-S And I have no idea what else to put in my main method to get the code running. Need some help please.
    Thank you.

    Hi paulcw,
    Thank you. I've modified my code but it still doesn't print "roar" or "trumpet". When it returns a Lion or an Elephant, wouldn't the soundOff() method get printed too?
    refactored:
    import java.util.Scanner;
    interface Animal {
        void soundOff();
    class Elephant implements Animal {
        public void soundOff() {
            System.out.println("Trumpet");
    class Lion implements Animal {
        public void soundOff() {
            System.out.println("Roar");
    class TestAnimal {
        public static void main(String[] args) {
            Animal a = get();
        public static Animal get() {
            Scanner myScanner = new Scanner(System.in);
            System.out.println("Meat eater or not?");
            String choice = myScanner.nextLine();
            if (choice.equalsIgnoreCase("meat eater")) {
                return new Lion();
            } else {
                return new Elephant();
    }The soundOff() method should override the soundOff(); method in the interface, right? So I'm thinking, it should print either "roar" or "trumpet" but it doesn't. hmm..

  • How to add a code TestIfElse(10) to the Main method of the Program.cs class?

    How to add a code  TestIfElse(10) to the Main method of the Program.cs class?
    Here is my code and I have copied from the Wiley book for Microsoft certification page 14,
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace ifelse_Statement
        class Program
            static void Main(string[] args);
            TestIfElse(10);
            public static void TestIfElse(int n);
            if(n < 10)
                     Console.WriteLine("n is less than 10");
             else if(n < 20)
                    Console.WriteLine("n is less than 20");
             else if(n < 30)
                Console. WriteLine("n is greater than or equal to 30");
    Here is the error list I am getting,
    Error 1      Method must have a return type        C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\switch_Statement\Program.cs
    12 13
    switch_Statement
    Error 2
    Type expected C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\switch_Statement\Program.cs
    12 24
    switch_Statement
    Error 3
    Method must have a return type C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    12 9
    ifelse_Statement
    Error 4
    Type expected C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    12 20
    ifelse_Statement
    Error 5
    Invalid token 'if' in class, struct, or interface member declaration
    C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    16 9
    ifelse_Statement
    Error 6
    Invalid token '10' in class, struct, or interface member declaration
    C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    16 16
    ifelse_Statement
    Error 7
    Type expected C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    16 16
    ifelse_Statement
    Error 8
    Invalid token '(' in class, struct, or interface member declaration
    C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    18 35
    ifelse_Statement
    Error 9
    A namespace cannot directly contain members such as fields or methods
    C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    20 10
    ifelse_Statement
    Error 10
    Type or namespace definition, or end-of-file expected
    C:\Users\PVS\documents\visual studio 2013\Projects\Lesson01\ifelse_Statement\Program.cs
    30 1
    ifelse_Statement
    Error 11
    The type or namespace name 'n' could not be found (are you missing a using directive or an assembly reference?)
    c:\users\pvs\documents\visual studio 2013\projects\lesson01\ifelse_statement\program.cs
    16 12
    ifelse_Statement
    Error 12
    'System.Console.WriteLine(string, params object[])' is a 'method' but is used like a 'type'
    c:\users\pvs\documents\visual studio 2013\projects\lesson01\ifelse_statement\program.cs
    18 26
    ifelse_Statement

    static void Main(string[] args){
    TestIfElse(10);
    public static void TestIfElse(int n)
    if (n < 10)
    Console.WriteLine("n is less than 10");
    else if (n < 20)
    Console.WriteLine("n is less than 20");
    else if (n < 30)
    Console.WriteLine("n is greater than or equal to 30");
    Fouad Roumieh

  • When is the inteface variable in an EJB mains method initiated?

    hI,
    the code bellow is part of a simple EE 6 example from Yuri Vasilievs book Beginning Database-Driven...
    Can somone tell me when the variable customerSession bellow will be initiated in the CustomerSessionClient class bellow.
    When I run theCustomerSessionClient (main methode) in my netbeans environment the customerSession is allways null?
    Bellow first the inteface class and then the CustomerSessionClient class
    package ejbjpa.client;
    import javax.ejb.Remote;
    * @author xxx
    @Remote
    public interface CustomerSession {
    public String getCustomerAddress(Integer customer_no);
    import ejbjpa.ejb.CustomerSession;
    import javax.ejb.EJB;
    * @author xxx
    public class CustomerSessionClient {
    @EJB
    private static CustomerSession customerSession;
    public static void main(String[] args){
    System.out.println("Billing address of the customer whose id is: "+customerSession.getCustomerAddress(1));
    Brg
    Javanalle
    Edited by: 873848 on Jul 20, 2011 8:56 PM

    Can somone tell me when the variable customerSession below will be initiated in the CustomerSessionClient class below.It will never be initialized.
    When I run theCustomerSessionClient (main method) in my netbeans environment the customerSession is always null?I agree.
    That's just a command-line client. It doesn't execute in an EJB container, so the @EJB annotation never takes effect.

  • How to increase the Java Heap Space for a main method

    Hello all,
    after a given number of calculations inside a class with main-method, I get an OutOfMemoryError (Java Heap Size).
    So I'm just trying to increase the Heap Size Creator uses, but it won't work.
    After reading a lot of posts and online-articles, I tried the following:
    1) I changed the -Xms and -Xmx options (to 512m) both in
    $CREATOR/SunAppServer8/domains/creator/config/domain.xml and
    $CREATOR/etc/creator.conf (this file also points to the Creator built-in JDK)
    2) additionally I tried to start Creator from the console with the respective option:
    ./creator -J-Xmx512m
    The memory toolbar shows the right value, but when I use
    System.out.println("JVM maximum memory:\t"+Runtime.getRuntime().maxMemory()/1024+" KB\n");it always says 64 MB, no matter which option I chose in the config-files.
    So how can I increase this value?
    Regards,
    Felix
    Message was edited by:
    Felice
    Message was edited by:
    Felice

    Thank you very much,
    this was an important hint. Additionally I had to create a new "Java Class Library" project with a copy of the needed files (those that are not dependent on the Application Server). Then I could use the option you mentioned.
    Unfortunately, when I try to run the file with
    java -jar FILENAME.jarit won't work, because the archive is not complete: MANIFEST.MF lacks the main-class and all involved libraries.
    I managed to add the main-class attribute manually, but adding all library references seems to be very error-prone.
    So does anyone know if I did something wrong or if this is a bug of Creator?
    Regards,
    Felix

  • How to print a string with out using main method??

    how to print a string with out using main method??
    if we can tell me with example?
    thanks in adavance
    raja

    Hi,
    actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
    If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
    Regards
    Dirk

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

Maybe you are looking for

  • How do I combine two catalogs?

    I just converted a catalog from PSE8 into PSE9 after I previously established a catalog in PSE9.  The result in PSE9 is two separate catalogs.  How do I proceed to combine them into one catalog?

  • IAS for non Database based web site

    We are using IAS for our website using Oracle Forms/Reports and Oracle databse 8i. We have now to develop small websites in pure HTML (no java, no Oracle Forms), we are wondering if it is still a good option to use IAS as the web server for those app

  • Mahipal (Mikel) Mittal wants to learn Dreamweaver

    Hi, I am Mahipal Mittal aka Mikel Mittal. All of my friends call me Mikel Mittal. I am here to learn Dreamweaver because I need to submit a project of website development in my college. Can anyone here help me with this? If possible, please provide m

  • Can photo studio 4.3 update to work w/ os 10.6.2?

    the arc soft photo studio 4.3 s/w came with my canoscan 4400F scanner a few years ago. i use it just for scanning in photos but mostly slides - it has a useful preview section that i like, plus it seems to be essential s/w to scan in slides. when i c

  • Mac/itunes won't recognize a cd in the drive

    Hi there! I am soooo computer lame and apologize if this "issue" has been answered...I've searched for an endless amount of time before posting but couldn't find an answer that would work. I've tried deleting the cidb and cddb files to no avail. Off