Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start GNU Octave with GUI through Cygwin from a desktop icon?

Since GNU Octave comes wit a GUI since versions 3.8.0, I thought I should check it out.

So since I run Windows and could only find Octave 3.8 for Cygwin, I installed Cygwin and the packages octave, xinit, xlaunch and gnuplot (according to this page, but I don't know if all those packages are needed).

Then, when trying to start Octave with the GUI from Cygwin with octave --force-gui, I initially got the error message

octave: X11 DISPLAY environment variable not set

and Octave would start in console mode. So I found this page, which told me to run

echo "export DISPLAY=:0.0" >>~/.bash_profile

from Cygwin, to permanently get rid of the error message, which worked. However, then I instead got this error message:

octave: unable to open X11 DISPLAY

The same page also said that you have to run the X Server by going to Start -> Cygwin-X -> XWin Server. That worked, but since I don't want the xterm terminal to start since it is not needed, I found this page which told me to run

touch ~/.startxwinrc

from Cygwin to create an empty .startxwinrc file, to prevent the xtrem terminal from starting by default, which worked. The same page also mentioned that the X Server can be started directly from Cygwin with the command startxwin.

So, now I can start Octave with the GUI from Cygwin, simply by running

startxwin
octave --force-gui

However, I would like to just be able to double click on a desktop icon to get everything up and running.

So, to my question: Can I somehow put this in a script file, which when I run it, will be opened in Cygwin so that the commands in the script file will be run in Cygwin? And is there some way to automatically close the X Server after Octave has terminated? I've tried writing a file octave.bat, which starts Cygwin and gives a second batch file as argument, which in turn contains the commands I want to execute. But when I run the first script, I just get bombarded with command prompts (not Cygwin prompts), and the all say

'startxwin' is not recognized as an internal or external command, operable program or batch file.

Why is the second script not opened in Cygwin, and how can I achieve what I want as simply as possible?

like image 713
HelloGoodbye Avatar asked Sep 13 '14 12:09

HelloGoodbye


2 Answers

Please grab Octave from here: http://mxeoctave.osuv.de/

The installer should configure everything for you.

GNU Octave offers now Windows binary itself. Go to ftp://ftp.gnu.org/gnu/octave/windows/

like image 117
juliohm Avatar answered Sep 18 '22 21:09

juliohm


You have to put

c:\cygwin64\bin\mintty.exe /bin/sh -lc 'startxwin /bin/octave --force-gui'

in your windows batch file (please adapt the Cygwin path to your settings). That worked fine for me.

The call

c:\cygwin64\bin\bash --login -c "startxwin /bin/octave --force-gui"

did open Octave as desired but the GUI seemed to have response issues to the keyboard and froze after clicking into the editor.

like image 31
schendi Avatar answered Sep 17 '22 21:09

schendi