SlideShare una empresa de Scribd logo
1 de 30
Rational Application Development certification
      prep, Part 5: Running Java applications
      Skill Level: Introductory


      Gregory Scott (glscott1@us.ibm.com)
      Senior Learning Specialist
      IBM



      04 Apr 2006


      This is the fifth of seven tutorials created to help you prepare for the IBM Certification
      Test 255, Developing with IBM Rational® Application Developer for WebSphere®
      Software V6. Explore features for running both standalone and server-side J2EE
      enterprise applications.


      Section 1. Before you start

      About this series
      Rational® Application Developer for WebSphere® Software is the IBM Software
      Development Platform that allows you to quickly design, develop, analyze, test,
      profile and deploy Web, Web services, Java™, J2EE, and portal applications. This
      series of seven tutorials helps you prepare to take the IBM certification Test 255,
      Developing with IBM Rational Application Developer for WebSphere Software V6 to
      become an IBM Certified Associate Developer. This certification targets entry level
      developers and is intended for new adopters of IBM Rational Web Developer or IBM
      Rational Application Developer for WebSphere Software V6.0, specifically
      professionals and students entering into Web development using IBM products.


      About this tutorial
      This tutorial explores how to run standalone Java applications using Rational
      Application Developer and how to deploy desktop or server-side J2EE enterprise
      applications (including a Web module) to WebSphere Application Server 6. Learn
      how to change workspaces, as well.


Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                Page 1 of 30
developerWorks®                                                                        ibm.com/developerWorks




     Objectives
     This tutorial demonstrates not only the ways of running Java applications in
     Application Developer 6, but some of the differences with earlier versions of the tool.
     Users of the earlier versions (WebSphere Studio Application Developer versions 4
     and 5) will find Rational Application Developer 6 almost identical, except for features
     related to the associated server. After completing this tutorial, you will be able to run
     both standalone and server-side applications (such as Web applications) with
     confidence, use command line arguments from within Application Developer, and
     create or remove multiple launches.


     Prerequisites
     Before taking the first part of this tutorial, Running standalone applications, you need
     to understand the concepts covered in the first three tutorials of this series:
                • Rational Application Development certification prep: Part 1, Workbench
                  basics
                • Rational Application Development certification prep: Part 2, Java
                  development
                • Rational Application Development certification prep: Part 3, Web
                  development

     The second half of this tutorial continues with related issues pertaining to
     WebSphere Application Server 6. Rational Application Development certification
     prep: Part 4, Working with databases on the data perspective is not necessary for
     this tutorial, although if you finished it successfully you will save time by continuing
     with the completed project.


     System requirements
     To run the examples in this tutorial, install Rational Application Developer for
     WebSphere Software or Rational Web Developer for WebSphere Software.
     Download a free trial version of Rational Application Developer for WebSphere
     Software if you don't already have a copy of it.

     The hardware and software requirements for this software can be located at IBM
     Rational Application Developer System Requirements.




     Section 2. Running standalone applications in
     Application Developer

Running Java applications
Page 2 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                  developerWorks®




      Step 1: Create or import a standalone application and run it

             1.     Open Application Developer and accept the default workspace or choose
                    your own workspace. This tutorial assumes C:WebTutorial, which was
                    used by Tutorials 3 and 4, but you can replace that directory with your
                    own.

             2.     Open the Java perspective by clicking the icon in the upper-right corner,
                    and close any files showing in the editor pane.

             3.     Create a new Java project called StandAlone. One way to do this is to
                    select File > New > Project > Java. Or, click the icon in the menu bar.
                    Figure 1. Java Project icon




             4.     In the New Java Project window, type in StandAlone as the name, and
                    leave the defaults.
                    Figure 2. New Java Project screen




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                Page 3 of 30
developerWorks®                                                                          ibm.com/developerWorks




            5.     In this tutorial you keep the source and bytecode in the current project,
                   but as you see, you have options for managing other locations.

            6.     Either click Next to see other options available for other projects (but
                   leave the defaults) or click Finish.

            7.     The StandAlone project now appears in the Package Explorer view.
                   You can code the application yourself, as the following instructions show.
                   Alternatively, using the techniques learned in your previous tutorials, you
                   can import the StandAlone.jar from the Download section to run the
                   application. Please insure, though, that after selecting File > Import, you
                   select Zip file rather than one of the specialized .jar files that relate to
                   J2EE development (such as App Client JAR file, which itself means a file
                   with an xml deployment descriptor in it). This is because for purposes of
                   importing, Application Developer makes no distinction between a
                   standard jar and a zip (although for exporting it does). Also make sure
                   that, when you arrive at the following screen and before clicking Finish,
                   the word StandAlone is showing in the Into folder:

                   Figure 3. Zip file screen




