Board index FlightGear Development Aircraft Flight dynamics model

JSBSim and Java

Good sims require good FDMs (the "thing" that makes an aircraft behave like an aircraft).

JSBSim and Java

Postby zdw » Tue May 14, 2019 11:13 am


is please there any reasonable way to use JSBSim (source code or binary) in Java code ?

Thank you in advance.
Posts: 2
Joined: Sat Dec 25, 2010 2:07 pm

Re: JSBSim and Java

Postby Gijs » Thu Jun 13, 2019 9:54 am

Hi zdw,

You may have better luck asking at the JSBSim-devel mailing list. See

Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Posts: 9457
Joined: Tue Jul 03, 2007 2:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: JSBSim and Java

Postby abassign » Mon Jun 17, 2019 7:02 am

zdw wrote in Tue May 14, 2019 11:13 am:Hello,
is please there any reasonable way to use JSBSim (source code or binary) in Java code ? ...

Interesting question that I often do too ...
JSBSim is written entirely in C ++ and has a Python interface to be used in that development environment. Years ago someone tried to do a development in Java, but unfortunately it didn't go beyond a development concept. I think the reasons are many ...
The first problem is speed, JSBSIm is fast and efficient as it performs a pre-compilation of the XML that generates a vector of calls to functions that are executed with a standard rhythm (can be varied) of 1/120 of a second. This means that the code must be light, otherwise the CPU will load too much.
Unfortunately JSBSim is simple and does not have systems for the optimized management of the modules (for example executing them only when the input variables have changed) and therefore, in its current form, the content of the modules is reduced to the minimum terms of complexity. I developed a module 6 months ago for JSBSim (linear actuator) and it was not easy as it is necessary to guarantee the maximum efficiency and quality of the code. Java would be a good thing and it would allow to insert specialized modules to load just-in-time, thus reducing the complexity of the environment. But in this case it should be deeply rewritten and a part of the advantages of the XML used to program it would be lost. For FGFS, however, some improvements could be made, for example separating the JSBSim thread from the FGFS threads, it is a work that concerns the interface that connects JSBSim with FGFS to the property tree. Interface that should definitely be updated.
In fact a JSBSim conversion to Java I don't know if it makes sense, maybe it would make more sense to do a Java frawork of more or less specialized functions that implement the Data Driven logic of JSBSim and maybe eventually replace the NASAL language script that I find simply horrible , although certainly useful. In other words, a deeper work should be done that JAVA would certainly have the ability to perform correctly and not only, but in this way we could finally have the code executed, with sufficient computer security. In fact NASAL is a loose cannon, as I don't know what it does because it has complete access to the file system of the host computer, if an ill-intentioned person wrote about the evil NASAL code, it would be difficult to understand. There are methods to isolate the system, but they are certainly not for everyone. Java from this point of view is very effective and generates a highly protected environment that would make the use of FGFS safer.
Posts: 844
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: JSBSim and Java

Postby legoboyvdlp » Mon Jun 17, 2019 7:23 am

In fact NASAL is a loose cannon, as I don't know what it does because it has complete access to the file system of the host computer

This, as far as I am aware is no longer true - it wouldn't access anything outside FG_ROOT without me explicitly allowing it to last time I tried...
User avatar
Posts: 7787
Joined: Sat Jul 26, 2014 1:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: JSBSim and Java

Postby wkitty42 » Mon Jun 17, 2019 1:16 pm

AFAIK, you are correct, lego... there was some security code placed some 4 or so years back not long after i came on board to reduce access to non-FG areas outside of the installation...

i remember i saw at least one craft that had some external access to a remote web site... that access downloaded a file from that site and did something with it... a bad entity could effectively modify the file to be downloaded and it could have executed from the craft resulting in data exfiltration that was not desirable... the security enhancements prevented that possibility...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
Posts: 6675
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Return to Flight dynamics model

Who is online

Users browsing this forum: No registered users and 0 guests