Example usage for java.io File pathSeparatorChar

List of usage examples for java.io File pathSeparatorChar

Introduction

In this page you can find the example usage for java.io File pathSeparatorChar.

Prototype

char pathSeparatorChar

To view the source code for java.io File pathSeparatorChar.

Click Source Link

Document

The system-dependent path-separator character.

Usage

From source file:com.twosigma.beaker.scala.evaluator.ScalaEvaluator.java

protected ClassLoader newAutoCompleteClassLoader() throws MalformedURLException {
    logger.debug("creating new autocomplete loader");
    acloader_cp = "";
    for (int i = 0; i < classPath.size(); i++) {
        acloader_cp += classPath.get(i);
        acloader_cp += File.pathSeparatorChar;
    }//from   www  .  ja v  a2 s.c  om
    acloader_cp += outDir;

    DynamicClassLoaderSimple cl = new DynamicClassLoaderSimple(ClassLoader.getSystemClassLoader());
    cl.addJars(classPath);
    cl.addDynamicDir(outDir);
    return cl;
}

From source file:com.twosigma.beaker.scala.util.ScalaEvaluator.java

protected void newAutoCompleteEvaluator() throws MalformedURLException {
    logger.debug("creating new autocomplete evaluator");
    acshell = new ScalaEvaluatorGlue(newAutoCompleteClassLoader(),
            acloader_cp + File.pathSeparatorChar + System.getProperty("java.class.path"), outDir);

    if (!imports.isEmpty()) {
        for (int i = 0; i < imports.size(); i++) {
            String imp = imports.get(i).trim();
            if (imp.startsWith("import"))
                imp = imp.substring(6).trim();
            if (imp.endsWith(".*"))
                imp = imp.substring(0, imp.length() - 1) + "_";
            if (!imp.isEmpty()) {
                if (!acshell.addImport(imp))
                    logger.warn("ERROR: cannot add import '{}'", imp);
            }//  w  ww .  jav a2s .co  m
        }
    }

    // ensure object is created
    NamespaceClient.getBeaker(sessionId);

    String r = acshell.evaluate2("var _beaker = NamespaceClient.getBeaker(\"" + sessionId + "\")\n"
            + "import language.dynamics\n" + "object beaker extends Dynamic {\n"
            + "  def selectDynamic( field : String ) = _beaker.get(field)\n"
            + "  def updateDynamic (field : String)(value : Any) : Any = {\n" + "    _beaker.set(field,value)\n"
            + "    return value\n" + "  }\n" + "  def applyDynamic(methodName: String)(args: AnyRef*) = {\n"
            + "    def argtypes = args.map(_.getClass)\n"
            + "    def method = _beaker.getClass.getMethod(methodName, argtypes: _*)\n"
            + "    method.invoke(_beaker,args: _*)\n" + "  }\n" + "}\n");
    if (r != null && !r.isEmpty()) {
        logger.warn("ERROR creating beaker beaker: {}", r);
    }

}

From source file:com.twosigma.beaker.scala.evaluator.ScalaEvaluator.java