Running Java applications
Page 4 of 30                                            © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                 developerWorks®




                    The StandAlone.jar is unzipped and the classes are added to your
                    StandAlone folder. You can inspect them if you want.

                    To code the application yourself: Select the StandAlone project and either
                    right-click and select New > Package or click the Package icon on the
                    menu bar.


             8.     Name the package myapps.
                    Figure 4. New Java package screen




             9.     With the myapps package selected, click on the menu bar the New Class
                    icon, which has the C on it (next to the package icon), or select File >
                    New > Class. Fill in the name of the Java class as MyApplic1, and
                    make sure the main method is checked, as follows:
                    Figure 5. New Java Class screen



Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                               Page 5 of 30
developerWorks®                                                                     ibm.com/developerWorks




            10. Click Finish.

            11. Add the following code to the main method:

       System.out.println("In main of MyApplic1 as of :");
       System.out.println(new java.util.Date());
       if (args.length > 0){
           System.out.println("Your first argument is: " +
       args[0]);
           System.out.println("Your second argument is: " +
       args[1]);
       }
       else {System.out.println("You entered no command line
       arguments");
       }



            12. Save the file. There should be no errors. Select Run > Run from the
                menu. The launch window opens.
                Figure 6. Run screen


Running Java applications
Page 6 of 30                                       © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                developerWorks®




                    If MyApplic1 is not showing under Java Application in the Configurations
                    section, simply click New and create it. (Alternatively, you can choose
                    from the menu, Run > Run As > Java Application and the new launch
                    gets created for you.)

             13. Click Run in the lower-right window. It looks as if nothing happened
                 (unless you happened to have your Console showing, in which case you
                 will see the print statements).

             14. If your Console is not showing, click Window > Show View > Console.
                 Figure 7. Show View: Console




             15. The Console appears in the bottom pane. You should see the print
                 statements, including the date, similar to this:
                 Figure 8. Console output




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                               Page 7 of 30
developerWorks®                                                                       ibm.com/developerWorks




            16. You can re-run the application a number of different ways: repeat the Run
                > Run step from above; use the Run > Run Last Launched sequence;
                or use the hotkey Ctrl-F11.

     Now it is time to work with command line arguments in Application Developer.


     Step 2: Use command line arguments

            1.     From the menu bar, click Run > Run again.

            2.     Click the (x)=Arguments tab. Enter two arguments into the Program
                   Arguments section, similar to this:
                   Figure 9. Program arguments text area




            3.     Click Run. You should see the correct print statements: Anthony is the
                   first argument, and Randazzo is the second.

            4.     As with command line tools, if you want a string of words to be one
                   argument, use double quotation marks. If you are not familiar with
                   command line arguments, try running MyApplic1 again with a phrase
                   similar to the following:
                   Figure 10. Program arguments text area: 2nd ex




                   As you see, the entire phrase gets returned as the second command line


Running Java applications
Page 8 of 30                                         © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                    developerWorks®



                    argument.


      Step 3: Create multiple launches
      What happens if you are switching back and forth between multiple standalone
      applications? Create a second application and find out, of course!

             1.     To keep this simple, right-click MyApplic1 and select Copy. Then paste
                    MyApplic1 into the same package.
                    Figure 11. Name Conflict screen




             2.     Type SecondApp (or MyApplic2 or whatever you want) as the new name.

             3.     Change the one line of code in SecondApp's main method so the printout
                    is relevant: System.out.println("In main of SecondApp as of
                    :");

             4.     If you try to run the selected SecondApp by pressing Ctrl-F11 you still get
                    the printout from MyApplic1.

             5.     Therefore, select Run > Run, and use the New button again to define the
                    new launch; then click the Run button in the lower-right (or, from the
                    beginning, with the SecondApp selected, simply click Run > Run As >
                    Java Application).

             6.     As indicated before, the launch gets created and the class's main method
                    runs. Now you will have the correct print statements.

             7.     At this point, if you use Ctrl-F11, it is SecondApp that runs again. If you
                    want to revert to MyApplic1, then click Run > Run and select it from the
                    list under Java Applications.
                    Figure 12. Run screen: Configurations




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                  Page 9 of 30
developerWorks®                                                                         ibm.com/developerWorks




            8.     Once you no longer need a launch, you can select it and click Delete
                   (next to New) shown above.

     You have explored the ways to run multiple applications in Application Developer. It
     is time for server-side considerations. Close any open files in the editor.




     Section 3. Running Web applications and changing
     workspaces using Application Developer and
     WebSphere Application Server 6
     In the first part of the tutorial, Rational Application Developer certification prep, Part
     3, you saw that you could deploy and run a Web application in one of three ways
     from the Web perspective:


            1.     Right-click the servlet class file and click Run on Server (if the servlet
                   .java file does not give the Run on Server option, use the servlet's class

Running Java applications
Page 10 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                        developerWorks®



                    file instead, as found under the WEB-INF/classes directory).

             2.     Right-click the desired Web application (for example, FirstWeb in the
                    tutorial Rational Application Developer certification prep, Part 3) and click
                    Run on Server. This option searches the Welcome file list in the web.xml
                    for the first file, for example, index.html, and if found, runs that index.html.
                    If not, it looks for the second file in the Welcome file list and tries to run it,
                    and so forth, through the list. You must create these files to allow this
                    automatic search to work.

             3.     In the Servers pane, right-click the server itself and select Add and
                    Remove Projects. Add the desired project to the server. This starts the
                    server automatically, at which point you can run a particular servlet or
                    JSP or a Welcome file according to (1) or (2) above.

      The following section covers additional development issues resulting from using
      Application Developer 6 and WebSphere Application Server 6, and is especially
      relevant for previous users of WebSphere Studio Application Developer 4 and 5.


      Differences between Application Developer and WebSphere
      Studio Application Developer
      A little background: in versions 4 and 5 of Application Developer, the so-called
      WebSphere Test Environments were essentially WebSphere Application Server 4
      and 5 respectively, but could be thought of as being internal to Application
      Developer. That is, if and when one switched workspaces in Application Developer 4
      or 5 from, say, C:One to C:Two, and started up the server in the second
      workspace, a new instance of WebSphere Application Server 4 or 5 would be
      created that was independent of the server in the first workspace. Hence, there was
      no problem in having an enterprise application called, for instance, Library in both
      workspaces.

      Now, with Application Developer 6, the situation is different. Application Developer 6
      gets installed with a basic edition of WebSphere Application Server 6 alongside of it.
      No longer is there a Server perspective in Application Developer, as there was in
      versions 4 and 5. Moreover, there is only one set of binaries for WebSphere
      Application Server 6, and any and all workspaces in Application Developer normally
      point to a default profile in WebSphere Application Server 6.

      What is a default profile? You can think of a profile as being an instance of
      WebSphere Application Server 6. Having profiles allows WebSphere Application
      Server administrators to create multiple instances of WebSphere Application Server
      with only one set of binaries. (For more info on profiles, see the Resources section.)
      Hence, the default profile is the one automatically run if users do not create their
      own profiles, and indeed developers using Application Developer 6 need not care
      about profiles as long as they do not change workspaces.

      However, if the workspace is changed in Application Developer 6, a potential
      problem occurs, as the following example describes: Assume an enterprise

Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                      Page 11 of 30
developerWorks®                                                                         ibm.com/developerWorks



     application named Library had been created in C:One and deployed (which means
     that Library will also exist in the default profile of WebSphere Application Server 6). If
     a duplicate, similar, or new enterprise application called Library is created in C:Two
     and you attempt to deploy it to WebSphere Application Server 6, an error will occur,
     indicating that the application already exists.

     There are two solutions to this problem:

            1.     Create a second WebSphere Application Server profile to be used by the
                   second Application Developer workspace . This solution is beyond the
                   scope of this tutorial, but more information can be found in the Resources
                   section.

            2.     Uninstall the enterprise application from the server in the first workspace
                   before trying to create or deploy it from the second workspace. You get
                   practice using this solution in the following section using the example from
                   the tutorial "Rational Application Developer certification prep, Part 3",
                   which contained the enterprise application called First (which contains the
                   Web application called FirstWeb).



     Step 1: Deploy identically named enterprise applications from
     different workspaces
     This section assumes FirstWeb was run successfully in Part 3 or Part 4 of this
     tutorial series. If you did not successfully complete Part 4, use the solution from
     tutorial Part 3, as the database will not have been set up and connection errors will
     result from running Part 4 solution code. Before continuing, run whichever solution
     you are employing to make sure that it has been deployed successfully to the server.
     You can download the easiest solution from Part 3 if needed.


            1.     At this stage, your Web application is running (presumably in the
                   C:WebTutorial workspace). You should see something similar to this:
                   Figure 13. Possible output from running Input.jsp of FirstWeb




Running Java applications
Page 12 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                 developerWorks®




             2.     In the admin console for WebSphere Application Server 6, right-click the
                    server under Servers and select Run administrative console.
                    Figure 14. Run administrative console choice




             3.     The login screen opens. Because security is not turned on, you can enter
                    any name or single character (it is for logging purposes only), then click
                    LogIn. The Admin console screen opens. This is the same admin console
                    that administrators work with to control WebSphere Application Server 6.
                    Figure 15. Admin Console screen




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                              Page 13 of 30
developerWorks®                                                                         ibm.com/developerWorks




            4.     Expand Servers > Application Servers under the left Welcome column.
                   You see the default name (server1) and your machine's name (the node).
                   Figure 16. Application servers




            5.     Likewise, expand Applications > Enterprise Applications. You now see
                   all of the enterprise applications that have been deployed to the
                   application server, no matter what the Application Developer workspace.
                   In my case, I see the following, including the enterprise application First
                   that was created in the third tutorial and is now running, as shown by the
                   green arrow under "Status".
                   Figure 17. Installed enterprise applications



Running Java applications
Page 14 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                   developerWorks®




             6.     You can uninstall the First enterprise application either by using the admin
                    console or by removing the project from the Servers pane in the Web
                    perspective (with Add and Remove projects). Because you already know
                    how to use the latter feature, stop and uninstall the First application from
                    the admin console, as explained below.

             7.     Check the box next to the First application and then click Stop. A
                    message indicating success appears, and the red x appears under
                    Status.
                    Figure 18. Enterprise Applications: Messages




             8.     Then click First again, and choose Uninstall. Click OK to confirm the
                    uninstall. You should no longer see the First application listed. Equally
                    important, you should see the Save message. You must click the Save
                    link to finish the task, as shown:


Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                Page 15 of 30
developerWorks®                                                                      ibm.com/developerWorks



                   Figure 19. Messages: Save option




            9.     A Save confirmation window appears.
                   Figure 20. Save confirmation




            10. Click Save. First is now completely uninstalled.

            11. There are many other options you can explore in the admin console, but
                then you are entering much further into the administrator's realm. For
                more information on administering WebSphere Application Server, see
                the Resources section.

            12. For the moment, log out of the admin console by clicking the Logout
                option at the top.
                Figure 21. Admin console: logout




Running Java applications
Page 16 of 30                                       © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                    developerWorks®




             13. Now that you have removed First from WebSphere Application Server,
                 change your workspace in Application Developer, using the steps in the
                 following section, and import the First application into that new
                 workspace. To cover some other issues, export First from the
                 C:WebTutorial workspace and then re-deploy First to insure that it runs
                 from the new workspace.


      Step 2: Change the workspace and re-deploy

             1.     Close all files within Application Developer (File > Close All), but leave it
                    running for the moment.

             2.     Check the running applications in your operating system. If you're running
                    Windows, click Ctrl-Alt-Delete and choose Task Manager > Processes.
                    You should see a javax.exe for Application Developer and another
                    java.exe for WebSphere Application Server and, depending on other
                    software you might be running, there could be other java.exe processes.
                    You will re-examine the Task Manager in a few minutes.
                    Figure 22. Task Manager results: one possibility




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                  Page 17 of 30
developerWorks®                                                                         ibm.com/developerWorks




            3.     Back in Application Developer, drill down in Project Explorer to First >
                   Deployment Descriptor and open it. Click the Deployment tab. This tab
                   is new in Application Developer 6. It enhances your .ear (more
                   information later). For the moment, simply note that if you did not run Part
                   4 on databases of this tutorial series, you do not see any custom values.
                   If you finished Tutorial 4, select the Cloudscape JDBC provider to remind
                   yourself how you configured it.

            4.     In WebSphere Studio Application Developer 4 and 5, the database
                   information was not contained in the .ear file. You had to export
                   separately any server information (be it in a project or not) and manually
                   configure the testing WebSphere Application Server to accept the
                   relevant information. In this tutorial that information is merely the
                   database JNDI name and location (assuming you finished Tutorial 4).
                   If you completed Tutorial 4 you should see the following; if you skipped
                   the tutorial, examine a little more carefully the whole screenshot here,
                   simply for your edification:

                   Figure 23. Enhanced .ear: Application Deployment Descriptor




Running Java applications
Page 18 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                              developerWorks®




      Now that you have confirmed the information that can exist in an enhanced .ear file,
      close the descriptor and export First as an .ear:


             1.     Right-click First and select Export > Ear file.
                    Figure 24. Export EAR




             2.     Choose your own temporary Destination. Check Export source files and


Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                           Page 19 of 30
developerWorks®                                                                          ibm.com/developerWorks



                   Include project build (Overwrite is optional in this case).
                   Figure 25. Destination




            3.     Click Finish. Confirm the ear file is in the Destination directory, then close
                   Application Developer.

            4.     Now go back to the Task Manager in your operating system, and use the j
                   key to quickly find any process beginning with j. You should find only
                   java.exe -- the javaw.exe representing Application Developer was closed,
                   but the server is still running!

            5.     To be sure your server does not continue to run, stop it in one of three
                   ways:

                     1.     Before closing Application Developer, stop it from your Servers
                            pane (in a relevant perspective like Web or J2EE)

                     2.     Kill the process from Task Manager

                     3.     Use your WebSphere Application Server command line options to
                            stop it:
                            Go to the following directory, or its equivalent, on your system:
                            C:Program FilesIBMRationalSDP6.0runtimesbase_v6bin. Run
                            the stopserver batch file with the name of your server (recall from
                            the admin console that it was server1). For example:

       C:. . .base_v6bin>stopServer server1


                            You see:


Running Java applications
Page 20 of 30                                           © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                 developerWorks®



                            Figure 26. Windows command screen




                    Your server is stopped and the java.exe is gone from the Task Manager
                    process.

             6.     Open Application Developer into a different, new workspace. For the
                    following steps, it is assumed C:Tutorial5 is the new workspace name
                    you enter when opening the Application Developer.

             7.     Notice that the tool subsequently opens with the default Welcome
                    window.

             8.     Close the Welcome pane and switch to the Web perspective if it is not
                    your default.

             9.     In your Project Explorer window, right-click Enterprise Applications and
                    click Import > EAR file.

             10. Browse to the temporary directory with the First.ear file that you exported
                 a few steps back and select First.ear. The other fields are filled in for you.
                 Figure 27. Import Enterprise Application




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                Page 21 of 30
developerWorks®                                                                      ibm.com/developerWorks




            11. Click Next. In the next screen, check Import for partial EAR
                development. Notice the .jar file gets checked automatically.
                Figure 28. Partial development




Running Java applications
Page 22 of 30                                       © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                             developerWorks®




             12. To see any module (namely, FirstWeb) being brought in under First, click
                 Next. Otherwise, click Finish. Stay in the Web perspective if you are
                 asked whether you want to go to the J2EE perspective.

             13. In the Servers pane, right-click WebSphere Application Server 6 and
                 select Add and Remove Projects. The following window opens:
                 Figure 29. Add and Remove Projects




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                          Page 23 of 30
developerWorks®                                                                       ibm.com/developerWorks




            14. With First selected as the Available project, click Add, then Finish.

            15. Notice the server is now starting (and the project gets added to it under
                the covers). Your project is now deployed to WebSphere Application
                Server 6, more precisely, again, to the default profile of Application
                Server. If the Server status bar displays Debugging rather than
                Started, restart the server in Start mode.
                Figure 30. Restart option




            16. Depending on your hardware and processor speed, you might have to
                wait a minute or three for the restart to finally be successful. Examine the


Running Java applications
Page 24 of 30                                        © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                  developerWorks®



                    Console output to see the status. You need to see the line "Server1 open
                    for e-business" before continuing.

             17. To test click Dynamic Web Projects > FirstWeb > WebContent >
                 externaljsp > Input.jsp > Run on Server.

             18. Perhaps, surprisingly, you might be asked to select a server.
                 Figure 31. Server Selection screen




                    This is surprising, and perhaps an oddity of Application Developer for this
                    version only, because after the server started, an Add and Remove
                    Projects check indeed showed that First was added to WebSphere
                    Application Server 6.

             19. In any event, check Set server as project default.
                 Figure 32. Set Server screen




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                Page 25 of 30
developerWorks®                                                                         ibm.com/developerWorks




            20. To confirm that First is an added project, click Next or simply click Finish.

            21. Your Input.jsp form should now appear, as follows, and you can enter
                data.
                Figure 33. Input.jsp screen




                   If you used the solution from Tutorial 3 (Web application) you get
                   simulated results back, and it does not matter what lastname or account
                   number you used (age was never implemented on the server side in the
                   previous tutorials).

                   If you used the solution from Tutorial 4 (Data perspective), remember
                   that, for the sake of simplicity, the lastname field was never checked
                   against the database in the business logic (although it does get echoed
                   back in the output jsp). Implementing the code to insure that lastname
                   matches the correct account number is left to the reader as a "bonus"
                   exercise. At this stage, the account number is the only crucial element for
                   data input, and must match a relevant piece of data in your database;
                   otherwise, no status is returned from the InitialOutput.jsp (which resides
                   under FirstWeb > WEB-INF > jsp).


            22. You probably want to stop the server before leaving Application
                Developer so you don't leave java.exe running in your processes. In the
                Web perspective Servers pane, right-click the server and select Stop or, if
                the server is selected, simply click the Stop icon, the red square.
                Figure 34. Stop icon




     If you have drastic problems
     Sometimes, your application code for a server-side application does not get reflected
     in the tested code, and simply restarting the server does not solve the problem. Here
     are some general solutions, from basic to advanced:




Running Java applications
Page 26 of 30                                          © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                    developerWorks®




             1.     In the test server's popup menu, select Add and Remove Projects.
                    Remove your project, click Finish, and then add it back again. The server
                    needs to be running to do this because adding or removing a project
                    invokes wsadmin tasks on the server.

             2.     Alternatively, in Application Developer's menu, select Project > Clean....
                    Be sure to build again after the cleaning, either automatically or through
                    Project > Build.... Do the add/remove projects step detailed above.

             3.     Incremental building and smart publishing, which is new with Application
                    Developer 6, can get out of sync. If none of the previous fixes work, you
                    must rebuild the default profile, which is the most drastic step of all, short
                    of re-installing Application Developer. Rebuilding the profile can fix a
                    multitude of server-related problems, but obviously will require some work
                    (eight to twenty minutes, depending naturally on your experience). See
                    the Resources section for links to information about rebuilding profiles.

      Congratulations. You have now completed Tutorial 5.




Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                                  Page 27 of 30
developerWorks®                                                                    ibm.com/developerWorks




     Downloads
      Description                           Name              Size         Download method
      Startup code for this tutorial        StandAlone.jar    1KB          HTTP

       Information about download methods




Running Java applications
Page 28 of 30                                     © Copyright IBM Corporation 1994, 2007. All rights reserved.
ibm.com/developerWorks                                                                  developerWorks®




      Resources
      Learn
         • The Source for Java Developers is the place to get information on the latest
           Java JDK (J2SE 5, previously known as J2SE 1.5), including basic Java
           standalone applications that require a main method or server-side applications,
           making use of servlets, JSP pages or EJB components, with examples and
           tutorials.
         • To get more information on applets, go to J2SE 5 Java DemonstrationApplets.
         • At J2EE Connector Architecture you will find a number of links on resource
           adapters and connecting to legacy or enterprise information systems.
         • The Technical library view provides access to a multitude of free tutorials for
           mastering development, including how to run various applications, in Application
           Developer.
         • The article, IBM Rational Developer: Powerful support for rapid Java and J2EE
           development, presents an introduction into the various ways to develop and run
           Java applications using Application Developer.
         • To learn more about EJB components, take the tutorial Getting Started with
           Enterprise JavaBeans Technology.
         • To learn more about version 6 and its profiles, read the article System
           management for WebSphere Application Server V6.
         • The forum posting at WebSphere 6.0 -- Creating multiple app server instances
           on one physical server presents information on using profiles, including
           instructions on deleting and re-creating the default profile.
         • The IBM Redbook, WebSphere Application Server V6 System Management &
           Configuration Handbook, provides information to help you administer
           WebSphere Application Server 6.
         • Visit the developerWorks Application Developer zone to expand your
           Application Developer skills and knowledge.
         • Get certified as an "IBM Certified Associate Developer". Check out the
           objectives, sample assessment tests, and training resources for test 255,
           "Developing with IBM Rational Application Developer for WebSphere Software
           V6".
         • Stay current with developerWorks technical events and webcasts.
      Get products and technologies
         • Download a free trial version of IBM Rational Application Developer.
         • Build your next development project with IBM trial software, available for
           download directly from developerWorks.
      Discuss


Running Java applications
© Copyright IBM Corporation 1994, 2007. All rights reserved.                               Page 29 of 30
developerWorks®                                                                        ibm.com/developerWorks



         • Participate in the discussion forum for this content.
         • Participate in developerWorks blogs and get involved in the developerWorks
           community.



     About the author
     Gregory Scott
     Greg is an instructor in private and public national settings, internal and external to
     IBM, primarily related to Java client-side and server-side (J2EE) programming.
     Specializations include servlets, JSPs, Enterprise JavaBeans, portlets, XML and Web
     Services.




Running Java applications
Page 30 of 30                                         © Copyright IBM Corporation 1994, 2007. All rights reserved.

Más contenido relacionado

La actualidad más candente

Getting started with ibm worklight tips
Getting started with ibm worklight tipsGetting started with ibm worklight tips
Getting started with ibm worklight tipsbupbechanhgmail
 
Java interview question
Java interview questionJava interview question
Java interview questionsimplidigital
 
Edition of an enterprise software in PHP, feedback
Edition of an enterprise software in PHP, feedbackEdition of an enterprise software in PHP, feedback
Edition of an enterprise software in PHP, feedbackNicolas Dupont
 
Tivoli perfviewer
Tivoli perfviewerTivoli perfviewer
Tivoli perfvieweritsolvs
 
Five Steps to Add AppUp .NET SDK to Microsoft Visual Studio
Five Steps to Add AppUp .NET SDK to Microsoft Visual StudioFive Steps to Add AppUp .NET SDK to Microsoft Visual Studio
Five Steps to Add AppUp .NET SDK to Microsoft Visual Studioreadwritehack
 
Oop c sharp_part_1
Oop c sharp_part_1Oop c sharp_part_1
Oop c sharp_part_1shivaksn
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eGina Bullock
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eGina Bullock
 
Eo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eEo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eGina Bullock
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Oracle formstutorial
Oracle formstutorialOracle formstutorial
Oracle formstutorialphamdanhvu
 
MAX 2008 - Building your 1st AIR application
MAX 2008 - Building your 1st AIR applicationMAX 2008 - Building your 1st AIR application
MAX 2008 - Building your 1st AIR applicationrtretola
 
IBM MobileFirst Platform Pot Sentiment Analysis v3
IBM MobileFirst Platform Pot Sentiment Analysis v3IBM MobileFirst Platform Pot Sentiment Analysis v3
IBM MobileFirst Platform Pot Sentiment Analysis v3Banking at Ho Chi Minh city
 

La actualidad más candente (17)

Getting started with ibm worklight tips
Getting started with ibm worklight tipsGetting started with ibm worklight tips
Getting started with ibm worklight tips
 
Java interview question
Java interview questionJava interview question
Java interview question
 
70 499
70 49970 499
70 499
 
Edition of an enterprise software in PHP, feedback
Edition of an enterprise software in PHP, feedbackEdition of an enterprise software in PHP, feedback
Edition of an enterprise software in PHP, feedback
 
Tivoli perfviewer
Tivoli perfviewerTivoli perfviewer
Tivoli perfviewer
 
Five Steps to Add AppUp .NET SDK to Microsoft Visual Studio
Five Steps to Add AppUp .NET SDK to Microsoft Visual StudioFive Steps to Add AppUp .NET SDK to Microsoft Visual Studio
Five Steps to Add AppUp .NET SDK to Microsoft Visual Studio
 
I Phone101
I Phone101I Phone101
I Phone101
 
Oop c sharp_part_1
Oop c sharp_part_1Oop c sharp_part_1
Oop c sharp_part_1
 
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5eEo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
 
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5eEo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
 
Eo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5eEo gaddis java_chapter_13_5e
Eo gaddis java_chapter_13_5e
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
flex_4_tutorials
flex_4_tutorialsflex_4_tutorials
flex_4_tutorials
 
Selenium tutorial
Selenium tutorialSelenium tutorial
Selenium tutorial
 
Oracle formstutorial
Oracle formstutorialOracle formstutorial
Oracle formstutorial
 
MAX 2008 - Building your 1st AIR application
MAX 2008 - Building your 1st AIR applicationMAX 2008 - Building your 1st AIR application
MAX 2008 - Building your 1st AIR application
 
IBM MobileFirst Platform Pot Sentiment Analysis v3
IBM MobileFirst Platform Pot Sentiment Analysis v3IBM MobileFirst Platform Pot Sentiment Analysis v3
IBM MobileFirst Platform Pot Sentiment Analysis v3
 

Destacado

Crossing the Boundaries of Web Applications with OpenSocial
Crossing the Boundaries of Web Applications with OpenSocialCrossing the Boundaries of Web Applications with OpenSocial
Crossing the Boundaries of Web Applications with OpenSocialBastian Hofmann
 
Skim Karin Lindschoten
Skim Karin LindschotenSkim Karin Lindschoten
Skim Karin LindschotenKGS Global
 
Level Up Your Fundraising - NTC2013 Presentation Deck
Level Up Your Fundraising - NTC2013 Presentation DeckLevel Up Your Fundraising - NTC2013 Presentation Deck
Level Up Your Fundraising - NTC2013 Presentation DeckSarah M Worthy
 
Dell, Simone Versteeg
Dell, Simone VersteegDell, Simone Versteeg
Dell, Simone VersteegKGS Global
 
Everbridge Decision Making During Disasters
Everbridge Decision Making During DisastersEverbridge Decision Making During Disasters
Everbridge Decision Making During DisastersEverbridge, Inc.
 

Destacado (6)

Crossing the Boundaries of Web Applications with OpenSocial
Crossing the Boundaries of Web Applications with OpenSocialCrossing the Boundaries of Web Applications with OpenSocial
Crossing the Boundaries of Web Applications with OpenSocial
 
Skim Karin Lindschoten
Skim Karin LindschotenSkim Karin Lindschoten
Skim Karin Lindschoten
 
Level Up Your Fundraising - NTC2013 Presentation Deck
Level Up Your Fundraising - NTC2013 Presentation DeckLevel Up Your Fundraising - NTC2013 Presentation Deck
Level Up Your Fundraising - NTC2013 Presentation Deck
 
Dell, Simone Versteeg
Dell, Simone VersteegDell, Simone Versteeg
Dell, Simone Versteeg
 
Everbridge Decision Making During Disasters
Everbridge Decision Making During DisastersEverbridge Decision Making During Disasters
Everbridge Decision Making During Disasters
 
Muerte
MuerteMuerte
Muerte
 

Similar a Part 5 running java applications

Part 3 web development
Part 3 web developmentPart 3 web development
Part 3 web developmenttechbed
 
Part 6 debugging and testing java applications
Part 6 debugging and testing java applicationsPart 6 debugging and testing java applications
Part 6 debugging and testing java applicationstechbed
 
Part 2 java development
Part 2 java developmentPart 2 java development
Part 2 java developmenttechbed
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingSarah Elson
 
Part 1 workbench basics
Part 1 workbench basicsPart 1 workbench basics
Part 1 workbench basicstechbed
 
Supplement2d netbeans6
Supplement2d netbeans6Supplement2d netbeans6
Supplement2d netbeans6olveraadrian82
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee applicationKumar
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Amit Singh
 
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0Banking at Ho Chi Minh city
 
Part 4 working with databases
Part 4 working with databasesPart 4 working with databases
Part 4 working with databasestechbed
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manualnahalomar
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appiumPratik Patel
 
Lab 6) package and deploy a j2 ee application
Lab 6) package and deploy a j2 ee applicationLab 6) package and deploy a j2 ee application
Lab 6) package and deploy a j2 ee applicationtechbed
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfacesdjdskjd9097
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfacecis247
 

