directory « class file « Java I/O Q&A





1. Getting directory path to .class file containing main    stackoverflow.com

Is it possible to get the path to my .class file containing my main function from within main?

2. Getting the path to the directory of a given class file    stackoverflow.com

I was confronted with code which tries to read some configuration files from the same directory where the .class file for the class itself is:

File[] configFiles = new File(
   ...

3. java class files in current directory?    stackoverflow.com

How "java" knows the class file to execute without setting the class path.ie.,Does it check in the current directory by default or we need to set the class path for current ...

4. How can I read file from classes directory in my WAR?    stackoverflow.com

I need to read text file from the classpath in Java WAR application. How can I read it as InputStream. File is located in /WEB-INF/classes/ folder, but when I use following ...

5. InteliJ Idea under Linux, No such file or directory on main class    stackoverflow.com

I have a problem. I'm running InteliJ Idea under linux. I have created a project and a module inside it, and in that module I have a class (MyClass.class) and when I'm ...

6. Current Directory for Class File    coderanch.com

I would like to be able to open a properties file which is kept in the same directory as the main class file (or jar) that is currently open. However, when I use the System.getProperty() method with various keys, I get back the location of the forte directory, not the location my class file is running from. I have checked the ...

7. Deleting an entire directory with File class's delete method    coderanch.com

When I use the File class's .delete() method to delete an empty directory, it works. However, if the directory contains files or subdirectories, it is not deleted. Is it possible for me to delete a directory, and all it's files and sub-directories in one fell swoop, without having to delete the contents first??? Any advice will be greatly appreciated. [ July ...

8. Loading file from classes directory    coderanch.com

9. Finding base directory of main class file    coderanch.com

I know how to find the base directory of an applet. ie. getDocumentBase(); but how do I determine the base directory or where all the files in a standalone application are located? The reason I ask is that I have created a Java software program that will be installed on an end user's machine. I need the program to be able ...





11. Accessing files that are there in classes directory    coderanch.com

Writing/modifying properties files at run-time sounds like trouble to me. Particularly one that is part of a web application classpath. There is a reason that you can only GET resources from the classLoader. To answer your question on how you may be able to do it: An alternative method to look at is the ServletContext method: getRealPath(). That converts a website ...

12. compiler output (.class files) differs if sources were compiled in different directories    coderanch.com

Hi, I have following problem: while compiling some set of classes different .class files are generated if compilation was executed in different directories. The diff between generated .class files is following: 1) version: 1062: aload_3 1063: invokevirtual 1066: goto 1078 1069: astore 15 1071: aload_3 1072: invokevirtual 1075: aload 15 1077: athrow 1078: aload_3 1079: areturn 2) version: 1062: ...