AMAPstudio

# Eclipse

### Presentation

Eclipse is an IDE (Integrated Development Environment). It intends to facilitate the developer's work with integrated tools. Interesting features are:

• a powerful editor with completion and refactoring capabilities
• version repository access (CVS, SVN)
• debugging tools / profiling
• test framework

You don't need to use Eclipse to integrate your model in Capsis. Eclipse IDE has very advanced functionalities and can be a bit complex for occasional programmers. If you are not sure that Eclipse is for you, you can still use your own editor (like Notepad++, TextPad or SciTE), see below.

We recommend to use the last version of Eclipse : 2019-09 (at last documentation editing time)

### Build Capsis

• Capsis4 will be imported as a Java Project. Eclipse will manage compilation.
• You need to customize the Java build path:
• go in the project's Properties > Java Build Path
• in Source tab:
• ensure that Output folder (Source folders on build path section) and Default output folder are set to capsis4/class
• some patterns have to be excluded: capsis/lib/numerics/ , crobas/ and scilab/

• in Libraries tab:
• ensure that all .jar from capsis4/ext are in the Java Build Path ; if needed, add them by using the Add JARs… button;
• ensure also that the JRE (Java Runtime Environment) installed on your machine is in the Java Build Path ; if needed, add it by using the Add Library… button, choose JRE System Library then Alternate JRE and choose the JRE installed on your machine.

### Run Capsis

• Click on the Run Button.
• You can add a particular configuration
• Run → Run configuration
• Select Java Application
• New launch configuration
• Specify the main class (here capsis.app.Starter)

### Troubleshooting

• If you have to press twice the run button before Capsis really starts then replace the file capsis4/.project by the following one :
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>capsis4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
• If the visu 3D do not work when you launch capsis with Eclipse under Windows, then add the path of the corresponding nativewindow_jvm.dll among your system variables. For example, for a windows 64 : /capsis4/ext/windows64/nativewindow_jvm.dll (does not work with recent version of eclipse)

Notepad++ is an open source and powerful code editor for Windows. Features:

• Coloration
• Easy indentation
• Integrated console
• Powerful search functions…

### Configuration with Capsis

• In menu → plugins → NppExec → Excecute : enter the command you want to execute, for instance :
• C:\capsis4\ant.bat compile

TextPad is a general purpose editor with coloration and compilation command for Windows.

TextPad is a shareware (It is not an Open Source / Libre Software).

### Configuration with Capsis

• Open Configuration panel : ConfigurationPreferences
• Click on the Tools item
• Delete existing java tools with the delete button (red cross).

(This way, compile in Capsis will be the first entry in the menu with the usual shortcut CTRL+&. The standard Java tools will be restored later.)

• Click AddProgram and select your_capsis_directory/src/javac_capsis.bat
• Click Add → Java SDK Commands to restore previously removed java tools.
• When editing a java source file, you can compile with the following command : Tools → external tools → Compile

### Configuring Textpad to open the file in error at the given line

After a compilation, if there are errors, it is possible to double click on the “file:line” reference to open the file for correction.

Check this configuration :

• Configuration > Preferences > Tools
• Select javac_capsis
• Check the regular expression in the matching field (1)

If trouble with the expressions (double clicking does not open the file):

• Help > “Regular expressions matching the compilation errors” link
• Copy the expression for java; e.g. ^$[A-Za-z]:[^:]+$:$[0-9]+$:
• Paste it in the field (1) upper

# SciTE (Linux user)

Scite is a simple editor available on Linux system. Use your system installer to install it.

For instance, for Ubuntu distribution use:

sudo apt-get install scite

### Configuration with Capsis

• Go to Options → Open User Options file
• Add the following lines in the file (Replace my_capsis_dir by the full path of your capsis4 directory)
command.compile.*.java=sh my_capsis_dir/bin/javac_capsis.sh $(FileNameExt) command.build.*.java=sh my_capsis_dir/bin/javac_capsis.sh$(FileNameExt)
command.go.*.java=java \$(FileName)
• Save the file

You can now compile in Scite !!

See this note if you want to compile Capsis and Jeeb in Scite.