Linked Questions
109 questions linked to/from How to get the current working directory in Java?
0
votes
1
answer
6k
views
Why System.getProperty("home.dir") returns null [duplicate]
I cant figure out why System.getProperty("home.dir") is returning null instead of the current working directory.
I am using Eclipse Mars2.0 IDE on Ubuntu 16.04. I guess, this hardly matters which IDE ...
1
vote
2
answers
724
views
How to get the directory of the CMD when I execute a java executable file (.exe) [duplicate]
How would you find the current directory which the CMD is currently in from a java file which has been exported and converted into a .exe file.
I'm not looking for the current working directory as ...
0
votes
1
answer
573
views
File path of current execution replacing space and other characters [duplicate]
In my program I did
File jarFile = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath());
execPath = String.valueOf(jarFile.getParentFile());
To get the execPath = to ...
0
votes
1
answer
392
views
How to get directory of a .java file [duplicate]
Part of my (java) code needs to access a database. When opening a connection it checks if the actual database file exists (I use sqlite). I want to make my code portable, so I want to avoid hard ...
2
votes
0
answers
235
views
Get absolute path of java app on Heroku [duplicate]
How to know the absolute path of my Java web application deployed on Heroku?
is there any command to do this?
0
votes
1
answer
161
views
How to generically specify a file directory on a clients computer? [duplicate]
I know the title is a bit vague, so let me explain my explanation in more detail:
I have a Java application
I want to access the directory of my application on the clients computer, to store text-...
0
votes
1
answer
149
views
How to have a program print it's location? [duplicate]
I have a java program and I want it to be able to print out its location on the computer. For example, if I were to place the program in the Downloads folder, and run it, it would print out the path ...
1
vote
0
answers
108
views
get App working directory - JAVA [duplicate]
I'm Making my first step going from C# to JAVA and have plenty of stuff that I dont get .. :(
I was searching for a way to get current directory in JAVA
and found this answer(one of many one ) :
...
0
votes
0
answers
74
views
How do I print the working directory on the server? [duplicate]
I am trying to build a simple client server application in which the server should return the working directory.
I am very beginner in Java networking and at the moment I only know how to send a ...
0
votes
0
answers
64
views
java.io.FileNotFoundException: data.csv (The system cannot find the file specified) [duplicate]
I get this error when trying to run my command-line application which reads data from a given csv file. The filename is "data.csv" and should not be hardcoded. Here is my code:
Map<...
-1
votes
1
answer
98
views
How can I write a file to a directory using relative path [duplicate]
Edit: I have figured out a solution to this problem and it is very similar to was MS90 commented. Since my working directory is "ATM project", then java will only be able to notice relative path's I ...
0
votes
0
answers
49
views
Opening directory in java [duplicate]
I want to read in a text file but I want to actually be able to open up the directory(wherever the program is ran) and navigate to wherever I want to a .txt file. How can I do this in java?
419
votes
18
answers
848k
views
How to read text file from classpath in Java?
I am trying to read a text file which is set in CLASSPATH system variable. Not a user variable.
I am trying to get input stream to the file as below:
Place the directory of file (D:\myDir) in ...
123
votes
8
answers
393k
views
How to get current working directory in Java?
Let's say I have my main class in C:\Users\Justian\Documents\. How can I get my program to show that it's in C:\Users\Justian\Documents?
Hard-Coding is not an option- it needs to be adaptable if it's ...
66
votes
9
answers
100k
views
How to copy file inside jar to outside the jar?
I want to copy a file from a jar. The file that I am copying is going to be copied outside the working directory. I have done some tests and all methods I try end up with 0 byte files.
EDIT: I want ...