protected void newAutoCompleteEvaluator() throws MalformedURLException {
    logger.debug("creating new autocomplete evaluator");
    acshell = new ScalaEvaluatorGlue(newAutoCompleteClassLoader(),
            acloader_cp + File.pathSeparatorChar + System.getProperty("java.class.path"), outDir);

    if (!imports.isEmpty()) {
        for (int i = 0; i < imports.size(); i++) {
            String imp = imports.get(i).trim();
            if (imp.startsWith("import"))
                imp = imp.substring(6).trim();
            if (imp.endsWith(".*"))
                imp = imp.substring(0, imp.length() - 1) + "_";
            if (!imp.isEmpty()) {
                if (!acshell.addImport(imp))
                    logger.warn("ERROR: cannot add import '{}'", imp);
            }//w w w .j  a v a 2s  .c  om
        }
    }

    // ensure object is created
    NamespaceClient.getBeaker(sessionId);

    String r = acshell.evaluate2("import com.twosigma.beaker.NamespaceClient\n" + "import language.dynamics\n"
            + "var _beaker = NamespaceClient.getBeaker(\"" + sessionId + "\")\n"
            + "object beaker extends Dynamic {\n"
            + "  def selectDynamic( field : String ) = _beaker.get(field)\n"
            + "  def updateDynamic (field : String)(value : Any) : Any = {\n" + "    _beaker.set(field,value)\n"
            + "    return value\n" + "  }\n" + "  def applyDynamic(methodName: String)(args: AnyRef*) = {\n"
            + "    def argtypes = args.map(_.getClass)\n"
            + "    def method = _beaker.getClass.getMethod(methodName, argtypes: _*)\n"
            + "    method.invoke(_beaker,args: _*)\n" + "  }\n" + "}\n");
    if (r != null && !r.isEmpty()) {
        logger.warn("ERROR creating beaker beaker: {}", r);
    }

}

From source file:org.apache.helix.provisioning.yarn.AppLauncher.java

/**
 * Generates the classpath after the archive file gets extracted under 'serviceName' folder
 * @param serviceName/*from  w w w.ja va2s  .co  m*/
 * @param archiveFile
 * @return
 */
private String generateClasspathAfterExtraction(String serviceName, File archiveFile) {
    if (!isArchive(archiveFile.getAbsolutePath())) {
        return "./";
    }
    StringBuilder classpath = new StringBuilder();
    // put the jar files under the archive in the classpath
    try {
        final InputStream is = new FileInputStream(archiveFile);
        final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory()
                .createArchiveInputStream("tar", is);
        TarArchiveEntry entry = null;
        while ((entry = (TarArchiveEntry) debInputStream.getNextEntry()) != null) {
            if (entry.isFile()) {
                classpath.append(File.pathSeparatorChar);
                classpath.append("./" + serviceName + "/" + entry.getName());
            }
        }
        debInputStream.close();

    } catch (Exception e) {
        LOG.error("Unable to read archive file:" + archiveFile, e);
    }
    return classpath.toString();
}

From source file:stg.pr.engine.startstop.CStartEngine.java

/**
 * Command builder.//from   w ww  . j  a  v  a  2  s  .com
 * 
 * @param extraCommands
 *            if any
 * @param args
 *            Program arguments for PRE.
 * @return Command
 */
