You cannot launch a graphical application through upstart, or any other init system, because at the time that upstart is executing, X (the graphical environment) is not yet started.
In Windows, the graphical environment is an integral part of the operating system; even Windows Server Core is graphical at heart (even though it only presents you with a command prompt window). Linux, on the other hand, takes the opposite approach: the system itself is text-based only, and the graphical environment is provided by a userspace application running on top of that.
So unfortunately, there is no easy way to do what you appear to be after.
That said, you might be able to work around the limitation. Many desktop environments provide the ability to define a list of applications that will be launched when you log in (or more accurately, start the desktop environment). You could write a script that launches the application in a tight loop and exits when the application exits with a zero exit status (which is normal for "successful exit without a problem"). Whether this will work for you or not depends on your definition of "unexpected exit".
A naiive implementation might be something along the lines of:
#!/bin/bash while true do my-app || exit Xdialog --timeout 15 --yesno "Program exited. Restart it?" 2 50 test "$?" = "0" -o "$?" = "255" || exit done
The ||
means "execute the following if the exit status from the previous was non-zero" (it is read "or"). See the Xdialog documentation for how that one works; basically, it prompts you whether you want to keep running the program, and if you answer Yes or don't answer anything at all within 15 seconds, it relaunches the program by running the loop once more. Make the script file executable and point your desktop environment at launching it on login, and my-app
will run until you explicitly close it and tell the system to not restart it.