Advance example ml2 COMMAND NOT FOUND </OnlyVisio true>

Hello everyone

I am a new beginner of Geant 4 simulation , ahile I`ve tried to run Medical_linac example i get the following message which failed my visualisation

***** COMMAND NOT FOUND </OnlyVisio true> *****

***** Batch is interrupted!! *****

------- WWWW ------- G4Exception-START -------- WWWW -------
** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
ommand aborted (100)
rror code : 100
** This is just a warning message. ***
------- WWWW -------- G4Exception-END --------- WWWW -------
command not found: “/control/execute C:\Users\96654\Geant4\11.0\share\Geant4-11.0.0\examples\advanced\medical_linac-build\ml2.mac”

your responde is hilghy appreciated :slight_smile:


I have never tried the medical_linac (ml2) example before but I am set up to try any example easily, so I tried, as a “novice user” so to speak.

Running ml2 “out of the box” ran without visualisation. It actually executes macroAndData/macro_files/main/ml2.mac, which has /OnlyVisio false. macroAndData/macro_files/main/ml2.mac file can only be executed if you start the app in the example’s directory (cd examples/advanced/medical_linac; ./ml2, or something like that), because it has a “relative” path name, i.e., relative to where you started the app.

I noticed that a file ml2.mac exists in the example’s directory. In this version of ml2.mac, /OnlyVisio true. So I started ml2 in the example’s directory, and gave ml2.mac as an argument. It worked fine and this time opened a graphics window - see below.

I think the key is: always start your app from the example’s directory. cd to the example’s directory, then start the app. In Unix that’s called the “working directory” (pwd prints it).

Hope that helps

1 Like

Hello Mr.allison,

Thank you very much for your reply , I am using windows 10 so could you please explain to me how to do this step in windows environment (:sweat_smile:



I’m a Unix person myself, and I don’t know how to launch and app from a particular directory (or “folder” as Windows calls it). Perhaps someone else can help.

Which of the options from the Installation Guide (reproduced below) are you using?


The easiest way to build and install Geant4 from source on Windows platforms is to use the Windows command line program cmd plus CMake’s command line interface to the MSBuild tool supplied with Visual Studio. Whilst the full Visual Studio GUI can be used, cmd and CMake/MSBuild provide a simpler interface and the commands can be used inside scripts. You can also usePowerShell instead of cmd if you prefer, and the instructions below should transfer barring minor syntax differences. Builds of Geant4 using Cygwin or MinGW with their own compilers or the Microsoft C++ Compiler are neither supported or tested, though the CMake system is expected to work under these toolchains. If you are using these tools via their native shells and with their own versions of CMake, then the instructions for building and installing on Unix platforms On Unix Platforms can be used.

1 Like

Thanj you very much for your help i will go through the installation guide , I have tried to run some basics and advance examples most of them run and visualized fin, I`m just have trouble with ml2 file .
I am using Visual studio 2022,Cmake, and gears application with geant 4 .

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.