public String[] buildCommand(ArrayList<String> extraCommands, String[] args) {
    long lCurrentTimestamp = System.currentTimeMillis();
    ArrayList<String> commandBuilder = new ArrayList<String>();
    if (logger_.isEnabledFor(LogLevel.FINER)) {
        logger_.log(LogLevel.FINER, "Building command.");
    }
    commandBuilder.add(System.getProperty("java.home") + FILE_SEPARATOR + "bin" + FILE_SEPARATOR + "java");
    if (CSettings.get("pr.javaruntimevmargs", null) != null) {
        // following code is to handle the space delimiter within double
        // quotes. Example value for this property
        // can be =-Xms128M -Xmx128M -D.pre.home="/u0201/apps/stg pre"
        StringCharacterIterator sci = new java.text.StringCharacterIterator(
                CSettings.get("pr.javaruntimevmargs"));
        boolean bEscapeCharacter = false;
        boolean bQuoted = false;
        StringBuffer cmdBuffer = new StringBuffer();
        for (char c = sci.first(); c != CharacterIterator.DONE; c = sci.next()) {
            switch (c) {
            case '\\':
                if (bEscapeCharacter) {
                    cmdBuffer.append(c + "" + c);
                    bEscapeCharacter = false;
                } else {
                    bEscapeCharacter = true;
                }
                break;
            case ' ':
                if (!bQuoted) {
                    commandBuilder.add(cmdBuffer.toString());
                    cmdBuffer.delete(0, cmdBuffer.length());
                } else {
                    cmdBuffer.append(c);
                }
                bEscapeCharacter = false;
                break;
            case '"':
                if (!bEscapeCharacter) {
                    if (!bQuoted) {
                        bQuoted = true;
                    } else {
                        bQuoted = false;
                    }
                }
                bEscapeCharacter = false;
                break;
            default:
                cmdBuffer.append(c);
                break;
            } // end of switch case.
        } // end for string character iterator
        if (cmdBuffer.length() > 0) {
            commandBuilder.add(cmdBuffer.toString());
        }
    } // pr.javaruntimevmarg != null
    if (extraCommands != null) {
        if (logger_.isEnabledFor(LogLevel.FINEST)) {
            logger_.log(LogLevel.FINEST, "Adding extra commands if any.");
        }
        commandBuilder.addAll(extraCommands);
    }
    if (logger_.isEnabledFor(LogLevel.FINER)) {
        logger_.log(LogLevel.FINER, "Adding constants.");
    }
    commandBuilder.add("-classpath");
    String classpath = "";
    //        if (CSettings.get("pr.reportService","OFF").equalsIgnoreCase("ON")) {
    //           File directory = new File(CSettings.get("pr.birt.home") + "/lib");
    //           if (!directory.exists()) {
    //              throw new IllegalArgumentException("Directory is non-existant. Check property birt.home " + CSettings.getInstance().getSource("pr").getConfigFile().getAbsolutePath());
    //           }
    //           ArrayList<String> list = new ArrayList<String>();
    //           list.add(".jar");
    //           list.add(".zip");
    //           classpath = getExtraClasspath(directory, list);
    //           System.out.println(classpath);
    //        }
    if (CSettings.get("pr.javaextraclasspath", null) != null) {
        commandBuilder.add(System.getProperty("java.class.path") + File.pathSeparatorChar
                + CSettings.get("pr.javaextraclasspath") + File.pathSeparatorChar + classpath);
    } else {
        commandBuilder.add(System.getProperty("java.class.path") + File.pathSeparatorChar + classpath);
    }
    commandBuilder.add("stg.pr.engine.CProcessRequestEngine");
    commandBuilder.add(args[0]);
    commandBuilder.add(args[1]);
    String[] cmd = new String[commandBuilder.size()];
    commandBuilder.toArray(cmd);
    if (logger_.isEnabledFor(LogLevel.FINEST)) {
        logger_.log(LogLevel.FINEST, "Command " + commandBuilder);
        logger_.log(LogLevel.FINEST, "Elapsed Time taken to build command "
                + (System.currentTimeMillis() - lCurrentTimestamp) + " ms.");
    }
    return cmd;
}

From source file:org.netbeans.nbbuild.MakeJnlp2.java

