Example usage for java.io File pathSeparator

List of usage examples for java.io File pathSeparator

Introduction

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

Prototype

String pathSeparator

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

Click Source Link

Document

The system-dependent path-separator character, represented as a string for convenience.

Usage

From source file:org.fornax.toolsupport.sculptor.maven.plugin.GeneratorMojoTest.java

public void testGeneratorClasspath() throws Exception {
    GeneratorMojo mojo = createMojo(createProject("test1"));

    String classpath = mojo.getGeneratorClasspath();
    assertNotNull(classpath);//from  w  ww.jav  a  2  s .  co m
    String[] splittedClasspath = classpath.split(File.pathSeparator);
    assertEquals(3, splittedClasspath.length);
    assertTrue(splittedClasspath[0].endsWith("resources"));
    assertEquals("generator", splittedClasspath[1]);
    assertEquals("dep3", splittedClasspath[2]);
}

From source file:org.apache.hadoop.distributedloadsimulator.sls.appmaster.InitializeAppMaster.java

private String getRunTimeClassPath() {
    LOG.info("Trying to generate classpath for app master from current thread's classpath");
    String envClassPath = "";
    String cp = System.getProperty("java.class.path");
    if (cp != null) {
        envClassPath += cp.trim() + File.pathSeparator;
    }//  w  w  w .  j  a  va  2  s  .c om
    ClassLoader thisClassLoader = Thread.currentThread().getContextClassLoader();
    URL url = thisClassLoader.getResource("yarn-site.xml");
    envClassPath += new File(url.getFile()).getParent();
    return envClassPath;
}

From source file:fr.openwide.talendalfresco.alfresco.NamePathServiceImpl.java

/**
 * Resolves given namePath using server File.separator
 * @see resolveNamePath(String, String)/* w  w w.j a v a 2s.com*/
 * @see getChildByPathName(String, NodeRef, QName)
 */
public NodeRef resolveNamePath(String namePath) {
    return resolveNamePath(namePath, File.pathSeparator);
}

From source file:edu.illinois.cs.cogcomp.GenerateMojo.java

public void execute() throws MojoExecutionException {
    dFlag = FileUtils.getPlatformIndependentFilePath(dFlag);
    gspFlag = FileUtils.getPlatformIndependentFilePath(gspFlag);
    sourcepathFlag = FileUtils.getPlatformIndependentFilePath(sourcepathFlag);

    classpath.add(dFlag);//from  w w  w . j a va 2  s .  c  o  m
    classpath.add(gspFlag);

    String newpath = StringUtils.join(classpath, File.pathSeparator);

    // If these directories don't exist, make them.
    new File(dFlag).mkdirs();
    new File(gspFlag).mkdirs();

    for (String lbjInputFile : lbjavaInputFileList) {
        if (StringUtils.isEmpty(lbjInputFile)) {
            // making the optional-compile-step parameter happy.
            continue;
        }

        getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");

        lbjInputFile = FileUtils.getPlatformIndependentFilePath(lbjInputFile);

        try {
            String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-c",
                    "-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

            ProcessBuilder pr = new ProcessBuilder(args);
            pr.inheritIO();
            Process p = pr.start();
            p.waitFor();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Yeah, an error.");
        }
    }

}

From source file:edu.illinois.cs.cogcomp.CompileMojo.java

public void execute() throws MojoExecutionException {
    dFlag = FileUtils.getPlatformIndependentFilePath(dFlag);
    gspFlag = FileUtils.getPlatformIndependentFilePath(gspFlag);
    sourcepathFlag = FileUtils.getPlatformIndependentFilePath(sourcepathFlag);

    classpath.add(dFlag);/*from w  w w  . jav  a  2s  .  c o m*/
    classpath.add(gspFlag);

    String newpath = StringUtils.join(classpath, File.pathSeparator);

    // If these directories don't exist, make them.
    new File(dFlag).mkdirs();
    new File(gspFlag).mkdirs();

    for (String lbjInputFile : lbjavaInputFileList) {
        if (StringUtils.isEmpty(lbjInputFile)) {
            // making the optional-compile-parameter happy.
            continue;
        }

        getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");

        lbjInputFile = FileUtils.getPlatformIndependentFilePath(lbjInputFile);

        try {
            String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-d",
                    dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

            ProcessBuilder pr = new ProcessBuilder(args);
            pr.inheritIO();
            Process p = pr.start();
            p.waitFor();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Yeah, an error.");
        }
    }

}

