Tabnine Logo
File.setExecutable
Code IndexAdd Tabnine to your IDE (free)

How to use
setExecutable
method
in
java.io.File

Best Java code snippets using java.io.File.setExecutable (Showing top 20 results out of 3,825)

Refine searchRefine arrow

  • File.<init>
origin: iBotPeaches/Apktool

public static String getAaptExecutionCommand(String aaptPath, File aapt) throws BrutException {
  if (! aaptPath.isEmpty()) {
    File aaptFile = new File(aaptPath);
    if (aaptFile.canRead() && aaptFile.exists()) {
      aaptFile.setExecutable(true);
      return aaptFile.getPath();
    } else {
      throw new BrutException("binary could not be read: " + aaptFile.getAbsolutePath());
    }
  } else {
    return aapt.getAbsolutePath();
  }
}
origin: Qihoo360/XLearning

public static void setPathExecutableRecursively(String path) {
 File file = new File(path);
 if (!file.exists()) {
  LOG.warn("Path " + path + " does not exist!");
  return;
 }
 if (!file.setExecutable(true)) {
  LOG.error("Failed to set executable for " + path);
 }
 if (file.isDirectory()) {
  File[] files = file.listFiles();
  if (null != files && files.length > 0) {
   setPathExecutableRecursively(file.getAbsolutePath());
  }
 }
}
origin: ethereum/ethereumj

private void initBundled() throws IOException {
  File tmpDir = new File(System.getProperty("java.io.tmpdir"), "solc");
  tmpDir.mkdirs();
  InputStream is = getClass().getResourceAsStream("/native/" + getOS() + "/solc/file.list");
  try (Scanner scanner = new Scanner(is)) {
    while (scanner.hasNext()) {
      String s = scanner.next();
      File targetFile = new File(tmpDir, s);
      InputStream fis = getClass().getResourceAsStream("/native/" + getOS() + "/solc/" + s);
      Files.copy(fis, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
      if (solc == null) {
        // first file in the list denotes executable
        solc = targetFile;
        solc.setExecutable(true);
      }
      targetFile.deleteOnExit();
    }
  }
}
origin: cSploit/android

/**
 * check if the cSploit user can create executable files inside a directory.
 * @param dir directory to check
 * @return true if can execute files into {@code dir}, false otherwise
 */
private boolean user(String dir) {
 String tmpname;
 File tmpfile = null;
 if(dir==null)
  return false;
 tmpfile = new File(dir);
 try {
  if(!tmpfile.exists())
   tmpfile.mkdirs();
  do {
   tmpname = UUID.randomUUID().toString();
  } while((tmpfile = new File(dir, tmpname)).exists());
  tmpfile.createNewFile();
  return (tmpfile.canExecute() || tmpfile.setExecutable(true, false));
 } catch (IOException e) {
  Logger.warning(String.format("cannot create files over '%s'",dir));
 } finally {
  if(tmpfile!=null && tmpfile.exists())
   tmpfile.delete();
 }
 return false;
}
origin: prestodb/presto

  private void copyExecutable(String name, File target)
      throws IOException
  {
    byte[] bytes = toByteArray(Resources.getResource(getClass(), name));
    Path path = target.toPath().resolve(new File(name).getName());
    Files.write(path, bytes);
    if (!path.toFile().setExecutable(true)) {
      throw new IOException("failed to make executable: " + path);
    }
  }
}
origin: apache/flink

private static void internalCopyFile(Path sourcePath, Path targetPath, boolean executable, FileSystem sFS, FileSystem tFS) throws IOException {
  try (FSDataOutputStream lfsOutput = tFS.create(targetPath, FileSystem.WriteMode.NO_OVERWRITE); FSDataInputStream fsInput = sFS.open(sourcePath)) {
    IOUtils.copyBytes(fsInput, lfsOutput);
    //noinspection ResultOfMethodCallIgnored
    new File(targetPath.toString()).setExecutable(executable);
  }
}
origin: redisson/redisson

