How do I get path / classpath separtor?
Category: java.lang, viewed: 1682 time(s).
OS platform have different symbol used for path separator. Path separator is a symbol that separate one path element from the other. In Windows you have something like:
.;something.jar;d:/libs/commons.jar
While on Linux operating system it looks like:
.:something.jar:/libs/commons.jar
To obtain the path separator you can use the following code.
package org.kodejava.sample.java.lang; import java.util.Properties; public class SystemProperties { public static void main(String[] args) { // Get System properties Properties properties = System.getProperties(); // Get the path separator which is unfortunatelly // using a different symbol in different OS platform. String pathSeparator = properties.getProperty("path.separator"); System.out.println("pathSeparator = " + pathSeparator); } } |
Can't find what you are looking for? Join our FORUMS and ask some questions!
Related Examples
- How do I get the name of a class?
- How do I know if a class object is an interface or a class?
- How do I get interfaces implemented by a class?
- How do I get package name of a class?
- How do I get super class of an object?
- How do I read system property as an integer?
- How do I decode string to integer?
- How do I insert a string in the StringBuilder?
- How do I remove substring from StringBuilder?
- How do I reverse a string by word?
- How do I convert varargs to an array?
- How do I remove trailing white space from a string?
- How do I remove leading white space from a string?
- How do I create a method that accept varargs in Java?
- How do I know a class of an object?
- How do I replace characters in string?
- How do I copy char array to string?
- How do I remove leading and trailing white space from string?
- How do I add leading zeros to a number?
- How do I calculate process elapsed time?
Most Viewed Examples
Latest Code Examples
Categories
100 Top & Latest
Latest Jobs
Blog Entries
Forums Entries
- Google Chrome
- Re: Importing and scanning the text
- Re: What Java books have you read?
- Re: How to create exe file
- How to create exe file
- Re: What Java books have you read?
- Infix expression
- Importing and scanning the text
- Re: I want to reduce the size of a JPG image
- MOVED: I want to reduce the size of a JPG image
