Getting started with NetBeans

Getting started with NetBeans

This page explains how to get started with the Market Runner tutorials under NetBeans. Although NetBeans is not our main development platform, Market Runner is fully compatible with this environment. Let's see how they integrate with each other.

Prerequisites

This tutorial applies to Netbeans 6.8 and Sun Java 6 SDK. Other versions may work as well, but with minor differences in screen disposition.

Market Runner

First, you will need an install of Market Runner. In this step, we just download a fresh copy and unpack it in any location we like. This step is the same as the one described in the Eclipse tutorial.

Downloads.png

Unzip.png

Creating a project

Open NetBeans.

EmptyNetbeans.png

To use Market Runner inside NetBeans, you will need a Java project. Use menu "File->New Project", and then category "Java", Projects "Java Project with Existing Sources". Then click "Next".

NetbeansNewProject.png

Then, name the project to what you like (here MyStrategies) and use button "Browse" to direct NetBeans to the tutorials included with Market Runner. We will use the samples provided for Eclipse, as they work pretty much the same under NetBeans. So have NetBeans use "MarketRunner/eclipse/MyStrategies" as project folder. Then click "Next".

NetbeansBrowseSource.png

There, you will have to tell NetBeans about the source folder under the project folder. This one is "Marketrunner/eclipse/MyStrategies/src". Use the "Add folder" button next to "Source Package Folders" list, and specify the appropriate folder.

NetbeansBrowseSourceFolder.png

Now you can click "Finish", and you've got a project with the samples' sources at hand.

Compile time and runtime dependencies

Market Runner depends on a number of included libraries both to build and to run the strategies. In this step, we will add some options to our project so that NetBeans can find and use them.

Right-click on your newly created project, and click on "Properties" in the popup menu. Then, in the "Categories" list, click "Libraries" to configure libraries. Make sure the "Compile" tab is enabled, and click "Add Jar/Folder".

NetbeansAddLibrary.png

There, you will be able to select all the included libraries. Choose "Marketrunner/libs" folder, select all elements there (using Ctrl-A or the mouse) and click "Ok".

NetbeansAddAll.png

And that's it. Netbeans uses the compile-time libraries at runtime, so you don't need to include them as runtime libraries. Just click "OK" to close the properties dialog, and you're done.

Running a sample

To run a sample locally, one more step is required. You'll have to configure NetBeans so that it uses Market Runner to launch your strategy.

Right-click your project, and select "Properties", then "Run" category. There, you'll have to input the following information:

Main Class:

com.algodeal.MainStrategyRunner

Arguments:

./com/marketrunner/strategies/tutorial/Tutorial01.java

(or any other path to your strategy file - remember to change this if you create a new strategy or try another sample)

Working Directory:

MarketRunner/eclipse/MyStrategies/src/

NetbeansRunProperties.png

Now, if you hit the Run button or F6, Market Runner will run your strategy locally. And that's it! You've got Market Runner working under NetBeans.

One more thing

To fully get advantage of Algodeal compute grid capabilities, you will sooner or later want to run a strategy on the remote grid.

To do so, just add the following to the "Run" configuration right after the strategy file name:

-url https://beta.algodeal.com -u {username} -p {password} -sources {path_to_project}

(The path to project is most probably what you input as the working directory in previous step)

And you're done. The strategy will now run on the web.

This is the end of this tutorial. Hope it will help you enjoy Market Runner in your prefered IDE. Please do not hesitate to comment on it so that we can make it even better. See you soon...

Recent Discussions

10 Sep, 2010 01:40 PM
10 Sep, 2010 09:40 AM
10 Sep, 2010 09:40 AM
10 Sep, 2010 05:39 AM
10 Sep, 2010 05:39 AM