Similar a Part 5 running java applications (20)

Part 3 web development
Part 3 web developmentPart 3 web development
Part 3 web development
 
Part 6 debugging and testing java applications
Part 6 debugging and testing java applicationsPart 6 debugging and testing java applications
Part 6 debugging and testing java applications
 
Part 2 java development
Part 2 java developmentPart 2 java development
Part 2 java development
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Part 1 workbench basics
Part 1 workbench basicsPart 1 workbench basics
Part 1 workbench basics
 
Supplement2d netbeans6
Supplement2d netbeans6Supplement2d netbeans6
Supplement2d netbeans6
 
Supplement2d netbeans6
Supplement2d netbeans6Supplement2d netbeans6
Supplement2d netbeans6
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee application
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
 
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
IBM MobileFirst Platform v7.0 POT Offers Lab v1.0
 
Open sap ui5 - week_2 unit_1_syjewa_exercises
Open sap ui5  - week_2 unit_1_syjewa_exercisesOpen sap ui5  - week_2 unit_1_syjewa_exercises
Open sap ui5 - week_2 unit_1_syjewa_exercises
 
Part 4 working with databases
Part 4 working with databasesPart 4 working with databases
Part 4 working with databases
 
Jsf tutorial
Jsf tutorialJsf tutorial
Jsf tutorial
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
Lab3 RTC Source Control
Lab3 RTC Source ControlLab3 RTC Source Control
Lab3 RTC Source Control
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Tutorial for netbeans
Tutorial for netbeansTutorial for netbeans
Tutorial for netbeans
 
