List of usage examples for java.io File pathSeparator
String pathSeparator
To view the source code for java.io File pathSeparator.
Click Source Link
From source file:org.freeplane.plugin.script.ScriptingConfiguration.java
private void addClasspathElement(final ArrayList<String> classpath, File classpathElement) { final File file = classpathElement; if (!file.exists()) { LogUtils.warn("classpath entry '" + classpathElement + "' doesn't exist. (Use " + File.pathSeparator + " to separate entries.)"); } else if (file.isDirectory()) { classpath.add(file.getAbsolutePath()); for (final File jar : file.listFiles(createFilenameFilter(JAR_REGEX))) { classpath.add(jar.getAbsolutePath()); }/* w ww .ja v a2 s. c om*/ } else { classpath.add(file.getAbsolutePath()); } }
From source file:org.craftercms.cstudio.alfresco.service.impl.PermissionServiceImpl.java
protected String getFilenameFromKey(String key) { return key.substring(key.indexOf(File.pathSeparator) + 1); }
From source file:gov.nih.nci.sdk.example.generator.WebServiceGenerator.java
private void generateWebServiceArtifacts(String _focusDomain) { String java2wsCommand = "java2ws.bat"; if (isUnix() == true || isMac() == true) { java2wsCommand = "java2ws"; }//from w w w . ja va 2 s . c o m String projectRoot = getScriptContext().getProperties().getProperty("PROJECT_ROOT"); String cxfHome = getScriptContext().getProperties().getProperty("CXF_HOME"); String classesPath = projectRoot + File.separatorChar + "classes"; String srcPath = projectRoot + File.separatorChar + getScriptContext().getProperties().getProperty("PROJECT_SRC") + File.separatorChar + "generated"; String cxfClassPath = cxfHome + File.separatorChar + "lib" + File.separatorChar + "cxf-manifest.jar"; String javaToolPath = getScriptContext().getProperties().getProperty("JAVA_HOME") + File.separatorChar + "lib" + File.separatorChar + "tools.jar"; String classPath = "\"" + classesPath + File.pathSeparator + cxfClassPath + File.pathSeparator + javaToolPath + "\""; String packageName = createPackageName(_focusDomain); String cmd = cxfHome + File.separator + "bin" + File.separator + java2wsCommand; String argStr = " -wsdl -client -server -cp " + classPath; argStr += " -classdir " + classesPath; argStr += " -s " + srcPath; argStr += " -createxsdimports"; argStr += " -d " + projectRoot + File.separator + "conf"; argStr += " -servicename " + createServiceName(_focusDomain); argStr += " -portname " + createServiceName(_focusDomain) + " "; argStr += packageName + ".service." + createServiceName(_focusDomain) + "Impl"; getScriptContext().logInfo("Command: " + cmd + argStr); runCommand(cmd + argStr); }
From source file:com.taobao.android.builder.tasks.transform.ClassInjectTransform.java
private ClassPool initClassPool(List<JarInput> jarInputs, List<DirectoryInput> directoryInputs) { if (((VariantScopeImpl) this.appVariantContext.getScope()).getVariantData().getName().toLowerCase() .contains("debug")) { try {//from ww w.j a va 2 s . c om FieldUtils.writeStaticField(ClassPool.class, "defaultPool", null, true); } catch (IllegalAccessException e) { e.printStackTrace(); } } else { //logger.warn(">>> ?daemon <<<<"); } final ClassPool pool = ClassPool.getDefault(); try { File verifyFile = PathUtil.getJarFile(com.taobao.verify.Verifier.class); pool.insertClassPath(verifyFile.getAbsolutePath()); for (File file : appVariantContext.getScope().getJavaClasspath()) { if (file.isFile()) { pool.insertClassPath(file.getAbsolutePath()); } else { pool.appendClassPath(file.getAbsolutePath()); } } String path = Joiner.on(File.pathSeparator) .join(scope.getGlobalScope().getAndroidBuilder().getBootClasspathAsStrings(false)); pool.appendPathList(path); for (JarInput jarInput : jarInputs) { pool.insertClassPath(jarInput.getFile().getAbsolutePath()); } for (DirectoryInput directoryInput : directoryInputs) { pool.appendClassPath(directoryInput.getFile().getAbsolutePath()); } } catch (NotFoundException e) { throw new StopExecutionException(e.getMessage()); } return pool; }
From source file:org.craftercms.cstudio.alfresco.service.impl.PermissionServiceImpl.java
protected String getPermissionsKey(String site, String filename) { return new StringBuffer(site).append(File.pathSeparator).append(filename).toString(); }
From source file:edu.ksu.cis.indus.common.soot.SootBasedDriver.java
/** * Loads up the classes specified via <code>setClassNames()</code> and also collects the possible entry points into the * system being analyzed. All <code>public static void main()</code> methods defined in <code>public</code> classes * that are named via <code>args</code>are considered as entry points. It uses the classpath set via * <code>addToSootClassPath</code>. * // ww w . j a v a2s . c o m * @param options to be used while setting up Soot infrastructure. * @return a soot scene that provides the classes to be analyzed. */ @NonNull private Scene loadupClassesAndCollectMains(@NonNull final String[] options) { final Scene _result = Scene.v(); String _temp = _result.getSootClassPath(); Options.v().parse(options); if (_temp != null) { _temp += File.pathSeparator + classpathToAdd + File.pathSeparator + System.getProperty("java.class.path"); } else { _temp = classpathToAdd; } _result.setSootClassPath(_temp); for (final Iterator<String> _i = classNames.iterator(); _i.hasNext();) { final SootClass _sc = _result.loadClassAndSupport(_i.next()); _sc.setApplicationClass(); } final Collection<SootClass> _mc = new HashSet<SootClass>(); _mc.addAll(_result.getClasses()); RootMethodTrapper _rmt = rootMethodTrapper; if (_rmt == null) { _rmt = DEFAULT_INSTANCE_OF_ROOT_METHOD_TRAPPER; } _rmt.setClassNames(Collections.unmodifiableCollection(classNames)); for (final Iterator<SootClass> _i = _mc.iterator(); _i.hasNext();) { final SootClass _sc = _i.next(); if (_rmt.considerClassForEntryPoint(_sc)) { final Collection<SootMethod> _methods = _sc.getMethods(); for (final Iterator<SootMethod> _j = _methods.iterator(); _j.hasNext();) { final SootMethod _sm = _j.next(); if (_rmt.isThisARootMethod(_sm)) { rootMethods.add(_sm); } } } } Util.fixupThreadStartBody(_result); if (Constants.shouldLoadMethodBodiesDuringInitialization()) { loadupMethodBodies(); } return _result; }
From source file:com.mindcognition.mindraider.commons.profile.Profile.java
/** * Get URL of the last opened model./*from ww w .ja v a 2s .co m*/ * @return the last model opened String */ public String getLastOpenedModel() { // decide whether is opened model or notebook, if notebook, then load // notebook's model if (activeModel == null) { if (activeNotebookUri == null) { return null; } return MindRaider.outlineCustodian.getActiveNotebookDirectory() + File.pathSeparator + OutlineCustodian.FILENAME_RDF_MODEL; } return activeModel; }
From source file:org.ngrinder.perftest.service.PerfTestService.java
/** * Build custom class path on the given {@link PerfTest}. * * @param perfTest perftest//from w w w . j a v a 2s . c o m * @return custom class path. */ @SuppressWarnings("ResultOfMethodCallIgnored") public String getCustomClassPath(PerfTest perfTest) { File perfTestDirectory = getDistributionPath(perfTest); File libFolder = new File(perfTestDirectory, "lib"); final StringBuffer customClassPath = new StringBuffer(); customClassPath.append("."); if (libFolder.exists()) { customClassPath.append(File.pathSeparator).append("lib"); libFolder.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { if (name.endsWith(".jar")) { customClassPath.append(File.pathSeparator).append("lib/").append(name); } return true; } }); } return customClassPath.toString(); }
From source file:org.gnieh.blue.launcher.Main.java
/** * <p>/* ww w .j ava 2 s .co m*/ * Loads the configuration properties in the configuration property file * associated with the framework installation; these properties * are accessible to the framework and to bundles and are intended * for configuration purposes. By default, the configuration property * file is located in the <tt>conf/</tt> directory of the Felix * installation directory and is called "<tt>config.properties</tt>". * The installation directory of Felix is assumed to be the parent * directory of the <tt>felix.jar</tt> file as found on the system class * path property. The precise file from which to load configuration * properties can be set by initializing the "<tt>felix.config.properties</tt>" * system property to an arbitrary URL. * </p> * @return A <tt>Properties</tt> instance or <tt>null</tt> if there was an error. **/ public static Map<String, String> loadConfigProperties() { // The config properties file is either specified by a system // property or it is in the conf/ directory of the Felix // installation directory. Try to load it from one of these // places. // See if the property URL was specified as a property. URL propURL = null; String custom = System.getProperty(CONFIG_PROPERTIES_PROP); if (custom != null) { try { propURL = new URL(custom); } catch (MalformedURLException ex) { System.err.print("Main: " + ex); return null; } } else { // Determine where the configuration directory is by figuring // out where felix.jar is located on the system class path. File confDir = null; String classpath = System.getProperty("java.class.path"); int index = classpath.toLowerCase().indexOf("felix.jar"); int start = classpath.lastIndexOf(File.pathSeparator, index) + 1; if (index >= start) { // Get the path of the felix.jar file. String jarLocation = classpath.substring(start, index); // Calculate the conf directory based on the parent // directory of the felix.jar directory. confDir = new File(new File(new File(jarLocation).getAbsolutePath()).getParent(), CONFIG_DIRECTORY); } else { // Can't figure it out so use the current directory as default. confDir = new File(System.getProperty("user.dir"), CONFIG_DIRECTORY); } try { propURL = new File(confDir, CONFIG_PROPERTIES_FILE_VALUE).toURI().toURL(); } catch (MalformedURLException ex) { System.err.print("Main: " + ex); return null; } } // Read the properties file. Properties props = new Properties(); InputStream is = null; try { // Try to load config.properties. is = propURL.openConnection().getInputStream(); props.load(is); is.close(); } catch (Exception ex) { // Try to close input stream if we have one. try { if (is != null) is.close(); } catch (IOException ex2) { // Nothing we can do. } return null; } // Perform variable substitution for system properties and // convert to dictionary. Map<String, String> map = new HashMap<String, String>(); for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); map.put(name, Util.substVars(props.getProperty(name), name, null, props)); } return map; }
From source file:net.grinder.engine.agent.AgentImplementationEx.java
private String buildTestRunProperties(ScriptLocation script, AbstractLanguageHandler handler, Properties systemProperty, GrinderProperties properties) { PropertyBuilder builder = new PropertyBuilder(properties, script.getDirectory(), properties.getBoolean("grinder.security", false), properties.getProperty("ngrinder.etc.hosts"), NetworkUtils.getLocalHostName(), m_agentConfig.getAgentProperties().getPropertyBoolean(PROP_AGENT_SERVER_MODE), m_agentConfig.getAgentProperties().getPropertyBoolean(PROP_AGENT_LIMIT_XMX), m_agentConfig.getAgentProperties().getPropertyBoolean(PROP_AGENT_ENABLE_LOCAL_DNS), m_agentConfig.getAgentProperties().getProperty(PROP_AGENT_JAVA_OPT)); String jvmArguments = builder.buildJVMArgument(); String rebaseCustomClassPath = getForeMostClassPath(systemProperty, handler, m_logger) + File.pathSeparator + builder.rebaseCustomClassPath(properties.getProperty("grinder.jvm.classpath", "")); properties.setProperty("grinder.jvm.classpath", rebaseCustomClassPath); m_logger.info("grinder properties {}", properties); m_logger.info("jvm arguments {}", jvmArguments); // To be safe... if (properties.containsKey("grinder.duration") && !properties.containsKey("grinder.runs")) { properties.setInt("grinder.runs", 0); }//from w ww. j a va 2 s .c om return jvmArguments; }