Here you can find the source of fileExist(String cmdPath)
Parameter | Description |
---|---|
cmdPath | The file path to be checked. |
true
if the file exists, false
otherwise.
public static boolean fileExist(String cmdPath)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009-2010 Red Hat, Inc. * 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://w w w . j av a 2s. c o m * Red Hat - initial API and implementation *******************************************************************************/ import java.io.File; public class Main { /** * Checks whether a file exists. * * @param cmdPath The file path to be checked. * @return <code>true</code> if the file exists, <code>false</code> otherwise. */ public static boolean fileExist(String cmdPath) { return new File(cmdPath).exists(); } }