Lab 6) package and deploy a j2 ee application
Lab 6) package and deploy a j2 ee applicationLab 6) package and deploy a j2 ee application
Lab 6) package and deploy a j2 ee application
 
Cis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interfaceCis247 i lab 1 of 7 creating a user interface
Cis247 i lab 1 of 7 creating a user interface
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
 

Más de techbed

1456.base boot
1456.base boot1456.base boot
1456.base boottechbed
 
1455.ata atapi standards - 1-7
1455.ata atapi standards - 1-71455.ata atapi standards - 1-7
1455.ata atapi standards - 1-7techbed
 
1454.ata features
1454.ata features1454.ata features
1454.ata featurestechbed
 
1432.encoding concepts
1432.encoding concepts1432.encoding concepts
1432.encoding conceptstechbed
 
Flash cs4 tutorials_2009
Flash cs4 tutorials_2009Flash cs4 tutorials_2009
Flash cs4 tutorials_2009techbed
 
Photoshop tut
Photoshop tutPhotoshop tut
Photoshop tuttechbed
 
Lab 7b) test a web application
Lab 7b) test a web applicationLab 7b) test a web application
Lab 7b) test a web applicationtechbed
 
Lab 7a) debug a web application
Lab 7a) debug a web applicationLab 7a) debug a web application
Lab 7a) debug a web applicationtechbed
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_entechbed
 