File extractedLibFile = new File(targetFolder, extractedLibFileName);
      extractedLibFile.setExecutable(true);
  if (!success) {
  return new File(targetFolder, extractedLibFileName);
origin: simpligility/android-maven-plugin

sh = new File( "/bin/bash" );
if ( !sh.exists() )
  sh = new File( "/usr/bin/bash" );
  sh = new File( "/bin/sh" );
file.setExecutable( true );
return filename;
origin: simpligility/android-maven-plugin

File file = new File( filename );
PrintWriter writer = null;
try
file.setExecutable( true );
return filename;
origin: termux/termux-app

void handleUrlAndFinish(final String url) {
  final File urlOpenerProgramFile = new File(URL_OPENER_PROGRAM);
  if (!urlOpenerProgramFile.isFile()) {
    showErrorDialogAndQuit("The following file does not exist:\n$HOME/bin/termux-url-opener\n\n"
      + "Create this file as a script or a symlink - it will be called with the shared URL as only argument.");
    return;
  }
  // Do this for the user if necessary:
  //noinspection ResultOfMethodCallIgnored
  urlOpenerProgramFile.setExecutable(true);
  final Uri urlOpenerProgramUri = new Uri.Builder().scheme("file").path(URL_OPENER_PROGRAM).build();
  Intent executeIntent = new Intent(TermuxService.ACTION_EXECUTE, urlOpenerProgramUri);
  executeIntent.setClass(TermuxFileReceiverActivity.this, TermuxService.class);
  executeIntent.putExtra(TermuxService.EXTRA_ARGUMENTS, new String[]{url});
  startService(executeIntent);
  finish();
}
origin: testcontainers/testcontainers-java

@BeforeClass
public static void setupContent() throws FileNotFoundException {
  contentFolder.mkdir();
  contentFolder.setReadable(true, false);
  contentFolder.setWritable(true, false);
  contentFolder.setExecutable(true, false);
  File indexFile = new File(contentFolder, "index.html");
  indexFile.setReadable(true, false);
  indexFile.setWritable(true, false);
  indexFile.setExecutable(true, false);
  @Cleanup PrintStream printStream = new PrintStream(new FileOutputStream(indexFile));
  printStream.println("<html><body>This worked</body></html>");
}
origin: marytts/marytts

ZipEntry entry = entries.nextElement();
File newFile = new File(maryBase + "/" + entry.getName());
if (entry.isDirectory()) {
  System.err.println("Extracting directory: " + entry.getName());
      if (newFile.setExecutable(true, false)) {
        System.err.println("Setting executable bit on file: " + entry.getName());
origin: apache/geode

File generate(final File outputDir) throws IOException {
 File outputFile = new File(outputDir, generator.getScriptName());
 try (BufferedWriter writer = Files.newBufferedWriter(outputFile.toPath())) {
  writePreamble(writer);
  writeAbout(writer);
  writeExistenceTest(writer);
  writeRestoreData(writer, outputDir.toPath());
  writeIncrementalData(writer);
  generator.writeExit(writer);
 }
 outputFile.setExecutable(true, true);
 return outputFile;
}
origin: eirslett/frontend-maven-plugin

File nodeModulesDirectory = new File(installDirectory, "node_modules");
File oldNpmDirectory = new File(installDirectory, "npm");
File npmDirectory = new File(nodeModulesDirectory, "npm");
try {
  if (oldNpmDirectory.isDirectory()) {
    File copy = new File(installDirectory, script);
    FileUtils.copyFile(scriptFile, copy);
    copy.setExecutable(true);
origin: testcontainers/testcontainers-java

@SuppressWarnings({"Duplicates", "ResultOfMethodCallIgnored"})
@BeforeClass
public static void setupContent() throws FileNotFoundException {
  contentFolder.mkdir();
  contentFolder.setReadable(true, false);
  contentFolder.setWritable(true, false);
  contentFolder.setExecutable(true, false);
  File indexFile = new File(contentFolder, "index.html");
  indexFile.setReadable(true, false);
  indexFile.setWritable(true, false);
  indexFile.setExecutable(true, false);
  @Cleanup PrintStream printStream = new PrintStream(new FileOutputStream(indexFile));
  printStream.println("<html><body>This worked</body></html>");
}
origin: apache/drill

/**
 * Copy the standard scripts from source location to the mock distribution
 * directory.
 */
private void copyScripts(File sourceDir) throws IOException {
 File binDir = new File(testDrillHome, "bin");
 for (String script : ScriptUtils.scripts) {
  File source = new File(sourceDir, script);
  File dest = new File(binDir, script);
  copyFile(source, dest);
  dest.setExecutable(true);
 }
 // Create the "magic" wrapper script that simulates the Drillbit and
 // captures the output we need for testing.
 String wrapper = "wrapper.sh";
 File dest = new File(binDir, wrapper);
 try (InputStream is = getClass().getResourceAsStream("/" + wrapper)) {
  Files.copy(is, dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
 }
 dest.setExecutable(true);
}
origin: uber/okbuck

File groovyStarterConf = new File(groovyHome, "groovy-starter.conf");
FileUtil.copyResourceToProject("groovy/conf/groovy-starter.conf", groovyStarterConf);
File groovyc = new File(groovyHome, "groovyc");
new Groovyc().groovyVersion(groovyVersion).render(groovyc);
groovyc.setExecutable(true);
File startGroovy = new File(groovyHome, "startGroovy");
new StartGroovy().groovyVersion(groovyVersion).render(startGroovy);
startGroovy.setExecutable(true);
origin: eirslett/frontend-maven-plugin

@Override
public void extract(String archive, String destinationDirectory) throws ArchiveExtractionException {
  final File archiveFile = new File(archive);
        while (entries.hasMoreElements()) {
          ZipEntry entry = entries.nextElement();
          final File destPath = new File(destinationDirectory + File.separator + entry.getName());
          prepDestination(destPath, entry.isDirectory());
          if(!entry.isDirectory()){
            while (tarEntry != null) {
              final File destPath = new File(destinationDirectory + File.separator + tarEntry.getName());
            prepDestination(destPath, tarEntry.isDirectory());
              if (!destPath.getCanonicalPath().startsWith(destinationDirectory)) {
                destPath.createNewFile();
                boolean isExecutable = (tarEntry.getMode() & 0100) > 0;
                destPath.setExecutable(isExecutable);
origin: libgdx/libgdx

new File(outputDir, "gradlew").setExecutable(true);
Executor.execute(new File(outputDir), "gradlew.bat", "gradlew", "clean" + parseGradleArgs(builder.modules, gradleArgs), callback);
origin: konsoletyper/teavm

@Override
public void runTest(TestRun run) throws IOException {
  try {
    File inputFile = new File(run.getBaseDirectory(), run.getFileName());
    String exeName = run.getFileName();
    if (exeName.endsWith(".c")) {
    File outputFile = new File(run.getBaseDirectory(), exeName);
    List<String> compilerOutput = new ArrayList<>();
    boolean compilerSuccess = runCompiler(inputFile, outputFile, compilerOutput);
    outputFile.setExecutable(true);
    runProcess(new ProcessBuilder(outputFile.getPath()).start(), runtimeOutput);
    if (!runtimeOutput.isEmpty() && runtimeOutput.get(runtimeOutput.size() - 1).equals("SUCCESS")) {
java.ioFilesetExecutable

Javadoc

Equivalent to setExecutable(executable, true).

Popular methods of File

  • <init>
    Creates a new File instance by converting the givenfile: URI into an abstract pathname. The exact fo
  • exists
    Tests whether the file or directory denoted by this abstract pathname exists.
  • getAbsolutePath
    Returns the absolute pathname string of this abstract pathname. If this abstract pathname is already
  • getName
    Returns the name of the file or directory denoted by this abstract pathname. This is just the last n
  • isDirectory
  • mkdirs
  • delete
    Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a director
  • listFiles
    Returns an array of abstract pathnames denoting the files and directories in the directory denoted b
  • getParentFile
    Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not
  • getPath
    Converts this abstract pathname into a pathname string. The resulting string uses the #separator to
  • isFile
  • length
    Returns the length of the file denoted by this abstract pathname. The return value is unspecified if
  • isFile,
  • length,
  • toURI,
  • createTempFile,
  • createNewFile,
  • toPath,
  • mkdir,
  • lastModified,
  • toString,
  • getCanonicalPath

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now