private void generateFiles() throws IOException, BuildException {

    final Set<String> declaredLocales = new HashSet<String>();

    final boolean useAllLocales;

    if ("*".equals(includelocales)) {
        useAllLocales = true;//from w ww  .  jav  a  2s  .c o m
    } else if ("".equals(includelocales)) {
        useAllLocales = false;
    } else {
        useAllLocales = false;
        StringTokenizer tokenizer = new StringTokenizer(includelocales, ",");
        while (tokenizer.hasMoreElements()) {
            declaredLocales.add(tokenizer.nextToken());
        }
    }

    final Set<String> indirectFilePaths = new HashSet<String>();
    for (FileSet fs : new FileSet[] { indirectJars, indirectFiles }) {
        if (fs != null) {
            DirectoryScanner scan = fs.getDirectoryScanner(getProject());
            for (String f : scan.getIncludedFiles()) {
                indirectFilePaths.add(f.replace(File.pathSeparatorChar, '/'));
            }
        }
    }

    final ExecutorService executorService = Executors.newFixedThreadPool(nbThreads);

    final List<BuildException> exceptions = new ArrayList<BuildException>();

    for (final Iterator fileIt = files.iterator(); fileIt.hasNext();) {
        if (!exceptions.isEmpty()) {
            break;
        }

        final FileResource fr = (FileResource) fileIt.next();
        final File jar = fr.getFile();

        if (!jar.canRead()) {
            throw new BuildException("Cannot read file: " + jar);
        }

        //
        if (optimize && checkDuplicate(jar).isPresent()) {
            continue;
        }
        //

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                JarFile theJar = null;
                try {
                    theJar = new JarFile(jar);

                    String codenamebase = JarWithModuleAttributes
                            .extractCodeName(theJar.getManifest().getMainAttributes());
                    if (codenamebase == null) {
                        throw new BuildException("Not a NetBeans Module: " + jar);
                    }
                    {
                        int slash = codenamebase.indexOf('/');
                        if (slash >= 0) {
                            codenamebase = codenamebase.substring(0, slash);
                        }
                    }
                    String dashcnb = codenamebase.replace('.', '-');

                    String title;
                    String oneline;
                    String shrt;
                    String osDep = null;

                    {
                        String bundle = theJar.getManifest().getMainAttributes()
                                .getValue("OpenIDE-Module-Localizing-Bundle");
                        Properties prop = new Properties();
                        if (bundle != null) {
                            ZipEntry en = theJar.getEntry(bundle);
                            if (en == null) {
                                throw new BuildException("Cannot find entry: " + bundle + " in file: " + jar);
                            }
                            InputStream is = theJar.getInputStream(en);
                            prop.load(is);
                            is.close();
                        }
                        title = prop.getProperty("OpenIDE-Module-Name", codenamebase);
                        oneline = prop.getProperty("OpenIDE-Module-Short-Description", title);
                        shrt = prop.getProperty("OpenIDE-Module-Long-Description", oneline);
                    }

                    {
                        String osMan = theJar.getManifest().getMainAttributes()
                                .getValue("OpenIDE-Module-Requires");
                        if (osMan != null) {
                            if (osMan.indexOf("org.openide.modules.os.MacOSX") >= 0) { // NOI18N
                                osDep = "Mac OS X"; // NOI18N
                            } else if (osMan.indexOf("org.openide.modules.os.Linux") >= 0) { // NOI18N
                                osDep = "Linux"; // NOI18N
                            } else if (osMan.indexOf("org.openide.modules.os.Solaris") >= 0) { // NOI18N
                                osDep = "Solaris"; // NOI18N
                            } else if (osMan.indexOf("org.openide.modules.os.Windows") >= 0) { // NOI18N
                                osDep = "Windows"; // NOI18N
                            }
                        }
                    }

                    Map<String, List<File>> localizedFiles = verifyExtensions(jar, theJar.getManifest(),
                            dashcnb, codenamebase, verify, indirectFilePaths);

                    executedLocales = localizedFiles.keySet();

                    new File(targetFile, dashcnb).mkdir();

                    File signed = new File(new File(targetFile, dashcnb), jar.getName());

                    // +p
                    final JarConfigResolved jarConfig = signOrCopy(jar, signed);

                    File jnlp = new File(targetFile, dashcnb + ".jnlp");
                    StringWriter writeJNLP = new StringWriter();
                    writeJNLP.write("<?xml version='1.0' encoding='UTF-8'?>\n");
                    writeJNLP.write(
                            "<!DOCTYPE jnlp PUBLIC \"-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN\" \"http://java.sun.com/dtd/JNLP-6.0.dtd\">\n");
                    writeJNLP.write("<jnlp spec='1.0+' codebase='" + codebase + "'>\n");
                    writeJNLP.write("  <information>\n");
                    writeJNLP.write("   <title>" + XMLUtil.toElementContent(title) + "</title>\n");
                    writeJNLP.write("   <vendor>NetBeans</vendor>\n");
                    writeJNLP.write("   <description kind='one-line'>" + XMLUtil.toElementContent(oneline)
                            + "</description>\n");
                    writeJNLP.write("   <description kind='short'>" + XMLUtil.toElementContent(shrt)
                            + "</description>\n");
                    writeJNLP.write("  </information>\n");

                    String realPermissions = permissions;
                    if ((jarConfig != null) && (jarConfig.getExtraManifestAttributes() != null)) {
                        String jarPermissions = jarConfig.getExtraManifestAttributes().getValue("Permissions");

                        if (jarPermissions != null) {
                            if ("all-permissions".equals(jarPermissions)) {
                                realPermissions = "<security><all-permissions/></security>\n";
                            } else {
                                realPermissions = "";
                            }
                        }
                    }

                    writeJNLP.write(realPermissions);

                    if (osDep == null) {
                        writeJNLP.write("  <resources>\n");
                    } else {
                        writeJNLP.write("  <resources os='" + osDep + "'>\n");
                    }
                    writeJNLP.write("<property name=\"jnlp.packEnabled\" value=\"" + String.valueOf(pack200)
                            + "\"/>\n");
                    writeJNLP.write(constructJarHref(jar, dashcnb));

                    processExtensions(jar, theJar.getManifest(), writeJNLP, dashcnb, codebase, realPermissions);
                    processIndirectJars(writeJNLP, dashcnb);
                    processIndirectFiles(writeJNLP, dashcnb);

                    writeJNLP.write("  </resources>\n");

                    if (useAllLocales || !declaredLocales.isEmpty()) {

                        // write down locales
                        for (Map.Entry<String, List<File>> e : localizedFiles.entrySet()) {
                            final String locale = e.getKey();

                            if (!declaredLocales.isEmpty() && !declaredLocales.contains(locale)) {
                                continue;
                            }

                            final List<File> allFiles = e.getValue();

                            writeJNLP.write("  <resources locale='" + locale + "'>\n");

                            for (File n : allFiles) {
                                log("generating locale " + locale + " for " + n, Project.MSG_VERBOSE);
                                String name = n.getName();
                                String clusterRootPrefix = jar.getParent() + File.separatorChar;
                                String absname = n.getAbsolutePath();
                                if (absname.startsWith(clusterRootPrefix)) {
                                    name = absname.substring(clusterRootPrefix.length())
                                            .replace(File.separatorChar, '-');
                                }
                                File t = new File(new File(targetFile, dashcnb), name);
                                signOrCopy(n, t);
                                writeJNLP.write(constructJarHref(n, dashcnb, name));
                            }

                            writeJNLP.write("  </resources>\n");

                        }
                    }

                    writeJNLP.write("  <component-desc/>\n");
                    writeJNLP.write("</jnlp>\n");
                    writeJNLP.close();

                    // +p
                    Files.write(writeJNLP.toString(), jnlp, Charset.forName("UTF-8"));
                } catch (Exception e) {
                    exceptions.add(new BuildException(e));
                } finally {
                    if (theJar != null) {
                        try {
                            theJar.close();
                        } catch (IOException e) {
                        }
                    }
                }
            }
        });
    }

    executorService.shutdown();

    try {
        executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
    } catch (Exception e) {
        throw new BuildException(e);
    }

    if (!exceptions.isEmpty()) {
        throw exceptions.get(0);
    }
}

