Returns the path to the launcher which has started this application. - Java java.lang

Java examples for java.lang:System

Description

Returns the path to the launcher which has started this application.

Demo Code

/*******************************************************************************
 * Copyright (c) 2014 Karlsruhe Institute of Technology, Germany
 *                    Technical University Darmstadt, Germany
 *                    Chalmers University of Technology, Sweden
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/* ww w .  j a  v  a  2  s .  c o m*/
 *    Technical University Darmstadt - initial API and implementation and/or initial documentation
 *******************************************************************************/
//package com.java2s;
import java.io.File;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getLauncher());
    }

    /**
     * Returns the path to the launcher which has started this application.
     * @return The path to the launcher which has started this application.
     */
    public static File getLauncher() {
        String path = System.getProperty("-launcher");
        if (path != null) {
            return new File(path);
        } else {
            return null;
        }
    }
}

Related Tutorials