ADempiere 3.6 Cookbook
上QQ阅读APP看书,第一时间看更新

Debugging the ADempiere client application (Desktop version)

Debugging the client version is pretty straightforward and quick. In this recipe, we will see how to configure the project in Eclipse so that we can debug ADempiere when we run it as a client application (the Swing version).

Getting ready

Before we can run ADempiere, there are properties, specific to ADempiere, which need to be configured properly for example, JDK location detail, application server detail, database detail, SMTP detail (for e-mails), and so on. The following steps must be completed to ensure that these properties are set up correctly:

  1. In Eclipse, open the Open Resource window and select the Setup.java file. It is available under the install\src\org\compiere\install package of your adempiere360lts project.
  2. Right-click on the Setup.java file in the Project Explorer and select the option Run As | Java Application. This will launch an ADempiere setup screen.
    Getting ready

    For the client version, we need to set the fields in the following sections of the screen:

    • Java
    • Adempiere
    • Database Server
    • Mail Server (Optional)

    Click on the Test button and if everything was set correctly, you will see the Ok message at the bottom of the setup screen. In case you get errors, verify the values you have entered. Correct them and Test until you get the Ok message. Any errors during the testing are also shown on this window.

    Note

    In case any errors occur during your practice and it is not described in the book, you may refer to the ADempiere Wiki and forums for more information.

  3. Click on the Save button. This will create the Adempiere.properties file in the Adempiere Home directory. After creating the property file, the program tries to build the code base but fails with a build error. Do not worry! Our intention was to only get the Adempiere.properties file created, which we will use in our subsequent setups.

How to do it...

Now that we have got the Adempiere.properties file out, it is a trivial task to be able to debug the application. Here are the steps:

  1. In Eclipse, open the Open Resource window and select the Adempiere.java file. It is available under the base\src\org\compiere folder of your adempiere_360 project. This class is the entry point class for the client version.
    How to do it...
  2. Add a break-point at Line 594 inside the main method.
  3. Right-click on the Adempiere.java file and select Debug As | Debug Configuration. This will bring up the Debug Configurations window.
    How to do it...
  4. Click on the Arguments tab and specify the following VM arguments:
    DPropertyFile="C:\adempiere_svn\tags\adempiere360lts\ADempiere.properties"
    DADEMPIERE_HOME="C:\ tags\adempiere360lts"
    
    • PropertyFile: Points to the Adempiere.properties file, which we had created earlier
    • ADEMPIERE_HOME: Points to the Adempiere folder
    How to do it...
  5. Click on the Debug button to start the debugging.
    How to do it...
  6. Use the toolbar on the Debug window to debug the code. This way, you can figure out how the control is flowing in the ADempiere source code and gain a better understanding of the subject.

How it works...

Adempiere.java is the main class file which provides the entry point for the desktop version of ADempiere. This is the class where you will find the main method. To this class, the two important properties—PropertyFile and ADEMPIERE_HOME must be passed so that it can read the setup information (database, mail server, JRE path, and so on) and run the application.

See also

  • Creating an installer from the source code
  • Installing Adempiere