J2EE Enterprise Design Patterns | how to configure web.xml (Or Deployment descriptor) | Java Application using MyEclipse Debugging | Scala Language

Archive for the ‘Java with MyEclipse’ Category

Java Application with MyEclipse

Developing Java, J2EE application using available editors like MyEclipse, eclipse, NetBeans and other editor, I have always found so many developers wondering which editor good to develop any java application. After having 2 plus years experience, I found MyEclipse is best way to create new java application, maintain, debug, deploy web application, configure server hot deployment mode, install new plug-in, configure external server and using single click start and stop server is too easy.
My purpose to write this blog is to show you how to use editor effectively when you are developing Java application with MyEclipse. Below I have tried my level best to explain all basic features of MyEclipse.

Create web application and Configure Server with Eclipse

Below snap show you simple MyEclipse editor.1

Second snap show how to create web application.

.2

.3

Click on finish to create skeleton of sample web application.

MyEclipse inbuilt provide MyEclipse Tomcat, so no need to configure external server.

.4

But what if you want to configure external server. See below snap for configure external server. After click on Configure Server show on above snap.Configure Server open window which shows different server and according to your requirement configure with eclipse.

.5

Always launch you server in debug mode because debug mode server take instance changes from change in application so don’t need to restart your server after change in java code. So for hot deployment always launch your server debug mode.

.6

Now after creating web application and configuring web server, now it’s time to deploy application with server. Deploy application with another editor is too massy and long process, but with MyEclipse web application deployment is too easy and with single click. For deploy web application with MyEclipse see below snap. Click on box show in red box. Which open another window and shows all projects, select project which you want to deploy. After select your project click on Add button. After click on add button open another window with configure all server with your MyEclipse IDE. Select one server and press Finish button and then click Ok button. Using these simple step you application successfully deployed with selected server. If you want to remove application from server simple click on Remove button. If you want to re-deploy your application click on Redeploy button. And if you want to look at deploy directory structure at server click on Browse button.

.7

.8

.9

.10

.11

Now you are just some step behind to run your web application with your browser. Start your server just clicking single click.

.12

After starting your server just open your browser and hit request
http://localhost:8080/ SampleApplication
You will get your index page.

.13

Now you start to make web application according to your requirement. Just create package for Java classes at src folder and create jsp for your view part.

Debugging application with Eclipse

How to debug your application with your IDE. Debug will makes your life easy and provide you to fast solution of exception or error. You get direct idea about which variable contains wrong value and what is the reason behind variable contains wrong value.

First follow the basic step describe below.

  • Make sure your server start in debug mode.
  • Mark break point at java class.
  • Hit browser request to send control at your mark break point.
  • Remember F5, F6 and F8 three main keys to debug application.
  • F5:- F5 user for step into particular line.

    F6:- F6 use for execute line and get control to next line.

    F8:- F8 uses for resume you’re debugging from that point or go to next break point if next break point available.

    First mark break point where you want your application flow stops for you. After putting break point hit request your browser for test your java class. Now you saw in green color flow of control reached at given break point. Press F6 for execute that line and go to next line. Now if you want to inspect the value of you variable simple select variable and just press Ctrl+Shift+i (Short cut for Inspect). That will open window and show you value of your variable. Using inspect you can check your variable value and get idea about all variable contains correct value or not.

    .14

    .15

    .16

    .17

    .18

    If you want to step into particular statement Press F5. For example if you inspect your method execution press F5 at your method call, F5 transfer your debugging control to line where you press F5.

    .19

    .20

    At variable section you can also inspect your variable.

    .21

    .22

    If you still have any query and doubt please feel free to ask me question.

    Thanks,
    Nishan Patel
    SCJP 1.5, SCWCD 1.5
    Java Developer
    Enterprise Design Patterns
    Configuring an Application with a Deployment Descriptor

    Advertisements