Brief instruction JAMS development
(→Creating Directories) |
(→Preparing the Workspace) |
||
Line 11: | Line 11: | ||
==Preparing the Workspace== | ==Preparing the Workspace== | ||
− | ===Downloading | + | ===Downloading Sources=== |
All sources and scripts of JAMS and its models are managed within a subversion (SVN) repository [http://subversion.tigris.org]. Subversion is a software for version management of files and directories [http://en.wikipedia.org/wiki/Subversion_%28software%29]. In order to access the JAMS-SVN, a valid SVN account is required. For read-only access the account "guest" with password "guest" can be used. For the installation of a JAMS work environment, first the required directories are created and filled with data from the SVN repository. | All sources and scripts of JAMS and its models are managed within a subversion (SVN) repository [http://subversion.tigris.org]. Subversion is a software for version management of files and directories [http://en.wikipedia.org/wiki/Subversion_%28software%29]. In order to access the JAMS-SVN, a valid SVN account is required. For read-only access the account "guest" with password "guest" can be used. For the installation of a JAMS work environment, first the required directories are created and filled with data from the SVN repository. | ||
# create directory for JAMS (the example used below is c:\jams) | # create directory for JAMS (the example used below is c:\jams) | ||
# create directory for models (the exmaple used below is c:\jamsmodels) | # create directory for models (the exmaple used below is c:\jamsmodels) | ||
− | |||
# right click on c:\jams -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jams/trunk as repository URL -> OK | # right click on c:\jams -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jams/trunk as repository URL -> OK | ||
# right click on c:\jamsmodels -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jamsmodels/trunk as repository URL -> OK | # right click on c:\jamsmodels -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jamsmodels/trunk as repository URL -> OK | ||
− | # right click on c:\jamsmodeldata -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/modeldata as repository URL | + | URL -> OK |
+ | |||
+ | ===Downloading Data=== | ||
+ | JAMS-SVN also containts a repository with a number of (test) datasets for various models. Please be aware that the overall amount of data in the modeldata repository might be very large. Only single sub-folders should be downloaded here. | ||
+ | |||
+ | # create directory for model data (the example used below is c:\jamsmodeldata) | ||
+ | # right click on c:\jamsmodeldata -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/modeldata as repository but don't checkout yet | ||
+ | # use the browse button (right of the repository URL) to select your desired data folders (multiple folders can be entered by holding CTRL) | ||
===Directory Structure=== | ===Directory Structure=== |
Revision as of 09:00, 4 June 2012
Contents |
Introduction
The following instruction describes the installation of a JAMS/J2000 development environment using Tortoise (SVN client) and NetBeans (Java-IDE). Of course, alternative software can be used as well.
This instruction is intended for users who want to extend JAMS or who just like to know what exactly happens in JAMS and/or the process components. Moreover, setting up the development environment helps to find and eliminate error sources.
Installation of Required Software
- Tortoise SVN (http://tortoisesvn.tigris.org)
- NetBeans/Java (http://java.sun.com/javase/downloads/netbeans.html)
Preparing the Workspace
Downloading Sources
All sources and scripts of JAMS and its models are managed within a subversion (SVN) repository [1]. Subversion is a software for version management of files and directories [2]. In order to access the JAMS-SVN, a valid SVN account is required. For read-only access the account "guest" with password "guest" can be used. For the installation of a JAMS work environment, first the required directories are created and filled with data from the SVN repository.
- create directory for JAMS (the example used below is c:\jams)
- create directory for models (the exmaple used below is c:\jamsmodels)
- right click on c:\jams -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jams/trunk as repository URL -> OK
- right click on c:\jamsmodels -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/jamsmodels/trunk as repository URL -> OK
URL -> OK
Downloading Data
JAMS-SVN also containts a repository with a number of (test) datasets for various models. Please be aware that the overall amount of data in the modeldata repository might be very large. Only single sub-folders should be downloaded here.
- create directory for model data (the example used below is c:\jamsmodeldata)
- right click on c:\jamsmodeldata -> SVN Checkout and indicate http://svn.geogr.uni-jena.de/svn/modeldata as repository but don't checkout yet
- use the browse button (right of the repository URL) to select your desired data folders (multiple folders can be entered by holding CTRL)
Directory Structure
As a result, three directories for JAMS, JAMS models and model data are available after the last step.
In addition to JAVA sources, the JAMS directory contains JAMS binary data and some Ant scripts [3] which can be used to create them easily. Moreover, some pre-configured NetBeans projects are in the directory which allow an easy installation of a JAMS development environment.
The model directory contains sub-directories with JAVA sources of different model libraries, which include model components required for creating JAMS models.
The data directory contains model definitions and input data for different model applications.
Compiling JAMS and Models
JAMS Binary Packages
Creating new JAMS libraries is not necessarily required since the JAMS SVN repository contains a current version of all necessary libraries (directory c:\jams\lib). Creating a JAMS development environment and transferring JAMS libraries is only required if JAMS or its standard components are supposed to be modified or debugged. If only components of JAMS models are supposed to be modified, the next step is shown in section: Models.
Ant Scripts
In order to create a current version of JAMS libraries, the installation of a development environment is not obligatory. An alternative Ant script can be used via c:\jams\build\build.xml, which centrally carries out the transformation and compilation of all required resources. The prerequisite for this is the installation of Apache Ant, which can be downloaded at http://ant.apache.org/bindownload.cgi.
The creation of JAMS libraries with Ant requires the following procedure:
- open command line in the directory c:\jams\build,
- call command "ant clean" for deletion of existing JAMS libraries,
- call command "ant" for creation of all JAMS libraries.
These steps can also be carried out by executing a batch file via c:\jams\build\build.bat. Finally, the directory c:\jams\bin will be filled with JAMS libraries which contain all necessary system classes and different standard model components. Together with the external libraries in c:\jams\lib they make available the JAMS API, the runtime environment, and different graphic surfaces for the creation and execution of models or the evaluation of model results.
Installing the Development Environment
JAMS
For JAMS pre-configured NetBeans project directories are already in the SVN repository. To open them, select File -> Open Project... ,choose the "jams-starter" project from c:\jams\nbprojects and tick the "Open Required Projects" checkbox. In order to compile JAMS right-click on "jams-starter" -> Clean and Build. When doing so, all necessary libraries are created and are automatically copied to c:\jams\lib.
Models (e.g. J2000)
- In NetBeans: File -> New Project -> Java Project with Existing Sources
- Indicate project name (e.g. J2000) and directory (e.g. c:\nbprojects\J2000)(the compiled classes and the JAR file are stored here) -> Next
- Source Package Folder -> Add Folder -> c:\jamsmodels\J2000\src -> OK
- Finish import
- Include libraries: right click on J2000/Libraries -> Add JAR/Folder... and select the JAMS libraries jams-api.jar and jams-main.jar from c:\jams\lib\lib. Alternatively, the corresponding projects (c:\jams\nbprojects\jams-api und c:\jams\nbprojects\jams-main) can be integrated directly with "Add Project...", but the transformation will take longer.
- Right click on J2000 -> Clean and Build (Compile project and create J2000.jar in c:\nbprojects\J2000\dist\)
These steps are repeated for all other projects which should be installed (e.g. J2000g and JAMSComponents). There are differences according to the size of required libraries (e.g. J2000g also requires J2000). In all model projects at least the libraries jams-api.jar and jams-main.jar have to be integrated.
Template for JAMS Components
A component template for NetBeans can be found at c:\jams\template\JAMSComponent.java (adapt if necessary!). The integration into NetBeans is done as follows:
- Tools -> Templates -> Java -> Add...
- Select above-mentioned file -> Add
Afterwards, "JAMSComponent" can be selected file type when creating a new class.
Executing JAMS/J2000
In order to execute JAMS (JAMSLauncher or JUICE) the project jams-starter (c:\jams\nbprojects\jams-starter) is opened as main project (see checkbox in the project open dialog). This project does not contain any JAVA sources but all libraries required for starting JAMS and two start configurations (JAMS launcher and JUICE). You can switch by using the drop-down box in the NetBeans toolbar. The project is started using F6, the start button in the NetBeans toolbar, or the context menu (right click on jams-starter). The arguments given at the start can be modified as follows:
- Right click on jams-starter -> Properties -> Run
- Under "Arguments" insert the following: -c <complete path of a configuration file> -m <complete path of a model definition file>. A list of valid arguments will be shown in the default output when using the arguments -h or --help.
In the default configuration the JAMS Launcher or JUICE is supposed to be opened. Via File -> Load model... a model can be loaded.
The execution of most models also requires the provision of additional libraries (e.g. J2000.jar and jams-components.jar). Via Extras -> Change settings... additional libraries can be indicated which can be used for the model execution. This also includes all libraries which model components might be dependent on. When finishing the JAMS launcher the settings are automatically saved in the system configuration.
Note: After modifying model components the JAR file always has to be re-generated with the components before the execution. (Step 6 in "Installing the Development Environment/Models")!
Please note:
For the functions of 3D visualization (in the JAMS default components MapCreator3D and corresponding class Styled3DMapPane or in the WorldWind Viewer) platform-dependent libraries are required, which are in directory "c:\jams\bin". If those functions are used, the corresponding path with parameter "-Djava.library.path=[Pfad]" has to be entered when starting JAMS/JUICE. In order to do so, the property dialog is opened by jams-starter (right click -> Properties) and under Run the corresponding value is inserted into the field VM Options.
As a result, a corresponding call in the command line of JAMS for 64-bit Windows systems could go like this:
java -jar juice-starter.jar -Djava.library.path=c:/jams/bin/win64