Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

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

Prototype

String separator

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

Click Source Link

Document

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

Usage

From source file:Main.java

public static void main(String[] argv) {
    String filename = File.separator + "tmp";
    JFileChooser fc = new JFileChooser(new File(filename));

    // Show open dialog
    fc.showOpenDialog(null);/*  w ww  .  j  a va 2 s . c o m*/
    File selFile = fc.getSelectedFile();

    // Show save dialog
    fc.showSaveDialog(null);
    selFile = fc.getSelectedFile();

}

From source file:Main.java

public static void main(String[] args) {
    printFilePath("dummy.txt");
    printFilePath(".." + File.separator + "notes.txt");
}

From source file:MainClass.java

public static void main(String[] a) {
    File myFile = new File("//myPC/shared/jdk1.5.0/src/java/io", "File.java");
    System.out.println(myFile);//from w  w w.  j a  v a 2 s.c  om
    myFile = new File(File.separator + File.separator + "myPC" + File.separator + "shared" + File.separator
            + "jdk1.4" + File.separator + "src" + File.separator + "java" + File.separator + "io", "File.java");
    System.out.println(myFile);
}

From source file:MyClass.java

public static void main(String[] argv) throws Exception {

    URL[] urls = null;//from ww w.j  av  a  2 s.  c o m

    File dir = new File(System.getProperty("user.dir") + File.separator + "dir" + File.separator);
    URL url = dir.toURI().toURL();
    urls = new URL[] { url };

    ClassLoader cl = new URLClassLoader(urls);

    Class cls = cl.loadClass("MyClass");

    MyClass myObj = (MyClass) cls.newInstance();

}

From source file:Main.java

public static void main(String[] args) {
    String zipFileName = "ziptest.zip";
    String[] entries = new String[2];
    entries[0] = "test1.txt";
    entries[1] = "notes" + File.separator + "test2.txt";
    zip(zipFileName, entries);//www . j  ava2  s . com
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    URL webSvcGetURL = new URL("http://www.server.net/Webservices");
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(webSvcGetURL.openStream()));
    SAXSource saxSource = new SAXSource(new InputSource(bufferedReader));
    String curDir = new File(".").getCanonicalPath();
    StreamSource xlstStreamSource = new StreamSource(new File(curDir + File.separator + "style.xsl"));
    File resultHTMLFile = new File(curDir + File.separator + "output.html");

    StreamResult streamResult = new StreamResult(resultHTMLFile);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer(xlstStreamSource);
    transformer.transform((Source) saxSource, streamResult);
}

From source file:Main.java

public static void main(String[] args) {

    File workingDirectory = new File("C:" + File.separator + "Invoices");

    File template = new File(workingDirectory.getAbsolutePath() + File.separator + "invoiceTemplate.tex");

    File tempDir = new File(workingDirectory.getAbsolutePath() + File.separator + "temp");
    if (!tempDir.isDirectory()) {
        tempDir.mkdir();/*  ww w . j  ava2 s . c o m*/
    }

    File invoice1 = new File(tempDir.getAbsolutePath() + File.separator + "invoice1.tex");
    File invoice2 = new File(tempDir.getAbsolutePath() + File.separator + "invoice2.tex");

    try {

        HashMap<String, String> data = new HashMap<String, String>();

        data.put("Number", "1");
        data.put("Customer name", "Ivan Pfeiffer");
        data.put("Customer street", "Schwarzer Weg 4");
        data.put("Customer zip", "13505 Berlin");
        data.put("Development", "Software");
        data.put("Price", "500");

        JLRConverter converter = new JLRConverter("::", ":::");
        if (!converter.parse(template, invoice1, data)) {
            System.out.println(converter.getErrorMessage());
        }

        data.put("Number", "2");
        data.put("Customer name", "Mike Mueller");
        data.put("Customer street", "Prenzlauer Berg 12");
        data.put("Customer zip", "10405 Berlin");
        data.put("Development", "Hardware");
        data.put("Price", "2350");

        if (!converter.parse(template, invoice2, data)) {
            System.out.println(converter.getErrorMessage());
        }

        File desktop = new File(System.getProperty("user.home") + File.separator + "Desktop");

        JLRGenerator pdfGen = new JLRGenerator();

        pdfGen.deleteTempTexFile(false);

        if (!pdfGen.generate(invoice1, desktop, workingDirectory)) {
            System.out.println(pdfGen.getErrorMessage());
        }

        JLROpener.open(pdfGen.getPDF());

        if (!pdfGen.generate(invoice2, desktop, workingDirectory)) {
            System.out.println(pdfGen.getErrorMessage());
        }

        JLROpener.open(pdfGen.getPDF());

    } catch (IOException ex) {
        System.err.println(ex.getMessage());
    }
}

From source file:contractEditor.SPConfFileEditor.java

public static void main(String[] args) {

    JSONObject obj = new JSONObject();
    ArrayList fileList = new ArrayList();

    fileList.add("confSP" + File.separator + "HOST1.json");
    fileList.add("confSP" + File.separator + "HOST2.json");
    fileList.add("confSP" + File.separator + "HOST3.json");
    fileList.add("confSP" + File.separator + "HOST4.json");

    obj.put("contract_list_of_SP", fileList);

    try {//from  ww  w. ja  v  a  2s .  co  m

        FileWriter file = new FileWriter("confSP" + File.separator + "contractFileList.json");
        file.write(obj.toJSONString());
        file.flush();
        file.close();

    } catch (IOException e) {
        e.printStackTrace();
    }

    System.out.print(obj);

}

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

public static void main(String[] args) {

    try {//  w w  w  . j  a va  2s .com
        // 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:cz.certicon.routing.web.Application.java

/**
 * @param args the command line arguments
 *//*  w ww  .  ja va  2s  . co m*/
public static void main(String[] args) {
    String filePath = "C:\\Routing\\Data\\CZ";
    if (args.length > 0) {
        filePath = args[0];
    }
    File file = new File(filePath);
    Settings.GRAPH_FILE_PATH = file.getAbsolutePath() + File.separator + file.getName() + ".graph.xml";
    Settings.COORDINATES_FILE_PATH = file.getAbsolutePath() + File.separator + file.getName() + ".coords.xml";
    SpringApplication.run(Application.class, args);
}