Run Project In Eclipse

From JRapid

Jump to: navigation, search

Contents

Introduction

JRapid provides every project with a cloud development environment where the application runs allowing the preview of the generated code instantly. These servers have limited characteristics, depending on their type.

An important characteristic for the Shared Servers is that they do not allow developers to upload custom code. But if you need to test a customization before deciding to move your project to a Dedicated Server in the JRapid Development Cloud, you may run a local copy of your project from within an embedded Apache Tomcat in your Eclipse installation.

This is also very useful if you need to perform step by step debugging on your code.

Install Apache Tomcat Servlet Container

Download the corresponding distribution for your development environment from here. We recommend downloading the zip file with no installer. Unzip the contents of the downloaded file to a known location in your disk or follow the installation instructions here.

Download JRapid Required Libraries and Add Them To Your Tomcat Installation

Download the JRapid Required Libraries from here and unzip the contents to the common libraries directory of your Apache Tomcat installation. This folder may vary from version to version. The installation folder for Apache Tomcat is commonly referred as $CATALINA_HOME.

For projects in version prior to 1.0nb80, download required libraries from here.

  • Tomcat 5 / 5.5: $CATALINA_HOME/common/lib/
  • Tomcat 6 and 7: $CATALINA_HOME/lib/

Create Server Runtime Environment in Eclipse

Run your Eclipse installation and go to Window -> Preferences.


File:run1.jpg


Use the filter on the top left to search for "Runtime Environments".


File:run2.jpg


Click on the Add button to create a new Server Environment.


File:run3.jpg


Select the corresponding type of runtime environment, making sure the Tomcat version matches the one you downloaded and installed before.


File:run4.jpg


Enter a name and the path to the installation directory, and click Finish.

Create Server

If the Servers view is not being shown, go to the Window -> Show View -> Servers menu option.


File:run5.jpg


Right click on the Servers view and select New -> Server.


File:run6.jpg


Select the server type, name and the Server Runtime environment you created on the previous section and click Finish.


File:run7.jpg


The new server is listed in the Servers view.


File:run8.jpg

Download your project to Eclipse

Follow the Getting Started with Eclipse guide in order to get the JRapid Eclipse Plugin installed and learn how to synchronize your project with a local copy in your local machine.

As we're going to configure the project to run with the newly created server runtime, that already includes all the JRapid required libraries, you should choose not to download or add the JRapid User Library to the building path of this project.

If you have not already downloaded the libraries, you may click on the Cancel button when the plugin prompts for a location to install them.

File:run9.jpg

Then, right click on the downloaded project and select Properties. Go to the JRapid Properties pane. Mark as true the "Do not check for JRapid Required Libs in build path" option.

File:run10.jpg

If you have already downloaded the libraries or the project is already including them in the building path, make sure to remove them by following this simple steps.

Right click on the project in the Project Explorer and select Build Path -> Configure Build Path ...

File:run11.jpg

Switch to the Libraries tab, select the "JRapid Required Libs".

File:run12.jpg

Click the Remove button and click OK.

Configure Project's Build Path

Right click on the project in the Project Explorer and select Build Path -> Configure Build Path ...

File:run11.jpg

Switch to the Libraries tab and click on the Add Library ... button.

File:run13.jpg

Select the Server Runtime option and click Next.

File:run14.jpg

Select the runtime created in the previous sections and click Finish.

File:run15.jpg

The library is added to the project's build path.

File:run16.jpg

Click OK to save the changes and close the window.

Configure Web Modules on the Server

Double click on the Server name in the Servers view to open its configuration file.

File:run23.jpg

Switch to the Modules tab by clicking on the link at the bottom of the editor.

File:run17.jpg

Click on the Add External Web Module button.

File:run18.jpg

Browse your system to find your project's folder in the Eclipse workspace. Be sure to select the WebContent folder in the project's folder as the document base. Enter a Path for accessing the application using your browser. Do not check the auto reloading option.

Click OK.

File:run19.jpg

The Web Modules list shows your project but the file is not saved yet. Make sure you press CTRL + S to save the contents of the file.

File:run20.jpg

Run the Application

Go to the Servers view, right click on your newly created Server and select Run.

File:run21.jpg

Point your browser to the corresponding URL and the application should be running there.

File:run22.jpg


Local Database

It's important to note that this application will still be using the development database schema hosted on the JRapid Development Cloud. There's no problem with doing this, other that you may find it a little bit slower than running your app against a database hosted in your local machine as well.

To do this, you must first install a local MySQL server and configure the database connection properties. You may also choose to dump the contents of the schema on the cloud and use it to populate your local database schema in order to bring along any test data you might have already created.

See Also

Important

If Using Parameters with Slashes

If your application defines services that allow parameters with values that include slashes, such as dates, you must configure Apache Tomcat to allow them. To do this, set theorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH system property to true. You can do this in the CATALINA_OPTS variable on start up. See Apache Tomcat Configuration Reference here: http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html

Personal tools