HelloWorldExample

From Whole Brain Catalog

Jump to: navigation, search

Contents

[edit] Hello World Developer Example

This document will describe the developer example relating to the use of Maven in the development of a humble hello world application.

Ever wondered how the technologies used in the production of a tool like the Whole Brain Catalog come together? Our new team member, Ruggero Carloz, has put together a bare-bones "Hello World" example that marries the basic Whole Brain Catalog open source technologies. This provides a great template for building other applications and demos in this style. The basic framework is already in place in our volume rendering example, our MCell COLLADA example, and our neuron cloud example.

The technologies used here include:

You can check out this documentation to see how we pull these technologies together to make a simple, deployable Swing app that is version controlled and managed by Maven.

[edit] How to Install

[edit] From Eclipse

I. First, install and download eclipse and the Maven Plugin Instructions Here.

  1. Checkout a new project from SVN; http://wholebrain.googlecode.com/svn/HelloWorld/trunk.
    1. Window->Show View->Other...
    2. Choose SVN->SVN Repository.
    3. Right click within the SVN Repository View that comes up and click New->Repository Location...
    4. put: https://wholebrain.googlecode.com/svn/ If asked about a digital certificate, Accept Permanently.
    5. Navigate down to, and right click on the HelloWorld/ folder and choose Checkout...
      1. You will be prompted to check out the project. Choose "Check out as a project configured using the New Project Wizard".
      2. In the "New Project" window that pops up, select Java->Java Project and hit Next.
      3. In the next window, pick a project name you like (for example, "HelloWorldExample")
      4. Click "Finish" and hit OK to any windows that popup.
  1. Right-click on the project, and from the Maven submenu, click "enable dependency management".
  2. Right click on the project and look at Build path...->Java Build Path->Libraries tab. Click on the arrow to open up the JRE system library. Make sure this is pointing to a jdk 1.5 that is loaded on your machine. If it isn't, then press the Add Library... button and install a new JRE System library that does point to 1.5. On windows, its usually under C:\Program Files\Java. If you can't find a 1.5 JDK, you'll need to download it.
  3. Create a new run configuration.
    1. Select Run > Run Configurations:
    2. Under "Maven", create a new run configuration. Name it "clean install". Make the workspace the root under your new project. In the box called "goals" type "clean install". Run this.

[edit] How to Run

[edit] From Eclipse

Under eclipse, right click on the folder containing your hello world application. Scroll down and under the "Run As" option click on "Java Application".

[edit] From a command line

We use Maven to build our code. The first thing to know about Maven is that it provides the "single command" ability to build an entire code base. With SVN and Maven installed you can issue the following commands to download and build the entire source:

svn co http://wholebrain.googlecode.com/svn/HelloWorld/trunk HelloWorldExample
cd HelloWorldExample
mvn clean install

The one caveat to this is that you need to place a single configuration file called settings.xml in your Maven directory. Your Maven directory is located at ~/.m2 on linux/mac, C:\Users\[username]\.m2 on Vista, and C:\Documents and settings\[username]\.m2 in Windows XP. You can download our copy of the settings.xml file here.

After this is finished (will say BUILD SUCCESSFUL), you'll find within HelloWorldExample/target a file called HelloWorldExample-X.X.X-SNAPSHOT-release.zip (X.X.X is in place of version numbers). Unzip this and you should find a run.bat file and a run.sh file. Use the run.sh file to run in Linux/Unix and the run.bat file to run in Windows.

[edit] Running Java Network Launching Protocol

If you wish to execute the application's JNLP please go to the link http://ccdb-dev-db2.crbs.ucsd.edu/helloworld/. This server contains the JNLP for the small hello world application.

Click on "HelloWorld.jnlp". You will be prompted to open the JNLP file with Java's Web Start Launcher. If this is not the case choose Java's Web Start Launcher by selecting "Open with" and choosing the application from the scroll bar. Once the above step is completed click "OK" and "Run".

Personal tools