Java tutorial
//package com.java2s; /*********************************************************************************************************************** * Copyright (c) 2008 empolis GmbH and brox IT Solutions GmbH. 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: Marius Cimpean (brox IT Solutions GmbH) - initial creator **********************************************************************************************************************/ import java.io.File; import java.io.IOException; public class Main { /** * Gets canonical file. * * @param filePath * String - file path * @return file File */ private static File getCanonicalFile(final String filePath) { final File file = new File(filePath); try { return file.getCanonicalFile(); } catch (final IOException e) { return file.getAbsoluteFile(); } } }