Part 7 packaging and deployment
Part 7 packaging and deploymentPart 7 packaging and deployment
Part 7 packaging and deploymenttechbed
 
Lab 5b) create a java server faces application
Lab 5b) create a java server faces applicationLab 5b) create a java server faces application
Lab 5b) create a java server faces applicationtechbed
 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts applicationtechbed
 
First java-server-faces-tutorial-en
First java-server-faces-tutorial-enFirst java-server-faces-tutorial-en
First java-server-faces-tutorial-entechbed
 
Lab 4) working with databases
Lab 4) working with databasesLab 4) working with databases
Lab 4) working with databasestechbed
 
Lab 3) create a web application
Lab 3) create a web applicationLab 3) create a web application
Lab 3) create a web applicationtechbed
 
Lab 2) develop a java application
Lab 2) develop a java applicationLab 2) develop a java application
Lab 2) develop a java applicationtechbed
 
Lab 1) rad installation
Lab 1) rad installationLab 1) rad installation
Lab 1) rad installationtechbed
 
6) debugging and testing
6) debugging and testing6) debugging and testing
6) debugging and testingtechbed
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deploymenttechbed
 
5) running applications
5) running applications5) running applications
5) running applicationstechbed
 

Más de techbed (20)

1456.base boot
1456.base boot1456.base boot
1456.base boot
 
1455.ata atapi standards - 1-7
1455.ata atapi standards - 1-71455.ata atapi standards - 1-7
1455.ata atapi standards - 1-7
 
1454.ata features
1454.ata features1454.ata features
1454.ata features
 
1432.encoding concepts
1432.encoding concepts1432.encoding concepts
1432.encoding concepts
 
Flash cs4 tutorials_2009
Flash cs4 tutorials_2009Flash cs4 tutorials_2009
Flash cs4 tutorials_2009
 
Photoshop tut
Photoshop tutPhotoshop tut
Photoshop tut
 
Lab 7b) test a web application
Lab 7b) test a web applicationLab 7b) test a web application
Lab 7b) test a web application
 
Lab 7a) debug a web application
Lab 7a) debug a web applicationLab 7a) debug a web application
Lab 7a) debug a web application
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_en
 
Part 7 packaging and deployment
Part 7 packaging and deploymentPart 7 packaging and deployment
Part 7 packaging and deployment
 
Lab 5b) create a java server faces application
Lab 5b) create a java server faces applicationLab 5b) create a java server faces application
Lab 5b) create a java server faces application
 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts application
 
First java-server-faces-tutorial-en
First java-server-faces-tutorial-enFirst java-server-faces-tutorial-en
First java-server-faces-tutorial-en
 
Lab 4) working with databases
Lab 4) working with databasesLab 4) working with databases
Lab 4) working with databases
 
Lab 3) create a web application
Lab 3) create a web applicationLab 3) create a web application
Lab 3) create a web application
 
Lab 2) develop a java application
Lab 2) develop a java applicationLab 2) develop a java application
Lab 2) develop a java application
 
Lab 1) rad installation
Lab 1) rad installationLab 1) rad installation
Lab 1) rad installation
 
6) debugging and testing
6) debugging and testing6) debugging and testing
6) debugging and testing
 
7) packaging and deployment
7) packaging and deployment7) packaging and deployment
7) packaging and deployment
 
