User Tools

The Run pilot: how to launch runnable apps directly from the command line

Some tools in capsis may have a main() method and may be launched directly from the terminal. This is the case for some Extensions in the Tools menu (e.g. MemoryMonitor).

To run such an app, it is possible to use directly a java command.

# Launch QuestKnotsViewer with java
java -cp class:ext/*

The Capsis Run pilot

It is also possible to run them with the capsis Run pilot. To make them runnable, they must be added in the etc/capsis.apps file, with a shortName and their fully qualified className.

It is then possible to launch them with the capsis multi-os scripts.

# E.g. run QuestKnotsViewer under Linux / Mac in french
sh -p run QuestKnotViewer

# E.g. run QuestKnotsViewer under Windows in english
capsis -l en -p run QuestKnotViewer

QuestKnotViewer standalone app in french QuestKnotViewer standalone app in english

It is possible to ask the Run pilot to tell what apps can be launched, it will return the list found in etc/capsis.apps.

coligny@marvin-13:~/workspace/capsis4$ sh -p run list
-> OS/JVM/memory: linux/64/1024m
Capsis 4.2.3, (c) 2000-2014 F. de Coligny, S. Dufour-Kowalski (INRA-AMAP) and the Capsis modellers
The core of the Capsis platform (packages capsis.*) is free software 
and you are welcome to redistribute it under certain conditions. 
Some components in other packages may not be free. See licence files.

Capsis 4.2.3-9130 with pilot correct boot at 24 Mar 2015 17:28:49 CET
Working dir: /home/coligny/workspace/capsis4

Available apps in /home/coligny/workspace/capsis4/etc/capsis.apps
  - MemoryMonitor: capsis.extension.generictool.MemoryMonitor
  - QuestKnotViewer:

Optional: specific features for technical tuning

When using the Run pilot to launch interactive apps, some features may be set to get a better result, especially if the app was developed in Capsis (e.g. the QuestKnotViewer extension can be opened on an Artemis project, it is a Capsis ObjectViewer extension). See below and in the main () methods of the known apps to get an overview of the main options available.

public static void main(String[] args) {
	// This line ensures the main Capsis features will work correctly: 
	// Log.println (), Translator.swap (), Engine.getInstance (), etc.
	// Start and init an underground capsis
	C4Script s = new C4Script();
	// Alert.print () messages will go to the terminal or to a dialog
	// This app has a gui, alerts will appear in dialogs (else in terminal)
	// Main images will be found (button icons...) and the main translations will be available
	// Setup gui related things
	// The app will adopt the look and feel of the system
	// Set system look & feel
	try {
		// This one is always available
	} catch (Exception e) { // ...should always be available
		System.out.println("Could not set System Look & Feel:" + e + ", passed");
	// If the app is a frame, tell that closing it will stop the application, 
	// set its title, its size, tell the operating system will take care of its location
	// (may be interesting on a dual screen system)...
	f.setSize(500, 700);
documentation/runnableapps.txt ยท Last modified: 2015/03/24 17:19 by coligny