From source file:com.igormaznitsa.jute.JuteMojo.java

private String makeClassPath(final File mojoJarPath, final Collection<File> files) {
    final StringBuilder result = new StringBuilder();

    for (final File f : files) {
        if (result.length() > 0) {
            result.append(File.pathSeparatorChar);
        }//from  w ww  . j a  v a 2  s  .  com
        result.append(f.getAbsoluteFile());
    }

    if (result.length() > 0) {
        result.append(File.pathSeparatorChar);
    }
    result.append(mojoJarPath.getAbsolutePath());

    return result.toString();
}

From source file:com.codesourcery.internal.installer.InstallManager.java

@Override
public void launch(LaunchItem item) throws CoreException {
    IPath installLocation = getInstallDescription().getRootLocation();

    try {//  w w  w  .  j av a 2  s. c  o m
        String program;
        // Executable item
        if (item.getType() == LaunchItemType.EXECUTABLE) {
            IPath toRun = installLocation.append(item.getPath());
            if (!toRun.toFile().exists())
                Installer.fail(InstallMessages.Error_FileNotFound + toRun.toOSString());

            // Add paths to environment and launch.
            ProcessBuilder pb = new ProcessBuilder();
            String[] paths = installDescription.getEnvironmentPaths();

            if (paths != null) {
                Map<String, String> env = pb.environment();
                String pathKey = "PATH";
                String pathVar = env.get(pathKey);

                if (pathVar == null) {
                    pathVar = "";
                }

                for (String path : paths) {
                    IPath resolvedPath = installDescription.getRootLocation().append(path);
                    pathVar = resolvedPath.toString() + File.pathSeparatorChar + pathVar;
                }
                env.put(pathKey, pathVar);
            }

            program = toRun.toOSString();
            pb.command(program);
            pb.start();
        }
        // File item
        else if (item.getType() == LaunchItemType.FILE) {
            IPath toRun = installLocation.append(item.getPath());
            if (!toRun.toFile().exists())
                Installer.fail(InstallMessages.Error_FileNotFound + toRun.toOSString());

            program = "file://" + toRun.toOSString();
            Program.launch(program);
        }
        // HTML item
        else if (item.getType() == LaunchItemType.HTML) {
            program = item.getPath();
            Program.launch(program);
        } else {
            throw new NullPointerException(InstallMessages.Error_NoLaunchItemType);
        }
    } catch (Exception e) {
        Installer.fail(NLS.bind(InstallMessages.Error_LaunchFailed0, item.getPath()), e);
    }
    // SWT Program.launch() can throw an UnsatisfiedLinkError if it is
    // unable to launch the file.
    catch (UnsatisfiedLinkError e) {
        Installer.fail(NLS.bind(InstallMessages.Error_LaunchFailed0, item.getPath()), e);
    }
}