5) running applications
5) running applications5) running applications
5) running applications
 

Último

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 

Último (20)

Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 

Part 5 running java applications

  • 1. Rational Application Development certification prep, Part 5: Running Java applications Skill Level: Introductory Gregory Scott (glscott1@us.ibm.com) Senior Learning Specialist IBM 04 Apr 2006 This is the fifth of seven tutorials created to help you prepare for the IBM Certification Test 255, Developing with IBM Rational® Application Developer for WebSphere® Software V6. Explore features for running both standalone and server-side J2EE enterprise applications. Section 1. Before you start About this series Rational® Application Developer for WebSphere® Software is the IBM Software Development Platform that allows you to quickly design, develop, analyze, test, profile and deploy Web, Web services, Java™, J2EE, and portal applications. This series of seven tutorials helps you prepare to take the IBM certification Test 255, Developing with IBM Rational Application Developer for WebSphere Software V6 to become an IBM Certified Associate Developer. This certification targets entry level developers and is intended for new adopters of IBM Rational Web Developer or IBM Rational Application Developer for WebSphere Software V6.0, specifically professionals and students entering into Web development using IBM products. About this tutorial This tutorial explores how to run standalone Java applications using Rational Application Developer and how to deploy desktop or server-side J2EE enterprise applications (including a Web module) to WebSphere Application Server 6. Learn how to change workspaces, as well. Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 1 of 30
  • 2. developerWorks® ibm.com/developerWorks Objectives This tutorial demonstrates not only the ways of running Java applications in Application Developer 6, but some of the differences with earlier versions of the tool. Users of the earlier versions (WebSphere Studio Application Developer versions 4 and 5) will find Rational Application Developer 6 almost identical, except for features related to the associated server. After completing this tutorial, you will be able to run both standalone and server-side applications (such as Web applications) with confidence, use command line arguments from within Application Developer, and create or remove multiple launches. Prerequisites Before taking the first part of this tutorial, Running standalone applications, you need to understand the concepts covered in the first three tutorials of this series: • Rational Application Development certification prep: Part 1, Workbench basics • Rational Application Development certification prep: Part 2, Java development • Rational Application Development certification prep: Part 3, Web development The second half of this tutorial continues with related issues pertaining to WebSphere Application Server 6. Rational Application Development certification prep: Part 4, Working with databases on the data perspective is not necessary for this tutorial, although if you finished it successfully you will save time by continuing with the completed project. System requirements To run the examples in this tutorial, install Rational Application Developer for WebSphere Software or Rational Web Developer for WebSphere Software. Download a free trial version of Rational Application Developer for WebSphere Software if you don't already have a copy of it. The hardware and software requirements for this software can be located at IBM Rational Application Developer System Requirements. Section 2. Running standalone applications in Application Developer Running Java applications Page 2 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 3. ibm.com/developerWorks developerWorks® Step 1: Create or import a standalone application and run it 1. Open Application Developer and accept the default workspace or choose your own workspace. This tutorial assumes C:WebTutorial, which was used by Tutorials 3 and 4, but you can replace that directory with your own. 2. Open the Java perspective by clicking the icon in the upper-right corner, and close any files showing in the editor pane. 3. Create a new Java project called StandAlone. One way to do this is to select File > New > Project > Java. Or, click the icon in the menu bar. Figure 1. Java Project icon 4. In the New Java Project window, type in StandAlone as the name, and leave the defaults. Figure 2. New Java Project screen Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 3 of 30
  • 4. developerWorks® ibm.com/developerWorks 5. In this tutorial you keep the source and bytecode in the current project, but as you see, you have options for managing other locations. 6. Either click Next to see other options available for other projects (but leave the defaults) or click Finish. 7. The StandAlone project now appears in the Package Explorer view. You can code the application yourself, as the following instructions show. Alternatively, using the techniques learned in your previous tutorials, you can import the StandAlone.jar from the Download section to run the application. Please insure, though, that after selecting File > Import, you select Zip file rather than one of the specialized .jar files that relate to J2EE development (such as App Client JAR file, which itself means a file with an xml deployment descriptor in it). This is because for purposes of importing, Application Developer makes no distinction between a standard jar and a zip (although for exporting it does). Also make sure that, when you arrive at the following screen and before clicking Finish, the word StandAlone is showing in the Into folder: Figure 3. Zip file screen Running Java applications Page 4 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 5. ibm.com/developerWorks developerWorks® The StandAlone.jar is unzipped and the classes are added to your StandAlone folder. You can inspect them if you want. To code the application yourself: Select the StandAlone project and either right-click and select New > Package or click the Package icon on the menu bar. 8. Name the package myapps. Figure 4. New Java package screen 9. With the myapps package selected, click on the menu bar the New Class icon, which has the C on it (next to the package icon), or select File > New > Class. Fill in the name of the Java class as MyApplic1, and make sure the main method is checked, as follows: Figure 5. New Java Class screen Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 5 of 30
  • 6. developerWorks® ibm.com/developerWorks 10. Click Finish. 11. Add the following code to the main method: System.out.println("In main of MyApplic1 as of :"); System.out.println(new java.util.Date()); if (args.length > 0){ System.out.println("Your first argument is: " + args[0]); System.out.println("Your second argument is: " + args[1]); } else {System.out.println("You entered no command line arguments"); } 12. Save the file. There should be no errors. Select Run > Run from the menu. The launch window opens. Figure 6. Run screen Running Java applications Page 6 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 7. ibm.com/developerWorks developerWorks® If MyApplic1 is not showing under Java Application in the Configurations section, simply click New and create it. (Alternatively, you can choose from the menu, Run > Run As > Java Application and the new launch gets created for you.) 13. Click Run in the lower-right window. It looks as if nothing happened (unless you happened to have your Console showing, in which case you will see the print statements). 14. If your Console is not showing, click Window > Show View > Console. Figure 7. Show View: Console 15. The Console appears in the bottom pane. You should see the print statements, including the date, similar to this: Figure 8. Console output Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 7 of 30
  • 8. developerWorks® ibm.com/developerWorks 16. You can re-run the application a number of different ways: repeat the Run > Run step from above; use the Run > Run Last Launched sequence; or use the hotkey Ctrl-F11. Now it is time to work with command line arguments in Application Developer. Step 2: Use command line arguments 1. From the menu bar, click Run > Run again. 2. Click the (x)=Arguments tab. Enter two arguments into the Program Arguments section, similar to this: Figure 9. Program arguments text area 3. Click Run. You should see the correct print statements: Anthony is the first argument, and Randazzo is the second. 4. As with command line tools, if you want a string of words to be one argument, use double quotation marks. If you are not familiar with command line arguments, try running MyApplic1 again with a phrase similar to the following: Figure 10. Program arguments text area: 2nd ex As you see, the entire phrase gets returned as the second command line Running Java applications Page 8 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 9. ibm.com/developerWorks developerWorks® argument. Step 3: Create multiple launches What happens if you are switching back and forth between multiple standalone applications? Create a second application and find out, of course! 1. To keep this simple, right-click MyApplic1 and select Copy. Then paste MyApplic1 into the same package. Figure 11. Name Conflict screen 2. Type SecondApp (or MyApplic2 or whatever you want) as the new name. 3. Change the one line of code in SecondApp's main method so the printout is relevant: System.out.println("In main of SecondApp as of :"); 4. If you try to run the selected SecondApp by pressing Ctrl-F11 you still get the printout from MyApplic1. 5. Therefore, select Run > Run, and use the New button again to define the new launch; then click the Run button in the lower-right (or, from the beginning, with the SecondApp selected, simply click Run > Run As > Java Application). 6. As indicated before, the launch gets created and the class's main method runs. Now you will have the correct print statements. 7. At this point, if you use Ctrl-F11, it is SecondApp that runs again. If you want to revert to MyApplic1, then click Run > Run and select it from the list under Java Applications. Figure 12. Run screen: Configurations Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 9 of 30
  • 10. developerWorks® ibm.com/developerWorks 8. Once you no longer need a launch, you can select it and click Delete (next to New) shown above. You have explored the ways to run multiple applications in Application Developer. It is time for server-side considerations. Close any open files in the editor. Section 3. Running Web applications and changing workspaces using Application Developer and WebSphere Application Server 6 In the first part of the tutorial, Rational Application Developer certification prep, Part 3, you saw that you could deploy and run a Web application in one of three ways from the Web perspective: 1. Right-click the servlet class file and click Run on Server (if the servlet .java file does not give the Run on Server option, use the servlet's class Running Java applications Page 10 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 11. ibm.com/developerWorks developerWorks® file instead, as found under the WEB-INF/classes directory). 2. Right-click the desired Web application (for example, FirstWeb in the tutorial Rational Application Developer certification prep, Part 3) and click Run on Server. This option searches the Welcome file list in the web.xml for the first file, for example, index.html, and if found, runs that index.html. If not, it looks for the second file in the Welcome file list and tries to run it, and so forth, through the list. You must create these files to allow this automatic search to work. 3. In the Servers pane, right-click the server itself and select Add and Remove Projects. Add the desired project to the server. This starts the server automatically, at which point you can run a particular servlet or JSP or a Welcome file according to (1) or (2) above. The following section covers additional development issues resulting from using Application Developer 6 and WebSphere Application Server 6, and is especially relevant for previous users of WebSphere Studio Application Developer 4 and 5. Differences between Application Developer and WebSphere Studio Application Developer A little background: in versions 4 and 5 of Application Developer, the so-called WebSphere Test Environments were essentially WebSphere Application Server 4 and 5 respectively, but could be thought of as being internal to Application Developer. That is, if and when one switched workspaces in Application Developer 4 or 5 from, say, C:One to C:Two, and started up the server in the second workspace, a new instance of WebSphere Application Server 4 or 5 would be created that was independent of the server in the first workspace. Hence, there was no problem in having an enterprise application called, for instance, Library in both workspaces. Now, with Application Developer 6, the situation is different. Application Developer 6 gets installed with a basic edition of WebSphere Application Server 6 alongside of it. No longer is there a Server perspective in Application Developer, as there was in versions 4 and 5. Moreover, there is only one set of binaries for WebSphere Application Server 6, and any and all workspaces in Application Developer normally point to a default profile in WebSphere Application Server 6. What is a default profile? You can think of a profile as being an instance of WebSphere Application Server 6. Having profiles allows WebSphere Application Server administrators to create multiple instances of WebSphere Application Server with only one set of binaries. (For more info on profiles, see the Resources section.) Hence, the default profile is the one automatically run if users do not create their own profiles, and indeed developers using Application Developer 6 need not care about profiles as long as they do not change workspaces. However, if the workspace is changed in Application Developer 6, a potential problem occurs, as the following example describes: Assume an enterprise Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 11 of 30
  • 12. developerWorks® ibm.com/developerWorks application named Library had been created in C:One and deployed (which means that Library will also exist in the default profile of WebSphere Application Server 6). If a duplicate, similar, or new enterprise application called Library is created in C:Two and you attempt to deploy it to WebSphere Application Server 6, an error will occur, indicating that the application already exists. There are two solutions to this problem: 1. Create a second WebSphere Application Server profile to be used by the second Application Developer workspace . This solution is beyond the scope of this tutorial, but more information can be found in the Resources section. 2. Uninstall the enterprise application from the server in the first workspace before trying to create or deploy it from the second workspace. You get practice using this solution in the following section using the example from the tutorial "Rational Application Developer certification prep, Part 3", which contained the enterprise application called First (which contains the Web application called FirstWeb). Step 1: Deploy identically named enterprise applications from different workspaces This section assumes FirstWeb was run successfully in Part 3 or Part 4 of this tutorial series. If you did not successfully complete Part 4, use the solution from tutorial Part 3, as the database will not have been set up and connection errors will result from running Part 4 solution code. Before continuing, run whichever solution you are employing to make sure that it has been deployed successfully to the server. You can download the easiest solution from Part 3 if needed. 1. At this stage, your Web application is running (presumably in the C:WebTutorial workspace). You should see something similar to this: Figure 13. Possible output from running Input.jsp of FirstWeb Running Java applications Page 12 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 13. ibm.com/developerWorks developerWorks® 2. In the admin console for WebSphere Application Server 6, right-click the server under Servers and select Run administrative console. Figure 14. Run administrative console choice 3. The login screen opens. Because security is not turned on, you can enter any name or single character (it is for logging purposes only), then click LogIn. The Admin console screen opens. This is the same admin console that administrators work with to control WebSphere Application Server 6. Figure 15. Admin Console screen Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 13 of 30
  • 14. developerWorks® ibm.com/developerWorks 4. Expand Servers > Application Servers under the left Welcome column. You see the default name (server1) and your machine's name (the node). Figure 16. Application servers 5. Likewise, expand Applications > Enterprise Applications. You now see all of the enterprise applications that have been deployed to the application server, no matter what the Application Developer workspace. In my case, I see the following, including the enterprise application First that was created in the third tutorial and is now running, as shown by the green arrow under "Status". Figure 17. Installed enterprise applications Running Java applications Page 14 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 15. ibm.com/developerWorks developerWorks® 6. You can uninstall the First enterprise application either by using the admin console or by removing the project from the Servers pane in the Web perspective (with Add and Remove projects). Because you already know how to use the latter feature, stop and uninstall the First application from the admin console, as explained below. 7. Check the box next to the First application and then click Stop. A message indicating success appears, and the red x appears under Status. Figure 18. Enterprise Applications: Messages 8. Then click First again, and choose Uninstall. Click OK to confirm the uninstall. You should no longer see the First application listed. Equally important, you should see the Save message. You must click the Save link to finish the task, as shown: Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 15 of 30
  • 16. developerWorks® ibm.com/developerWorks Figure 19. Messages: Save option 9. A Save confirmation window appears. Figure 20. Save confirmation 10. Click Save. First is now completely uninstalled. 11. There are many other options you can explore in the admin console, but then you are entering much further into the administrator's realm. For more information on administering WebSphere Application Server, see the Resources section. 12. For the moment, log out of the admin console by clicking the Logout option at the top. Figure 21. Admin console: logout Running Java applications Page 16 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 17. ibm.com/developerWorks developerWorks® 13. Now that you have removed First from WebSphere Application Server, change your workspace in Application Developer, using the steps in the following section, and import the First application into that new workspace. To cover some other issues, export First from the C:WebTutorial workspace and then re-deploy First to insure that it runs from the new workspace. Step 2: Change the workspace and re-deploy 1. Close all files within Application Developer (File > Close All), but leave it running for the moment. 2. Check the running applications in your operating system. If you're running Windows, click Ctrl-Alt-Delete and choose Task Manager > Processes. You should see a javax.exe for Application Developer and another java.exe for WebSphere Application Server and, depending on other software you might be running, there could be other java.exe processes. You will re-examine the Task Manager in a few minutes. Figure 22. Task Manager results: one possibility Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 17 of 30
  • 18. developerWorks® ibm.com/developerWorks 3. Back in Application Developer, drill down in Project Explorer to First > Deployment Descriptor and open it. Click the Deployment tab. This tab is new in Application Developer 6. It enhances your .ear (more information later). For the moment, simply note that if you did not run Part 4 on databases of this tutorial series, you do not see any custom values. If you finished Tutorial 4, select the Cloudscape JDBC provider to remind yourself how you configured it. 4. In WebSphere Studio Application Developer 4 and 5, the database information was not contained in the .ear file. You had to export separately any server information (be it in a project or not) and manually configure the testing WebSphere Application Server to accept the relevant information. In this tutorial that information is merely the database JNDI name and location (assuming you finished Tutorial 4). If you completed Tutorial 4 you should see the following; if you skipped the tutorial, examine a little more carefully the whole screenshot here, simply for your edification: Figure 23. Enhanced .ear: Application Deployment Descriptor Running Java applications Page 18 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 19. ibm.com/developerWorks developerWorks® Now that you have confirmed the information that can exist in an enhanced .ear file, close the descriptor and export First as an .ear: 1. Right-click First and select Export > Ear file. Figure 24. Export EAR 2. Choose your own temporary Destination. Check Export source files and Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 19 of 30
  • 20. developerWorks® ibm.com/developerWorks Include project build (Overwrite is optional in this case). Figure 25. Destination 3. Click Finish. Confirm the ear file is in the Destination directory, then close Application Developer. 4. Now go back to the Task Manager in your operating system, and use the j key to quickly find any process beginning with j. You should find only java.exe -- the javaw.exe representing Application Developer was closed, but the server is still running! 5. To be sure your server does not continue to run, stop it in one of three ways: 1. Before closing Application Developer, stop it from your Servers pane (in a relevant perspective like Web or J2EE) 2. Kill the process from Task Manager 3. Use your WebSphere Application Server command line options to stop it: Go to the following directory, or its equivalent, on your system: C:Program FilesIBMRationalSDP6.0runtimesbase_v6bin. Run the stopserver batch file with the name of your server (recall from the admin console that it was server1). For example: C:. . .base_v6bin>stopServer server1 You see: Running Java applications Page 20 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 21. ibm.com/developerWorks developerWorks® Figure 26. Windows command screen Your server is stopped and the java.exe is gone from the Task Manager process. 6. Open Application Developer into a different, new workspace. For the following steps, it is assumed C:Tutorial5 is the new workspace name you enter when opening the Application Developer. 7. Notice that the tool subsequently opens with the default Welcome window. 8. Close the Welcome pane and switch to the Web perspective if it is not your default. 9. In your Project Explorer window, right-click Enterprise Applications and click Import > EAR file. 10. Browse to the temporary directory with the First.ear file that you exported a few steps back and select First.ear. The other fields are filled in for you. Figure 27. Import Enterprise Application Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 21 of 30
  • 22. developerWorks® ibm.com/developerWorks 11. Click Next. In the next screen, check Import for partial EAR development. Notice the .jar file gets checked automatically. Figure 28. Partial development Running Java applications Page 22 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 23. ibm.com/developerWorks developerWorks® 12. To see any module (namely, FirstWeb) being brought in under First, click Next. Otherwise, click Finish. Stay in the Web perspective if you are asked whether you want to go to the J2EE perspective. 13. In the Servers pane, right-click WebSphere Application Server 6 and select Add and Remove Projects. The following window opens: Figure 29. Add and Remove Projects Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 23 of 30
  • 24. developerWorks® ibm.com/developerWorks 14. With First selected as the Available project, click Add, then Finish. 15. Notice the server is now starting (and the project gets added to it under the covers). Your project is now deployed to WebSphere Application Server 6, more precisely, again, to the default profile of Application Server. If the Server status bar displays Debugging rather than Started, restart the server in Start mode. Figure 30. Restart option 16. Depending on your hardware and processor speed, you might have to wait a minute or three for the restart to finally be successful. Examine the Running Java applications Page 24 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 25. ibm.com/developerWorks developerWorks® Console output to see the status. You need to see the line "Server1 open for e-business" before continuing. 17. To test click Dynamic Web Projects > FirstWeb > WebContent > externaljsp > Input.jsp > Run on Server. 18. Perhaps, surprisingly, you might be asked to select a server. Figure 31. Server Selection screen This is surprising, and perhaps an oddity of Application Developer for this version only, because after the server started, an Add and Remove Projects check indeed showed that First was added to WebSphere Application Server 6. 19. In any event, check Set server as project default. Figure 32. Set Server screen Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 25 of 30
  • 26. developerWorks® ibm.com/developerWorks 20. To confirm that First is an added project, click Next or simply click Finish. 21. Your Input.jsp form should now appear, as follows, and you can enter data. Figure 33. Input.jsp screen If you used the solution from Tutorial 3 (Web application) you get simulated results back, and it does not matter what lastname or account number you used (age was never implemented on the server side in the previous tutorials). If you used the solution from Tutorial 4 (Data perspective), remember that, for the sake of simplicity, the lastname field was never checked against the database in the business logic (although it does get echoed back in the output jsp). Implementing the code to insure that lastname matches the correct account number is left to the reader as a "bonus" exercise. At this stage, the account number is the only crucial element for data input, and must match a relevant piece of data in your database; otherwise, no status is returned from the InitialOutput.jsp (which resides under FirstWeb > WEB-INF > jsp). 22. You probably want to stop the server before leaving Application Developer so you don't leave java.exe running in your processes. In the Web perspective Servers pane, right-click the server and select Stop or, if the server is selected, simply click the Stop icon, the red square. Figure 34. Stop icon If you have drastic problems Sometimes, your application code for a server-side application does not get reflected in the tested code, and simply restarting the server does not solve the problem. Here are some general solutions, from basic to advanced: Running Java applications Page 26 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 27. ibm.com/developerWorks developerWorks® 1. In the test server's popup menu, select Add and Remove Projects. Remove your project, click Finish, and then add it back again. The server needs to be running to do this because adding or removing a project invokes wsadmin tasks on the server. 2. Alternatively, in Application Developer's menu, select Project > Clean.... Be sure to build again after the cleaning, either automatically or through Project > Build.... Do the add/remove projects step detailed above. 3. Incremental building and smart publishing, which is new with Application Developer 6, can get out of sync. If none of the previous fixes work, you must rebuild the default profile, which is the most drastic step of all, short of re-installing Application Developer. Rebuilding the profile can fix a multitude of server-related problems, but obviously will require some work (eight to twenty minutes, depending naturally on your experience). See the Resources section for links to information about rebuilding profiles. Congratulations. You have now completed Tutorial 5. Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 27 of 30
  • 28. developerWorks® ibm.com/developerWorks Downloads Description Name Size Download method Startup code for this tutorial StandAlone.jar 1KB HTTP Information about download methods Running Java applications Page 28 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.
  • 29. ibm.com/developerWorks developerWorks® Resources Learn • The Source for Java Developers is the place to get information on the latest Java JDK (J2SE 5, previously known as J2SE 1.5), including basic Java standalone applications that require a main method or server-side applications, making use of servlets, JSP pages or EJB components, with examples and tutorials. • To get more information on applets, go to J2SE 5 Java DemonstrationApplets. • At J2EE Connector Architecture you will find a number of links on resource adapters and connecting to legacy or enterprise information systems. • The Technical library view provides access to a multitude of free tutorials for mastering development, including how to run various applications, in Application Developer. • The article, IBM Rational Developer: Powerful support for rapid Java and J2EE development, presents an introduction into the various ways to develop and run Java applications using Application Developer. • To learn more about EJB components, take the tutorial Getting Started with Enterprise JavaBeans Technology. • To learn more about version 6 and its profiles, read the article System management for WebSphere Application Server V6. • The forum posting at WebSphere 6.0 -- Creating multiple app server instances on one physical server presents information on using profiles, including instructions on deleting and re-creating the default profile. • The IBM Redbook, WebSphere Application Server V6 System Management & Configuration Handbook, provides information to help you administer WebSphere Application Server 6. • Visit the developerWorks Application Developer zone to expand your Application Developer skills and knowledge. • Get certified as an "IBM Certified Associate Developer". Check out the objectives, sample assessment tests, and training resources for test 255, "Developing with IBM Rational Application Developer for WebSphere Software V6". • Stay current with developerWorks technical events and webcasts. Get products and technologies • Download a free trial version of IBM Rational Application Developer. • Build your next development project with IBM trial software, available for download directly from developerWorks. Discuss Running Java applications © Copyright IBM Corporation 1994, 2007. All rights reserved. Page 29 of 30
  • 30. developerWorks® ibm.com/developerWorks • Participate in the discussion forum for this content. • Participate in developerWorks blogs and get involved in the developerWorks community. About the author Gregory Scott Greg is an instructor in private and public national settings, internal and external to IBM, primarily related to Java client-side and server-side (J2EE) programming. Specializations include servlets, JSPs, Enterprise JavaBeans, portlets, XML and Web Services. Running Java applications Page 30 of 30 © Copyright IBM Corporation 1994, 2007. All rights reserved.