List of usage examples for java.io File mkdir
public boolean mkdir()
From source file:MainClass.java
public static void main(String[] a) { File file = new File("c:\\test\\"); file.mkdir(); }
From source file:Main.java
public static void main(String[] args) { File directory = new File("C:/temp/temp1/temp2/temp3"); if (directory.mkdir()) { System.out.println("Success mkdir"); } else {/*from w w w. j a v a 2 s . co m*/ if (directory.mkdirs()) { System.out.println("Success mkdirs"); } else { System.out.println("Failed"); } } }
From source file:Main.java
public static void main(String[] args) { // returns pathnames for files and directory File f = new File("C:/Texts"); // create/* w w w.j a va 2 s.co m*/ boolean bool = f.mkdir(); System.out.print("Directory created? " + bool); }
From source file:Main.java
public static void main(String[] args) { File dir = new File("C:/FileIO/DemoDirectory"); boolean isDirectoryCreated = dir.mkdir(); if (isDirectoryCreated) { System.out.println("successfully"); } else {//w ww . ja v a 2 s. c o m System.out.println("not"); } }
From source file:de.unisb.cs.st.javalanche.mutation.util.FilePerformanceTest.java
public static void main(String[] args) throws IOException { int limit = 1000; int total = 0; StopWatch stp = new StopWatch(); stp.start();//ww w . j a v a2 s . co m File dir = new File("mutation-files/tmp"); dir.mkdir(); for (int i = 0; i < limit; i++) { Map<String, Set<Integer>> map = getMap(); File tempFile = new File(dir, "test-" + i + ".ser"); if (!tempFile.exists()) { SerializeIo.serializeToFile(map, tempFile); } else { Map<String, Set<Integer>> deserialize = SerializeIo.get(tempFile); total += deserialize.size(); } } System.out.println( "Handling " + limit + " files took " + DurationFormatUtils.formatDurationHMS(stp.getTime())); }
From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.createdebate.CorpusPreparator.java
public static void main(String[] args) { try {/*from ww w . j ava 2 s . co m*/ // args[0] = directory with exported html pages File inFolder = new File(args[0]); // args[1] = output directory File outFolder = new File(args[1]); outFolder.mkdir(); // args[2] = parser implementation DebateParser parser = (DebateParser) Class.forName(args[2]).newInstance(); extractAllDebates(inFolder, outFolder, parser); } catch (Exception e) { e.printStackTrace(); } }
From source file:tests.JSONOutput.java
public static void main(String[] main) throws IOException { ObjectMapper mapper = new ObjectMapper(); File file = new File("./examples/"); if (!file.exists()) { file.mkdir(); }//from w ww . j a va 2 s . c om { Keyspace k = new Keyspace("DDD"); mapper.writeValue(new File("./examples/keyspace.json"), k); { Table t = new Table(k, "tableName", "pk", "pkt"); t.addColumn(new Column("columnName", "columnType")); mapper.writeValue(new File("./examples/table.json"), t); } { Table t = new Table(); t.setKeyspace(k); t.setName("tableName"); TableQuery query = new TableQuery(); query.setTable(t); query.setCondition("WHERE name='bob' AND score >= 40"); mapper.writeValue(new File("./examples/query.json"), query); } } }
From source file:org.solrsystem.Main.java
public static void main(String[] args) throws IOException, HttpException { if (GraphicsEnvironment.isHeadless()) { UI = new TextInstall(); } else {//w w w . j ava 2s .c om UI = new GraphicalInstall(); } if (UI.confirm("Do you want to create ./SolrSystem in this directory and install SolrSystem?")) { File solrSystemDir = new File("SolrSystem"); //noinspection ResultOfMethodCallIgnored solrSystemDir.mkdir(); UI.downLoad(GRADLE); File file = new File(solrSystemDir, "gradle-1.11-bin.zip"); if (!file.exists()) { doGetToFile(GRADLE, file.getCanonicalPath(), UI); } } }
From source file:fr.ericlab.mabed.app.Main.java
public static void main(String[] args) throws IOException { Locale.setDefault(Locale.US); Configuration configuration = new Configuration(); Corpus corpus = new Corpus(configuration); System.out.println("MABED: Mention-Anomaly-Based Event Detection"); if (args.length == 0 || args[0].equals("-help")) { System.out.println("For more information on how to run MABED, see the README.txt file"); } else {//ww w.j ava 2s. c o m if (args[0].equals("-run")) { try { if (configuration.numberOfThreads > 1) { System.out.println("Running the parallelized implementation with " + configuration.numberOfThreads + " threads (this computer has " + Runtime.getRuntime().availableProcessors() + " available threads)"); } else { System.out.println("Running the centralized implementation"); } corpus.loadCorpus(configuration.numberOfThreads > 1); String output = "MABED: Mention-Anomaly-Based Event Detection\n" + corpus.output + "\n"; System.out.println("-------------------------\n" + Util.getDate() + " MABED is running\n-------------------------"); output += "-------------------------\n" + Util.getDate() + " MABED is running\n-------------------------\n"; System.out.println(Util.getDate() + " Reading parameters:\n - k = " + configuration.k + ", p = " + configuration.p + ", theta = " + configuration.theta + ", sigma = " + configuration.sigma); MABED mabed = new MABED(); if (configuration.numberOfThreads > 1) { output += mabed.applyParallelized(corpus, configuration); } else { output += mabed.applyCentralized(corpus, configuration); } System.out.println( "--------------------\n" + Util.getDate() + " MABED ended\n--------------------"); output += "--------------------\n" + Util.getDate() + " MABED ended\n--------------------\n"; File outputDir = new File("output"); if (!outputDir.isDirectory()) { outputDir.mkdir(); } File textFile = new File("output/MABED.tex"); FileUtils.writeStringToFile(textFile, mabed.events.toLatex(corpus), false); textFile = new File("output/MABED.log"); FileUtils.writeStringToFile(textFile, output, false); mabed.events.printLatex(corpus); } catch (InterruptedException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } else { System.out.println("Unknown option '" + args[0] + "'\nType 'java -jar MABED.jar -help' for more information on how to run MABED"); } } }
From source file:javasnack.cli.CliDbUnitCsvExportDemo.java
public static void main(String[] args) throws Exception { String driver = System.getProperty("CliDbUnitCsvExportDemo.driver", "org.h2.Driver"); Class.forName(driver);// ww w.java 2s .co m String url = System.getProperty("CliDbUnitCsvExportDemo.url", "jdbc:h2:mem:CliDbUnitCsvExportDemo"); String dbUser = System.getProperty("CliDbUnitCsvExportDemo.dbUser", "sa"); String dbPassword = System.getProperty("CliDbUnitCsvExportDemo.dbPassword", ""); Connection conn = DriverManager.getConnection(url, dbUser, dbPassword); CliDbUnitCsvExportDemo demo = new CliDbUnitCsvExportDemo(); demo.setup(conn); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); Calendar c = Calendar.getInstance(); File outDir = new File(sdf1.format(c.getTime())); outDir.mkdir(); IDatabaseConnection dbunit_conn = new DatabaseConnection(conn); IDataSet dataSet = dbunit_conn.createDataSet(); CsvBase64BinarySafeDataSetWriter.write(dataSet, outDir); conn.close(); }