From source file:atg.tools.dynunit.nucleus.NucleusUtils.java

public static Nucleus startNucleusWithModules(NucleusStartupOptions startupOptions)
        throws ServletException, FileNotFoundException {
    notNull(startupOptions);// w ww  .  j  a v  a  2  s. c om
    notEmpty(startupOptions.getInitialService());
    final File dynamoRoot = getExistingFile(findDynamoRoot());
    setDynamoPropertyIfEmpty("atg.dynamo.root", dynamoRoot.getAbsolutePath());
    final File dynamoHome = new File(dynamoRoot, "home");
    setDynamoPropertyIfEmpty("atg.dynamo.home", dynamoHome.getAbsolutePath());
    final String modulesPath = StringUtils.join(startupOptions.getModules(), File.pathSeparatorChar);
    setDynamoProperty("atg.dynamo.modules", modulesPath);
    setSystemPropertyIfEmpty("atg.dynamo.license.read", "true");
    setSystemPropertyIfEmpty("atg.license.read", "true");

    // our temporary server directory.
    File fileServerDir = null;

    try {

        AppModuleManager moduleManager = new MultiInstallLocalAppModuleManager(dynamoRoot.getAbsolutePath(),
                dynamoRoot, modulesPath);

        AppLauncher launcher = AppLauncher.getLauncher(moduleManager, modulesPath);

        // Start Nucleus
        String configpath = DynamoServerLauncher.calculateConfigPath(launcher, startupOptions.getLiveConfig(),
                startupOptions.getLayersAsString(), false, null);

        // use the NucleusUtils config dir as a base, since it
        // empties out license checks, etc.
        File fileBaseConfig = getConfigPath(NucleusUtils.class, null, false);

        if ((fileBaseConfig != null) && fileBaseConfig.exists()) {
            configpath = configpath + File.pathSeparator + fileBaseConfig.getAbsolutePath();
        }

        // add the additional config path as the last arg, if needed
        File fileTestConfig = getConfigPath(startupOptions.getClassRelativeTo(),
                startupOptions.getBaseConfigDirectory(), false);

        // now add it to the end of our config path
        if ((fileTestConfig != null) && fileTestConfig.exists()) {
            configpath = configpath + File.pathSeparator + fileTestConfig.getAbsolutePath();
        } else if (fileTestConfig != null) {
            logger.error("Warning: did not find directory {}", fileTestConfig.getAbsolutePath());
        }
        String dynUnitHome = DynUnit.getHome();
        if (dynUnitHome != null) {
            configpath = configpath + File.pathSeparator + dynUnitHome + File.separatorChar + "licenseconfig";
        }
        // finally, create a server dir.
        fileServerDir = createTempServerDir();

        setSystemProperty("atg.dynamo.server.home", fileServerDir.getAbsolutePath());
        NucleusServlet.addNamingFactoriesAndProtocolHandlers();

        ArrayList<String> listArgs = new ArrayList<String>();
        listArgs.add(configpath);
        listArgs.add("-initialService");
        listArgs.add(startupOptions.getInitialService());

        PropertyEditors.registerEditors();
        logger.info("Starting nucleus with arguments: " + listArgs);
        Nucleus n = Nucleus.startNucleus(listArgs.toArray(new String[listArgs.size()]));

        // remember our temporary server directory for later deletion
        nucleiConfigPathsCache.put(n, fileServerDir);
        // clear out the variable, so our finally clause knows not to
        // delete it
        fileServerDir = null;

        return n;
    } catch (AppLauncherException e) {
        throw logger.throwing(new ServletException(e));
    } catch (IOException e) {
        throw logger.throwing(new ServletException(e));
    } finally {
        if (fileServerDir != null) {
            try {
                // a non-null value means it was created, but not added to our list,
                // so we should nuke it.
                FileUtils.deleteDirectory(fileServerDir);
            } catch (IOException e) {
                logger.catching(Level.ERROR, e);
            }
        }
    }
}

