public final void install(boolean overwrite) throws OSException {
                File programStarterDirectory = new File(getUserHomeDirectory() + "/.local/share/applications/");
                if (!programStarterDirectory.exists() || !programStarterDirectory.canWrite()) {
                        throw new OSException("Can't write to directory \"" + programStarterDirectory.getAbsolutePath() + "\".");
                }
                File programStarterFile = new File(programStarterDirectory.getAbsolutePath() + "/" + getFileName() + ".desktop");
                if (programStarterFile.exists()) {
                        if (overwrite) {
                                programStarterFile.delete();
                        } else {
                                throw new OSException("File \"" + programStarterFile.getName() + "\" already exists.");
                        }
                }

                try {
                        // write program starter
                        PrintWriter out;
                        out = new PrintWriter(programStarterFile.getAbsolutePath());
                        out.print(this.toString());
                        out.close();

                        // make it executable
                        Runtime.getRuntime().exec("chmod a+x " + programStarterFile.getAbsolutePath());
                } catch (IOException ex) {
                        throw new OSException(ex);
                }
        }
public final void install ( boolean overwrite ) throws OSException { File programStarterDirectory = new File ( getUserHomeDirectory ( ) + "/.local/share/applications/" ) ; if ( ! programStarterDirectory . exists ( ) || ! programStarterDirectory . canWrite ( ) ) { throw new OSException ( "Can't write to directory \"" + programStarterDirectory . getAbsolutePath ( ) + "\"." ) ; } File programStarterFile = new File ( programStarterDirectory . getAbsolutePath ( ) + "/" + getFileName ( ) + ".desktop" ) ; if ( programStarterFile . exists ( ) ) { if ( overwrite ) { programStarterFile . delete ( ) ; } else { throw new OSException ( "File \"" + programStarterFile . getName ( ) + "\" already exists." ) ; } } try { PrintWriter out ; out = new PrintWriter ( programStarterFile . getAbsolutePath ( ) ) ; out . print ( this . toString ( ) ) ; out . close ( ) ; Runtime . getRuntime ( ) . exec ( "chmod a+x " + programStarterFile . getAbsolutePath ( ) ) ; } catch ( IOException ex ) { throw new OSException ( ex ) ; } }
Installs the program starter to
<code>~/.local/share/applications/</code> and makes it executable.

@param overwrite Set <code>true</code> if an already existing program
starter with the same name should be overwritten, otherwise
<code>false</code>.
@throws OSException