Example usage for java.io File getAbsolutePath

List of usage examples for java.io File getAbsolutePath

Introduction

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

Prototype

public String getAbsolutePath() 

Source Link

Document

Returns the absolute pathname string of this abstract pathname.

Usage

From source file:cpm.openAtlas.bundleInfo.maker.BundleMakeBooter.java

public static void main(String[] args) throws JSONException, IOException {
    if (args.length != 2) {
        throw new IOException(" args to less , usage plugin_dir out_put_json_path");

    }/*from w  w  w . j av a 2  s . com*/

    String path = args[0];
    String targetFile = args[1];
    File dirFile = new File(path);
    JSONArray jsonArray = new JSONArray();
    File[] files = dirFile.listFiles();
    for (File file : files) {
        if (file.getAbsolutePath().contains("libcom")) {
            PackageLite packageLit = PackageLite.parse(file.getAbsolutePath());
            jsonArray.put(packageLit.getBundleInfo());
            //            try {
            //                packageLit.getBundleInfo().toString();
            //            } catch (JSONException e) {
            //               // TODO Auto-generated catch block
            //               e.printStackTrace();
            //            }
        }

    }
    org.apache.commons.io.FileUtils.writeStringToFile(new File(targetFile), jsonArray.toString());
    System.out.println(jsonArray.toString());
}

From source file:MainClass.java

public static void main(String[] a) {
    File myFile = new File("C:" + File.separator + "jdk1.5.0" + File.separator, "File.java");
    System.out.println(myFile.getAbsolutePath());
}

From source file:com.openAtlas.bundleInfo.maker.BundleMakeBooter.java

public static void main(String[] args) throws JSONException, IOException {
    //if(args.length!=2){
    //   throw new  IOException(" args to less , usage plugin_dir out_put_json_path");
    //}/*from   ww  w  .j av  a2  s.c  o m*/

    args = new String[2];
    args[0] = "C:\\Users\\kltz\\Desktop\\AtlasDemo\\plugin";
    args[1] = "C:\\Users\\kltz\\Desktop\\AtlasDemo\\plugin\\bundle-info.json";

    String path = args[0];
    ApkPreProcess.preProcess(path);
    String targetFile = args[1];
    File dirFile = new File(path);
    JSONArray jsonArray = new JSONArray();
    File[] files = dirFile.listFiles();
    for (File file : files) {
        if (file.getAbsolutePath().contains("libcom")) {
            PackageLite packageLit = PackageLite.parse(file.getAbsolutePath());
            jsonArray.put(packageLit.getBundleInfo());
            //            try {
            //                packageLit.getBundleInfo().toString();
            //            } catch (JSONException e) {
            //               // TODO Auto-generated catch block
            //               e.printStackTrace();
            //            }
        }

    }
    org.apache.commons.io.FileUtils.writeStringToFile(new File(targetFile), jsonArray.toString());
    System.out.println(jsonArray.toString());
}

From source file:com.sigma.drive.Wordcount.java

public static void main(String[] args) throws Exception {
    File workaround = new File(".");
    System.getProperties().put("hadoop.home.dir", workaround.getAbsolutePath());
    new File("./bin").mkdirs();
    new File("./bin/winutils.exe").createNewFile();

    AbstractApplicationContext context = new ClassPathXmlApplicationContext("/spring.xml", Wordcount.class);
    log.info("Wordcount with HDFS copy Application Running");
    context.registerShutdownHook();//from  w  w w .  java  2 s .c o  m
}

From source file:com.bright.utils.ZipFile.java

public static void main(String[] args) {

    try {// w  w w  .ja v a 2  s .c o m
        // name of zip file to create
        String outFilename = args[1];

        // create ZipOutputStream object
        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));

        // path to the folder to be zipped
        File zipFolder = new File(args[0]);

        int len = zipFolder.getAbsolutePath().lastIndexOf(File.separator);
        String baseName = zipFolder.getAbsolutePath().substring(0, len + 1);

        addFolderToZip(zipFolder, out, baseName);
        System.out.println("Created ZIP file: " + args[1]);

        out.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    ScriptEngineManager manager = new ScriptEngineManager();
    ScriptEngine engine = manager.getEngineByName("JavaScript");

    File outputFile = new File("jsoutput.txt");
    System.out.println("Script output will be written to " + outputFile.getAbsolutePath());

    FileWriter writer = new FileWriter(outputFile);
    ScriptContext defaultCtx = engine.getContext();
    defaultCtx.setWriter(writer);/*from  w ww  .java2 s. c  o m*/
    String script = "print('Hello custom output writer')";
    engine.eval(script);
    writer.close();

}

From source file:com.momab.dstool.IntegrationTest_Download.java

public static void main(String[] a) throws ParseException, IOException, ClassNotFoundException {

    File tmpFile = File.createTempFile("dstool", "dat");

    String[] args = { "localhost", "FeedItem", "-r", "-f", tmpFile.getAbsolutePath(), "-u", "user@domain", "-p",
            "password", "-P", "8888" };

    DSTool.main(args);//www  .  j av  a2s . c  o  m
}

From source file:de.micromata.genome.gwiki.tools.PatchJavaHeader.java

public static void main(String[] args) {
    String baseDir = args[0];/*  ww  w. j a  v a2  s. c om*/
    Collection<File> col = FileUtils.listFiles(new File(baseDir), new String[] { "java" }, true);
    for (File f : col) {
        System.out.println("file: " + f.getAbsolutePath());
        patchFile(f);
    }

}

From source file:AudioFilter.java

public static void main(String[] args) {
    AudioFilter audioFilter = new AudioFilter();

    JFileChooser jfc = new JFileChooser();

    jfc.setDialogTitle("Open File");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    jfc.setCurrentDirectory(new File("."));
    jfc.setFileFilter(audioFilter);/*from   w  ww . j  a va2 s.com*/
    int result = jfc.showOpenDialog(null);

    if (result == JFileChooser.CANCEL_OPTION) {
        System.out.println("cancel");
    } else if (result == JFileChooser.APPROVE_OPTION) {
        File fFile = jfc.getSelectedFile();
        String filestr = fFile.getAbsolutePath();

        System.out.println(filestr);
    }
}

From source file:Main.java

public static void main(String[] args) {
    File file = new File(File.separator + "Java" + File.separator + "folder");
    System.out.println(file.getPath());
    System.out.println(file.getAbsolutePath());
}