Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get relative path

String path = "/var/data/stuff/xyz.dat";
String base = "/var/data";
String relative = new File(base).toURI().relativize(new File(path).toURI()).getPath();
// relative == "stuff/xyz.dat"
Comment

PREVIOUS NEXT
Code Example
Java :: load a list from text file java 
Java :: java get first day of the week 
Java :: scanner.hasnext() 
Java :: iterate through an arraylist java 
Java :: if is true javascrtiptr 
Java :: repository query spring boot 
Java :: java stream get all max values 
Java :: how to create an array list in java 
Java :: fragment to fragment 
Java :: java mockito any string import 
Java :: sum of array elements java 
Java :: convert double into integer 
Java :: declare class constant array java 
Java :: java  
Java :: sorting java 
Java :: arraylist replace value java 
Java :: convert two bytes to int java 
Java :: java printf tab 
Java :: retrofit post header 
Java :: method resolve file in java 
Java :: how to draw a rectangle in libgdx 
Java :: hexstring to string In java 
Java :: calculate smallest angle difference 
Java :: object cloning in java 
Java :: greatest element in array in java 
Java :: Java alt f4 
Java :: generic classes in java 
Java :: binary to octal conversion java program 
Java :: What is the way to use profiles to configure the environment-specific configuration with Spring Boot? 
Java :: convert java to python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =