Linked Questions

216 votes
12 answers
206k views

Find where java class is loaded from

Does anyone know how to programmaticly find out where the java classloader actually loads the class from? I often work on large projects where the classpath gets very long and manual searching is ...
luke's user avatar
  • 14.6k
152 votes
9 answers
235k views

Read properties file outside JAR file

I have a JAR file where all my code is archived for running. I have to access a properties file which need to be changed/edited before each run. I want to keep the properties file in the same ...
Neil's user avatar
  • 5,979
40 votes
2 answers
43k views

Get name of executable jar from within main() method [duplicate]

I've created an executable jar and using commons-cli to give the user the ability to specify command line parameters when he launches the client. Everything works fine. However, when I print the ...
Eric B.'s user avatar
  • 24k
27 votes
5 answers
67k views

How do I get the directory that the currently executing jar file is in? [duplicate]

I'm running a jar file in various locations and I'm trying to figure out how to get the location of the jar file that is running.
darrickc's user avatar
  • 1,912
24 votes
5 answers
105k views

How to get the execution directory path in java [duplicate]

I have made a pure java app which tells me about number of files in a given directory. Now I set current directory by using the following code: `File f = new File(".");` After that I made an ...
Mohd Faizan Khan's user avatar
15 votes
4 answers
71k views

Get location of JAR file

I'm trying to get the location a Runnable JAR file is run from. I tried doing try { String path = new java.io.File(".").getCanonicalPath(); } catch (IOException e) { e.printStackTrace(); } ...
Snakybo's user avatar
  • 429
15 votes
2 answers
1k views

Redux: How do I get Jython to use Python modules stored in Lib within its own jar file when running in Hadoop?

I'm attempting to use Jython for an implementation within Hadoop 1.2.1. I have seen strikingly little about Jython+Hadoop other than stale projects (like code.google.com/p/happy), and a stale ...
hoc_age's user avatar
  • 1,955
13 votes
3 answers
18k views

How to get spring boot application jar parent folder path dynamically?

I have a spring boot web application which I run using java -jar application.jar. I need to get the jar parent folder path dynamically from the code. How can I accomplish that? I have already tried ...
Carlos Nantes's user avatar
12 votes
2 answers
14k views

Access a resource outside a jar from the jar

I'm trying to access a resource from a jar file. The resource is located in the same directory where is the jar. my-dir: tester.jar test.jpg I tried different things including the following, but ...
mdp's user avatar
  • 171
11 votes
5 answers
19k views

Get name of running Jar or Exe

What I need to do is get the name of the running jar/exe file (it would be an EXE on windows, jar on mac/linux). I have been searching around and I can't seem to find out how. How to get name of ...
user1947236's user avatar
10 votes
2 answers
9k views

Get running file name in Java?

Is it possible to get the file name which is being executed. Like e.g. If i am running a Jar file, and inside i want to add code functionality that can detect the file name so that if this jar is ...
Johnydep's user avatar
  • 6,147
9 votes
6 answers
4k views

Clojure: how to get the path of a running JAR/root source directory?

In Java there's a simple way to get path of a running jar file: MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath() But in Clojure we do not have class name, only namespace ...
ffriend's user avatar
  • 28k
9 votes
3 answers
11k views

Can getResourceAsStream() find files outside the jar file?

I'm developing an application that uses a library that loads a configuration file as: InputStream in = getClass().getResourceAsStream(resource); My application in then packed in a .jar file. If ...
kunigami's user avatar
  • 3,056
6 votes
4 answers
23k views

Save Java txt file to folder

First of all - I love you all at Stackoverflow! Everyone is very helpful! Sadly when I go to answer questions they are all too advance for me :'( I want to save the text file to a folder - but not an ...
Rabiani's user avatar
  • 143
6 votes
1 answer
1k views

user working directory: XP vs Vista

I have a Java desktop application that I have written. During the execution I create folders and files at the default path name defined in the system. Java.io.files clearly states: By default the ...
uzil24's user avatar
  • 156

15 30 50 per page
1
2 3 4 5
10