From source file:org.apache.tajo.yarn.command.LaunchCommand.java

private void setupEnv(ContainerLaunchContext amContainer) throws IOException {
    LOG.info("Set the environment for the application master");
    Map<String, String> env = new HashMap<String, String>();

    // Add AppMaster.jar location to classpath
    // At some point we should not be required to add
    // the hadoop specific classpaths to the env.
    // It should be provided out of the box.
    // For now setting all required classpaths including
    // the classpath to "." for the application jar
    StringBuilder classPathEnv = new StringBuilder(Environment.CLASSPATH.$()).append(File.pathSeparatorChar)
            .append("./*");
    for (String c : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        classPathEnv.append(File.pathSeparatorChar);
        classPathEnv.append(c.trim());/*from  w  ww . j  ava 2  s  .co m*/
    }

    classPathEnv.append(File.pathSeparatorChar).append("./").append(libDir).append("/*");

    classPathEnv.append(File.pathSeparatorChar).append("./log4j.properties");

    // add the runtime classpath needed for tests to work
    if (conf.getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false)) {
        classPathEnv.append(':');
        classPathEnv.append(System.getProperty("java.class.path"));
    }

    env.put("CLASSPATH", classPathEnv.toString());
    env.put(Constants.TAJO_ARCHIVE_PATH, tajoArchive);
    env.put(Constants.TAJO_ARCHIVE_ROOT, "tajo/" + getTajoRootInArchive(tajoArchive));
    env.put(Constants.TAJO_HOME, "$PWD/${" + Constants.TAJO_ARCHIVE_ROOT + "}");
    env.put(Constants.TAJO_CONF_DIR, "$PWD/conf");
    env.put(Constants.TAJO_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);
    env.put(Constants.TAJO_CLASSPATH, "/export/apps/hadoop/site/lib/*:$PWD/" + libDir + "/*");
    amContainer.setEnvironment(env);
}