How to compile an EJB?

Maybe it'a simple question for some of you, but I want an answer...
I am new to EJB. I've read j2ee tutorial, I run the samples that sun provides.
Now I want to create my bean. It's possible to compile my bean without using ant? I saw that ant use an "build.xml" file.

Greetings,
Now I want to create my bean. It's possible to compile
my bean without using ant? I saw that ant use anYes, of course. Jakarta 'ant' is "just" a build tool that makes managing Java projects a lot easier than other, more "traditional", build tools (i.e. 'make')... It is no more a "requirement" for building EJBs than it is for building other Java projects.
EJBs are at their cores Java source files and are compileable and packageable using standard JDK command-line tools (or an IDE's wrapped up versions of them) like any other Java source files.
"build.xml" file. This is analogous to a 'Makefile' for 'make'.
Regards,
Tony "Vee Schade" Cook

Similar Messages

  • How to compile EJB 3.0 in command line

    Dear all,
    I want to know how to using command line to compile the EJB 3.0 bean.
    I have a set of source written in EJB 3.0, if i put in NetBeans and help me to build a ear, it works.
    But when i try to using command mode , it has problem.
    The Step to compile:
    1) Compile the source, all can compile .javac -d . -classpath %JAVAEE_HOME%\lib\javaee.jar;. ..\src\foo\*.java
    2) using the same "META-INF" that compiled by netbeans, include with the compiled class and build an jar file
    3) build a ear
    How ever when i deploy to glassfish 2.0
    It prompts me the descriptor error, cannot deploy to server.
    Can anyone tell me which step is missing ?
    Thanks
    Best Regard,
    Ben

    As long as you are not more specific about the steps you take to verify that the ears are the same, I cannot offer any more help. All I can say is: your assumption is wrong, because if they were the same, it would work. Simple logic is usually the best.

  • How to deploy 2 EJB's in separate jars

    Hi,
    I have successfully deployed 2 session ejb's in the same jar file, i.e. with one ejb-jar.xml and one weblog-ejb-jar.xml. And get get the ejb's to communicate with each other.
    Now I want to be able to compile and deploy the 2 ejb's in separate jar files as part of an ear file.
    My method so far is this:
    I have split the ejb-jar.xml file into two, for each ejb, and also the weblogic-ejb-jar.xml file into two for each ejb.
    I then compiled the ejb source files and packaged each ejb up with its respective deployment descriptors into two separate .jar files.
    I then want to run weblogics ejbc on each .jar file in turn so that the resultant .jar files (with newly created stubs/skels) can be packaged into an .ear to be easily deployed into weblogic.
    I try and run the ejbc command on the first of the .jar files and i get the error:
    ERROR: Error from ejbc:
    In ejb-jar.xml, the EJB 'SessClient' contains an invalid ejb-link in ejb
    -ref 'ejb/SessLogHome'. No EJB with ejb-name 'IntellectStateless.jar#SessLog' co
    uld be found.
    ERROR: ejbc found errors
    My ejb-jar.xml file for this ejb is:
    <ejb-jar>
      <enterprise-beans>
        <session>
          <ejb-name>SessClient</ejb-name>
          <home>intellectsession.sessiontwo.SessClientEntHome</home>
          <remote>intellectsession.sessiontwo.SessClientEnt</remote>
          <ejb-class>intellectsession.sessiontwo.SessClientEntBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
          <ejb-ref>
            <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <home>intellectsession.stateless.SessLogHome</home>
            <remote>intellectsession.stateless.SessLog</remote>
            <ejb-link>IntellectStateless.jar#SessLog</ejb-link>
          </ejb-ref>
        </session>
      </enterprise-beans>
      <assembly-descriptor>
        <container-transaction>
          <method>
         <ejb-name>SessClient</ejb-name>
         <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>and both of my .jar files are in the same directory when I run the ejbc command.
    I'm sure this can be done but I just think i'm not doing it in the right order maybe??
    Anyway pointers will be gr8ly appreciated.
    Cheers
    T

    Okay here is the solution to how to achieve the problem I encountered above:
    I am compiling my ejb.jar files using the weblogic.ejbc compiler, obviously I am deploying on weblogic here.
    This section:
    <ejb-ref>
      <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
    <home>intellectsession.stateless.SessLogHome</home>
      <remote>intellectsession.stateless.SessLog</remote>
      <ejb-link>IntellectStateless.jar#SessLog</ejb-link>
    </ejb-ref>must have JUST the <ejb-link/> tag removed from the ejb-jar.xml file. And then the weblogic-ejb-jar.xml file MUST look like this:
    <weblogic-ejb-jar>
        <weblogic-enterprise-bean>
            <ejb-name>SessClient</ejb-name>
            <reference-descriptor>
              <ejb-reference-description>
                <ejb-ref-name>ejb/SessLogHome</ejb-ref-name>
                <jndi-name>SessLog</jndi-name>
              </ejb-reference-description>
            </reference-descriptor>
            <jndi-name>SessClient</jndi-name>
        </weblogic-enterprise-bean>
    </weblogic-ejb-jar>Note the <refererence-descriptor> tag as the important part.
    After these changes, the 2 ejb.jar files can be compiled using the weblogic.ejbc tool, thus supplying the stubs/skels, and then the resultant two ejb.jar files can be added to the EAR file and deployed to weblogic.
    Result: 2 ejb's in separate jars, in one EAR file, talking to each other.
    T

  • Compile the ejb

    hello
    i am now studying j2eetutorial from sun,in this book,it always compile the ejb by the ant tool,i don't know why,is it necessary?because i feel difficult to write the "build.xml" file.
    question 1:can i use "javac" to compile the ejb,i think
    it's possible.
    question 2:how can i master the "build.xml",where can i
    get the tutorial that help me to learn it?
    THANK YOU IN ADVANCE!

    I am learning EJB too.
    In fact you don't need to install ant to compile the EJB.
    Install Forte for Java instead and include the J2EE.jar in the project, then you can compile the EJB in Forte. I find it is much easier than the ant tool.

  • How can I use EJB component on Weblogic 8.1 server ?

    hi,dear sir:
    How can I use EJB component on Weblogic 8.1 server ?
    It need client jar to invoke ejb,but what will I to do for this jar file? what does it contain? format ?
    If my EJB module contain 100 session bean and 50 Entity bean,but I want invoke 20 session beans in my module, how can I to do?
    thank you...

    Hi,
    This forum is exclusively for Creator. please post this on appropriate forum
    regards
    CreatorTeam

  • How to use embeddable EJB container (Java EE 6 / EJB 3.1) on Mac OS?

    To my understanding, the intent of the embeddable EJB 3.1 container is - among others - to support out-of-container testing. I've created a JUnit test case that uses glassfish embeddable for integration testing of ejb 3.1 Light ejbs. I run the tests using Maven.
    I have one general problem and one problem specific to Mac OS (I'm not able to use the embeddable container at all on Mac OS).
    1. First the general problem: the ejb container does not inject or publish classes that are on the test class-path only:
    src>main>java>MyEjb.class
    src>test>java>MyTestEjb.class
    The test case looks like this:
    public class TestCase1b {
         static EJBContainer container;
         @BeforeClass
         public static void initEjbContainer() {
              container = EJBContainer.createEJBContainer();
              for ( Object property : System.getProperties().keySet() ) {
              System.out.print(property + " : ");
              System.out.println(System.getProperty((String)property));
         @Test
         public void canTestWithTransaction() throws NamingException, NotSupportedException, SystemException {
              Context ctx = container.getContext();
              OrderServiceTesterEjb orderServiceTester = (OrderServiceTesterEjb) ctx
                        .lookup("java:global/classes/OrderServiceTesterEjb");
              Assert.assertNotNull(orderServiceTester.testCreateOrderWithTransaction());
         @AfterClass
         public static void closeEjbContainer() {
              container.close();
    The idea with a test-ejb is to mimic the way I typically perform junit integration testing with Spring: the test database i preloaded with test data. Each test-method of the junit test case starts a transaction, invokes the service, evaluates the state of the database and finally performs a rollback. My idea was to mimic that by creating a test ejb (Stateless, REQUIRES_NEW), that injects the EJB to test, calls the method to test, evaluates the result or db state and finally sets rollbackonly before returning. The problem is that the test case can lookup ejbs in src/main/java, but not the "test" ejbs in src/test/java. My workaround is to include the test-EJBs in src/main/java which I think is not acceptable.
    2. Next the Mac-problem:
    The Mac OS JDK 1.6 contains version 1.0 of javax.annotation (jsr 250). EJBs developed with Java EE 6 depends on version 1.1 of javax.annotation. Specifically, one typically need @Resource(lookup=... and @DataSourceDefinition of javax.annotation.sql which are both missing in the JDK. I can compile my EJBs by adding the javaee-api-6.0.jar library to my classpath. But when running unit tests with maven (as described above), a runtime error is reported, stating that the lookup-property of the @Resource annotation is undefined. This is logical, since the boot classpath should have precedence. So I added javaee-api-6.0.jar to the lib/endorsed directory of the jre. Unfortunetely, this triggers a segmentation fault of the Mac OS JVM when running the test. I have no other workaround than switching to windows. Any help / hints are much appreciated.
    /Johan

    Just as an update, we're soon to release the WLS 11g R1 PS2 update, which will contain WLS 10.3.3 just to confuse things.
    As part of that, we're distributing for the first time, an additional .zip version of WLS to make it easier for developers.
    The zip file distribution has no GUI installer -- it's a simple case of unzip, run a script it provides, then start the server.
    The zip file distribution has been specifically tested on Mac OS X and the WLS config/domain scripts automatically adjust as necessary for the Mac OS X java environment.
    Once the zip file distribution is available, we hope that developing against WLS on Mac OS X (and Windows/Linux) will be an easier task.
    -steve-

  • How to call one EJB in another EJB?

    How to call one EJB in another EJB? Please explain with some example code.

    To refer a Ejb from another Ejb include <ejb-ref> element in ejb-jar.xml
    <session>
    <ejb-name>EjbA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>com.ejb.EjbBHome</home>
    <remote>com.ejb.EjbB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <jndi-name>com.ejb.EjbBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In EjbA Bean class refer to EjbB with
    a remote reference to EjbB.
    InitialContext initialContext=new InitialContext();
    EjbBHome EjbBHome=(EjbBHome)
    initialContext.lookup("com.ejb.EjbBHome");
    EjbB ejbB=EjbBHome.findByPrimaryKey(primarykey);

  • How to compile and register a Java CFX tag with multiple class files?

    All-
    If this is the wrong forum for CFX questions, please let me
    know.
    I need to determine how to compile and register a Java CFX
    tag that contains multiple class files. One class file implements
    the CustomTag interface and the other class files implement various
    supporting classes. All of the documentation that I have found
    talks about using a single class file. I am assuming that a JAR
    file will be involved, but I am not sure of the specifics.
    Thanks in advance for your help.
    -Josh

    Yes, it will involve a jar. Use your java IDE (eclipse,
    etcetera ..) to create a jar containing all of the classes. Check
    your ide's documentation for how to create jar files. After you
    have created the jar, place the jar in the CF class path so CF will
    recognize it. For example the {cf_root}/WEB-INF/lib directory. CF
    must be restarted before it will detect the new jar. After
    restarting CF, register the CFX tag in the ColdFusion Administrator
    using the name of the class that implements the CustomTag
    interface.
    Though it is worth noting you can also instantiate java
    classes directly from ColdFusion (ie without using a CFX
    tag).

  • How to compile Oracle Linux source?

    I accidentally downloaded source DVD "Oracle Linux Release 5 Update 2 source - DVD" instead of installable ISO image. Is there anyway I can compile it to make bootable ISO image?
    I tried to search this forum as well as other places but couldn't find any information hence thought of opening a thread before I proceed to download correct file which will again take 10+ hrs with my Internet speed :(
    Any help is highly appreciated. Also I need to know which packages are required to be installed for compiling the source if at all that is possible. I am using Ubuntu 11.10 Desktop.
    Thanks in advance for any help and hope to get a reply soon :) I need to urgently install Oracle 11gR2 on it.
    Edited by: user6582219 on Apr 12, 2012 1:10 AM
    While browsing the forum for any possible solution I came to a thread that discuss installation of a package oracle-rdbms-server-11gR2-preinstall. When searched through search engine I came to know about recent certification Oracle 11gR2 on Oracle Linux 6, here is the link https://blogs.oracle.com/linux/entry/announcing_oracle_database_11g_r2
    https://blogs.oracle.com/linux/entry/announcing_oracle_database_11g_r2
    Thing is I already have Oracle Linux 6 Update 2 (the latest) installed on my machine in dual boot mode so I dropped the idea of installing version 5.2. As per the documentation 11gR2 was not certified earlier on Linux 6.2 so I thought of installing 5.2 but it is not necessary now.
    I would still appreciate if someone could answer my question just for knowing the procedure compiling source. May be it can help someone else trying to achieve this.
    I have another couple of important questions and need guidance from the experts over here. I am not sure if it is appropriate to open a new thread but for now I am posting them here.
    Before proceeding here are my environment details:
    Machine: x86 32 bit with 2 GB RAM/250 GB HD.
    OS: Kubuntu 11.10 Desktop and Oracle Linux 6 Update 2 in dual boot mode.
    Here are my partition details for your reference but as I am planning to do the installation from the scratch following new ideal scheme you can jump to last paragraph following the line "*********************************" for my questions.
    Unfortunately my partition plan went wrong and here is what I have now:
    Disk /dev/sda: 250.1 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x3d5ba9e1
    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 1002047 500000 83 Linux
    /dev/sda2 151525080 361253654 104864287+ 7 HPFS/NTFS/exFAT
    /dev/sda4 1003518 151001087 74998785 5 Extended
    /dev/sda5 1003520 7002111 2999296 82 Linux swap / Solaris
    /dev/sda6 7004160 11001855 1998848 83 Linux
    /dev/sda7 11003904 51001343 19998720 83 Linux
    /dev/sda8 51003392 110041087 29518848 83 Linux
    Partition table entries are not in disk order
    /dev/sda1 here is /tmp, /dev/sda2 is my data partition, I have separate /home / (root) partition for Kubuntu and remianing around 20 GB in extended partition is used for Oracle Linux 6.2 with default Oracle suggested LVM partition. I also have separate /boot for Kubuntu and I chose not to install grub while installing Oracle Linux. I later modified grub.cfg to add entries for Oracle Linux and now I can boot both OSs successfully.
    My issue now is I cannot extend 20 GB space (in extended partition) that I have given to Oracle though I have around 40 GB space available. This is because I alreay have 4 primary partitions (one for /boot others for "data" and one extended partition). So I have to make primary partition out of free space and install Oracle in a single partition without following recommended partition layout scheme.
    Now I want to do the installation of both the OS from the scratch and really need an advice on partition layout scheme. Here is summary of what I wan to achieve:
    1. Keep the "data" partition (primary) intact and carve an ideal partition layout for both the OS with separate /boot, /tmp, /home, swap (and may be for /usr???). Also may be I can share swap?
    2. How do I go about using LVM and is it recommended for this case? What would be ideal locations for each partitions and sizes? I already used 100 GB for "data" so now I want to keep 60 GB for Oracle Linux (and Oracle DB for which I will again make few sub-partitions) and remaining will be for Kubuntu.
    Well, I am not sure if this is the right place to ask these questions but since I can see very knowlegeable top contributors here that are willing to help novice users I thought of posting these questions.
    I would really really appreciate if someone can provide me rough draft of partition scheme in my case considering the sub-partitions needed for Oracle DB. I went thorugh number of forums and documentations to come up with solutuion and finally thought of getting help after much confusion.
    I really need to carefully plan this time because it's third time I am doing reinstallation from the scratch because of poor plan I followed previously.
    Thank you very much in advance and please let me know in case more information is needed from my side.
    Regards,
    Ramesh

    I accidentally downloaded source DVD "Oracle Linux Release 5 Update 2 source - DVD" instead of installable ISO image. Is there anyway I can compile it to make bootable ISO image?Google will be your best friend for such a question, for instance, "Creating a Custom centos Linux bootable ISO Image". There is no need to duplicate the effort. I recommend you download the correct installation DVD, e.g. 5.8
    Thing is I already have Oracle Linux 6 Update 2 (the latest) installed on my machine in dual boot mode so I dropped the idea of installing version 5.2. As per the documentation 11gR2 was not certified earlier on Linux 6.2 so I thought of installing 5.2 but it is not necessary now.So you don't need to install 5.2 anymore, but you want the information how to compile a installation DVD from the 5.2 source anyway?!
    I have another couple of important questions and need guidance from the experts over here. I am not sure if it is appropriate to open a new thread but for now I am posting them here.Questions may be important for you, but not necessarily for others. No one will complain if you create a new thread for particular questions or subjects. It is better to separate your topics and questions rather than creating a multi-mega thread, which does little to help anyone else but you. It means more work on your end, but it will be easier for anyone to participate or answer your questions, and it will allow you to better award answers.
    Regarding your partitioning questions: It is generally difficult to address such topics in a forum. You are asking for a book of information. My advice is to drop the old fashioned concepts of dual or triple boot options and install Oracle VirtualBox instead. It will make all of these questions obsolete and you can use whatever defaults when installing your virtual machine guest OS. Its a far more superior way of dealing with multiple operating systems on one and the same computer.
    I am using Ubuntu 11.10 Desktop.
    I need to urgently install Oracle 11gR2 on it.For what it's worth, if you can combine the two source below you should be able to install and run 11gR2 on Ubuntu 11.10.
    Install Oracle 11gR2 on Ubuntu Linux 11.04 (64-bit) Howto
    Install Oracle 11gR2 on Ubuntu Linux 11.04 (64-bit) Howto
    Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto
    Oracle 11gR2 Express Edition on Linux Ubuntu 11.10 howto
    However, check out VirtualBox.

  • How to run the ejb project in j2ee server

    How to run the EJB project.
    I give like
    java conveterClient converterClient.jar
    here conveterClient is class file name and converterClient.jar is deployed file
    like wise i give some exception is come
    give some help pls friends

    Navigate to the "DBOrders" module in the catalog, right click on the "ORDERS" database below and click "Export Schema Stucture". That will produce a file containing the DML needed to create the database

  • How to compile a single file in a project

    I have placed my java connector file called "xxxTargetconnector .class" in the below mentioned path
    D:\FSCM9DMO\webserv\FSCMDMO9\applications\peoplesoft\PSIGW\WEB-INF\classes\com\peoplesoft\pt\integrationgateway\targetconnector
    I have converted the above class file in to a java file using a decompiler.Now i would like to recompile the java file to get the byte code.This class file imports many class files from jar files which is placed in the below mentioned path.
    D:\FSCM9DMO\webserv\Cybersource.
    Before compiling i set the path to include the jar files
    for ex , set path = D:\FSCM9DMO\webserv\Cybersource
    For compilation i went to the below path using command prompt and compiled the particular file.
    D:\FSCM9DMO\webserv\FSCMDMO9\applications\peoplesoft\PSIGW\WEB-INF\classes\com\peoplesoft\pt\integrationgateway\targetconnector>javac xxxTargetConnector.java
    Unfortunately i got around 99 errors saying
    xxxTargetConnector.java:187: cannot find symbol
    symbol : variable Logger
    location: class com.peoplesoft.pt.integrationgateway.targetconnector.xxxTargetConnector
    How to compile a single file in a project ?

    According to [http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html], "As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. I have never tried using this feature.
    So if all of your dependent classes are in in jar files that are in D:\FSCM9DMO\webserv\Cybersource, a command like the following should work.
    javac -cp D:\FSCM9DMO\webserv\Cybersource\* xxxTargetConnector.java
    Note that setting your operating system path variable has no impact on where Javac looks for dependent classes.

  • How to compile all forms in a directoy at time?

    Hi friends, thank for your replies for the previous questions.
    Now
    How to compile all form modules located in a directory
    at a time? usually what I know is opening form one by one
    and compile it. But I want to compile all forms and create
    executable files at a time.
    Is project Builder helpfule to achive this??
    thanks
    madhu

    Yes, his file is useful -- it should run on Windows XP. You need to copy the above text into a file using a standard text editor, something like Notepad. To run it, you open a Cmd.exe DOS window on your pc, change directory (CD) to the folder where your forms are, and enter the command script file name.
    Here are several more links to other topics in this forum asking how to do the same thing:
    Re: How To Compile 370 forms ?
    Re: Creating Oracle 10g Forms and Reports Builds

  • How to compile a java file which is in memory?

    how to compile a java file which is in memory?
    such as:
    String s="class MyClass {....}";
    how to compile the string?
    thx

    come on ...That was a perfectly valid solution.
    Do you know how to call the sun.* compiler? If not then search the forums for it. If that interface still exists (which it might not in newer versions) you then will create a string stream from your class and pass it to that.

  • Pls help me on how to compile servlet

    pls i need the help of some kind one to assist me on how to compile and deploy servlet .I'm new to javaEE & am using the javaEE tutorial from sun site.In the first example servlet in d book, after compiling and deploying the greetingServlet and responseServlet and deployed it ,i was told to include a welcome jsp file in d war file. all these i have done but the server always complain of not been able locate d greetingServlet.
    i use the netbeans IDE and sun java application server.The greetingServlet & responseServlet codes are these; Pls I don't know what to put in the jsp file
    package servlets;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * This is a simple example of an HTTP Servlet.  It responds to the GET
    * method of the HTTP protocol.
    public class GreetingServlet extends HttpServlet {
        public void doGet(
            HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
            response.setContentType("text/html");
            response.setBufferSize(8192);
            PrintWriter out = response.getWriter();
            // then write the data of the response
            out.println("<html>" + "<head><title>Hello</title></head>");
            // then write the data of the response
            out.println(
                    "<body  bgcolor=\"#ffffff\">"
                    + "<img src=\"duke.waving.gif\" alt=\"Duke waving\">"
                    + "<h2>Hello, my name is Duke. What's yours?</h2>"
                    + "<form method=\"get\">"
                    + "<input type=\"text\" name=\"username\" size=\"25\">"
                    + "<p></p>" + "<input type=\"submit\" value=\"Submit\">"
                    + "<input type=\"reset\" value=\"Reset\">" + "</form>");
            String username = request.getParameter("username");
            if ((username != null) && (username.length() > 0)) {
                RequestDispatcher dispatcher = getServletContext()
                                                   .getRequestDispatcher(
                            "/response");
                if (dispatcher != null) {
                    dispatcher.include(request, response);
            out.println("</body></html>");
            out.close();
        public String getServletInfo() {
            return "The Hello servlet says hello.";
    package servlets;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * This is a simple example of an HTTP Servlet.  It responds to the GET
    * method of the HTTP protocol.
    public class ResponseServlet extends HttpServlet {
        public void doGet(
            HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
            PrintWriter out = response.getWriter();
            // then write the data of the response
            String username = request.getParameter("username");
            if ((username != null) && (username.length() > 0)) {
                out.println("<h2>Hello, " + username + "!</h2>");
        public String getServletInfo() {
            return "The Response servlet says hello.";
    }

    Here is what you will need to do.
    1. Compile the servlets by performing the following steps
    1.1 Open a command line in the directory where your servlets are located.
    1.2 Type the following commands
    1.2.1 javac GreetingServlet.java
    1.2.2 javac ResponseServlet.java
    Then you should see the .class files for these classes appear in the directory .
    Next you will put these class files in the WEB-INF/classes directory.
    Once you have done that you will edit your web.xml in the WEB-INF directory to include the two servlets. That code will look something like this
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <servlet>
              <servlet-name>GreetingServlet</servlet-name>
              <servlet-class>GreetingServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>GreetingServlet</servlet-name>
              <url-pattern>/GreetingServlet</url-pattern>
         </servlet-mapping>
         <servlet>
              <servlet-name>ResponseServlet</servlet-name>
              <servlet-class>ResponseServlet</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>ResponseServlet</servlet-name>
              <url-pattern>/ResponseServlet</url-pattern>
         </servlet-mapping>
    </web-app>Once you have done this save the web.xml file and recompile the war file by following these steps
    1 open a commandline in the root directory where the servlets are
    2 type the following command jar -cvf warFileName.war .
    *Note the space and period at the end of the command are not a mistake the space . tells the jar tool to complie the war from the directory you are current in.
    Once this command is successfully ran you should see a .war file appear in the directory you are in. Then simply put the war file in your deploy directory of your server and you are finished.
    alternatly if you are just doing this for yourself to learn servlets and this is not going to be deployed anywhere then I would just use the W3C's Jigsaw server which does all the work for you all you have to do is compile the servlets and put the class files in the servlets directory and you are done.

  • How to Compile & Deploy the Java Concurrent Program File

    Hi,
    There is a requirement to create the Java Concurrent Program in Oracle eBusiness. I am able to create the Java Concurrent Program file. But unable to do the following things:
    1.Since it is custom file, which location I will deploy the file?
    2. How to compile the file?
    3. In the execution file path and executable file name what should I specify for JCP?
    Please guide me.
    Thanks

    Please see (How to register and execute Java Concurrent Program ?in Oracle Applications R11i ? [ID 186301.1]) for the complete steps (i.e. define concurrent program and add it to the request group, .etc.) -- This is also applicable to R12.
    You may also see:
    Classpath Setting of Third Party Jar Files in R12 Java Concurrent Program (JCP) [ID 1292694.1]
    Integrating Custom Applications with Oracle Applications [ID 176852.1]
    Java Concurrent Program FAQ [ID 827575.1]
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Program&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

Maybe you are looking for