From source file:org.zanata.sync.jobs.system.ResourceProducer.java

private static boolean isGitExecutableOnPath() {
    String tryNativeGit = System.getenv(TRY_NATIVE_GIT);
    if (Boolean.parseBoolean(tryNativeGit)) {
        Pattern pattern = Pattern.compile(Pattern.quote(File.pathSeparator));
        return pattern.splitAsStream(System.getenv("PATH")).map(Paths::get)
                .anyMatch(path -> Files.exists(path.resolve("git")));
    }/*ww w. j  a  va  2 s. c o  m*/
    return false;
}

From source file:net.grinder.util.GrinderClassPathUtils.java

/**
 * Construct the classpath of ngrinder which is very important and located in the head of
 * classpath.//from  ww w. j  a v a2  s.  c om
 * 
 * @param classPath
 *            classpath string
 * @param logger
 *            logger
 * @return classpath optimized for grinder.
 */
public static String filterPatchClassPath(String classPath, Logger logger) {
    List<String> classPathList = new ArrayList<String>();
    for (String eachClassPath : checkNotNull(classPath).split(File.pathSeparator)) {
        String filename = FilenameUtils.getName(eachClassPath);
        if (isPatchJar(filename)) {
            logger.trace("classpath :" + eachClassPath);
            classPathList.add(eachClassPath);
        }
    }
    return StringUtils.join(classPathList, File.pathSeparator);
}

From source file:org.javaan.bytecode.JarFileLoader.java

private void processEntry(String path, String fileName, JarFile jar, List<Type> classes, JarEntry entry)
        throws IOException {
    if (!entry.isDirectory()) {
        String name = entry.getName();
        boolean isClass = name.endsWith(".class");
        boolean isLibrary = name.endsWith(".jar") || name.endsWith(".war") || name.endsWith(".ear");
        if (isClass) {
            ClassParser parser = new ClassParser(fileName, entry.getName());
            JavaClass javaClass = parser.parse();
            String filePath = path + File.pathSeparator + javaClass.getFileName();
            Type type = Type.create(javaClass, filePath);
            classes.add(type);//from w  ww.  j  a v a2  s .  c o m
        } else if (isLibrary) {
            InputStream input = jar.getInputStream(entry);
            try {
                processJar(path + File.pathSeparator + entry.getName(), input, classes);
            } finally {
                input.close();
            }
        }
    }
}

From source file:org.grycap.gpf4med.graph.base.visual.GraphvizPrinter.java

public static File print(final GraphDatabaseService graphDb, final String filename) throws IOException {
    checkArgument(graphDb != null, "Uninitialized database");
    checkArgument(StringUtils.isNotBlank(filename), "Uninitialized or invalid filename");
    final File file = new File(ConfigurationManager.INSTANCE.getLocalCacheDir(),
            CACHE_DIRNAME + File.pathSeparator + filename);
    try (final Transaction tx = graphDb.beginTx()) {
        final GraphvizWriter writer = new GraphvizWriter();
        writer.emit(file, Walker.fullGraph(graphDb));
        tx.success();//from   w w  w  .  j a  v a 2s  . co m
    }
    return file;
}

From source file:edu.illinois.cs.cogcomp.CleanMojo.java

public void execute() throws MojoExecutionException {
    dFlag = FileUtils.getPlatformIndependentFilePath(dFlag);
    gspFlag = FileUtils.getPlatformIndependentFilePath(gspFlag);
    sourcepathFlag = FileUtils.getPlatformIndependentFilePath(sourcepathFlag);

    classpath.add(dFlag);/*  w w  w .  j a v a2  s. c  o m*/
    classpath.add(gspFlag);

    String newpath = StringUtils.join(classpath, File.pathSeparator);

    // We need to reverse the order we do the cleaning since there might be dependencies across
    // files
    List<String> fileList = Arrays.asList(lbjavaInputFileList);
    Collections.reverse(fileList);
    for (String lbjInputFile : fileList) {
        if (StringUtils.isEmpty(lbjInputFile)) {
            // making the optional-compile-step parameter happy.
            continue;
        }

        getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main with the -x flag (for cleaning)...");

        lbjInputFile = FileUtils.getPlatformIndependentFilePath(lbjInputFile);

        try {
            // The -x flag makes all the difference.
            String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-x",
                    "-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

            ProcessBuilder pr = new ProcessBuilder(args);
            pr.inheritIO();
            Process p = pr.start();
            p.waitFor();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Yeah, an error.");
        }
    }

}