directory « jar « Java I/O Q&A





1. Listing the files in a directory of the current JAR file    stackoverflow.com

I am making a game in JAVA where I want to come up with a list of files in a certain directory in my jar so I can make sure to ...

2. Difference between classpath and endorsed directory    stackoverflow.com

Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath? Is it possible to take ...

3. Directory list of JAR file within classpath    stackoverflow.com

The typically method to reference a file contained with a JAR file is to use ClassLoader.getResource. Is there a way to get the contents of a directory within a JAR files ...

4. Is putting external jars in the JAVA_HOME/lib/ext directory a bad thing?    stackoverflow.com

We have an application which runs in a JRE environment. The application uses some external jars and we have been putting them in the JAVA_HOME/lib/ext folder. This ...

5. How do I get the directory that the currently executing jar file is in?    stackoverflow.com

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.

6. How to read a directory from a jar file in web start    stackoverflow.com

I have been trying to implement Java WebStart but the problem I'm having is that I need to get a directory from a jar file with no luck... I need to read ...

8. How to make a jar file without recording the directory name?    stackoverflow.com

The folder Test contains various files and folders. I want to create a jar that contains only the Test's sub-folders and files, without the directory's name (Test) in hierarchy. I've tried:

 ProcessBuilder ...

9. Fetch file from specific directory where jar file is placed    stackoverflow.com

I want to fetch a text file from the directory where my jar file is placed. Assuming my desktop application 'foo.jar' file is placed in d:\ in an installation of Windows. There is ...





10. Current working directory when running a Jar    stackoverflow.com

I've created an application that is a runnable jar (using maven-assembly plugin) with a couple of user-configurable resources that sit along side it in the same directory (images, properties, etc.) When running ...

11. Command-line tool 'jar' is not reading directories    stackoverflow.com

I'm running jar in order to create a JAR file with the command:

jar cmf manifest.txt generatedParser generator gui resource
generatedParser, generator, gui, and resource are directories, but jar doesn't read ...

12. JAR executable doesn't start if it's in Programs directory    stackoverflow.com

I'm into a very strange issue that's making me crazy .-. I'm working on a relatively big Java project on Windows, using NetBeans and IzPack to prepare the graphical installation package. Everything is ...

13. Cannot find class even when jar file is in working directory    stackoverflow.com

I am struggling to get my Java program to run on AIX. I used Eclipse on Windows to create a runnable Jar file, jRams.jar below. I kept on getting a class ...

14. How to load classes from a jar or a directory    stackoverflow.com

I have found code to load classes from a directory, and code to load from a jar. My project needs to do both - use a directory when it is ...

15. How do I specify a directory for properties files in a jar manifest classpath?    stackoverflow.com

I'd like to put all of the .properties files that my executable jar requires in a sub-directory off of the directory from which I will run the jar file. Currently, my ...

16. Using a directory inside of a JAR file    coderanch.com

Hello, I have a JAR file that includes some binary files that I use, organized by some directory structure. For example, inside the directory maps, I have: maps/texas maps/florida Then, inside of those directories, I have the binary files I use. The code I use to do this is shown here: >>>>>>>>>>>>>>>>>>>>> String dbName = "texas"; // gets the main maps ...





17. Jar compress with deep directory    coderanch.com

I am trying to compress many files into a .jar file. These files to be compressed are distributed in different depth directories. I am using the JarInputStream and JarOutputStream as foloowing: public void createJar(String fileName, File file) throws Exception { FileOutputStream out = new FileOutputStream(fileName); FileInputStream fis = null; JarOutputStream jar = new JarOutputStream(out, new Manifest()); try { byte[] buffer = ...

18. Using directories inside of a JAR file    coderanch.com

Hello, I have a JAR file that includes some binary files that I use, organized by some directory structure. For example, inside the directory maps, I have: maps/texas maps/florida Then, inside of those directories, I have the binary files I use. The code I use to do this is shown here: >>>>>>>>>>>>>>>>>>>>> String dbName = "texas"; // gets the main maps ...

19. Directory, File, Jar input problem    coderanch.com

I've written a program that reads files from vaious locations on my drive to populate JComboboxes. It works file when I run the program through an IDE, but when I Jar the Classes it will not work. Here is an example: cboCrop = new JComboBox(); String line = null; BufferedReader br = new BufferedReader( new BufferedReader(new FileReader("C:\\Test\\Data\\Jclimate.txt")); while ((line = br.readLine()) ...

20. List directory of jars    coderanch.com

21. Creating an Executable JAR file with sub directories    coderanch.com

An executable jar is no different from any other jar except it has a single special line in the manifest. Any jar can contain whatever directories you want, which will be available as resources on your classpath. Of course you can NOT access any of them as if they were directories on a filesystem, because they aren't. That however is no ...

22. How can I jar a directory to a file programmically in Java    coderanch.com

Unfortunately, the java.util.jar package is geared towards reding jar files only. But Jar files are just Zip files, really. I'm sure there are 3rd-party APIs around for creating those. E.g., Ant has jar and zip tasks - have a look at the Ant source what those do, and you should be well on your way.

23. jar vs directory class    coderanch.com

I haven't looked for you, but if there's an answer to your question, you'd most likely find it in the servlet specification just like the answer to your previous question. I doubt that the order in which JAR files in the WEB-INF/lib directory are included, is well-defined. Is this an exam question or are you actually writing a web application in ...

24. How to execute jar file from another directory    coderanch.com

hello all, I have a jar file that is located in C:\JavaFiles\MyJar.jar When I execute the jar from the directory where it is located (i.e. java -jar MyJar.jar) it works. When I execute the jar from any other directory - i get:"Unable to access jarfile MyJar.jar". The jar file source directory was added to my classpath (on windows xp). What am ...

25. How do I add a whole directory of .jars to the classpath?    coderanch.com

How do I add a whole directory full of .jar files to the classpath? We're trying to use a whole series of existing .jars and don't want to add and delete parts of the classpath during troubleshooting. We just want to tell our (cmd-ln) program to look in one directory and use whatever .jars it finds. Thanks, Grey

26. adding jar or directory to classpath    coderanch.com

I have questions about classpath -- 1. what's the difference between adding some jar as "pre-fix to classpath" and adding jars as "appending to classpath" ? In Eclipse ideas there are such options. But, if you just want to add a .jar file to your classpath, what's the difference of pre-fixing it or suffix-ing it at the end of classpath ? ...

27. create jar problem: jarFile.jar: no such file or directory    coderanch.com

Have you seen this? Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ... Options: -c create new archive -t list table of contents for archive -x extract named (or all) files from archive -u update existing archive -v generate verbose output on standard output -f specify archive file name -m include manifest information from specified manifest file -e specify application ...

28. Transfer directory from ran java file to external jar    java-forums.org

Sorry, I don't understand what it means to "inject a folder"? Do you mean to copy the contents of a folder in one jar file into another jarfile? Does the other jar file already exist or will it be created? Is the "ran" jar file where the executing code is coming from? For reading and writing jar files see the JarFile ...

29. Running .jar from a UTF-8 Directory    java-forums.org

Hello lads, I recently updated my jre to 7 and noticed that now I cannot run my application if it's path contains Greek characters because it cannot find the necessary files. What is this all of a sudden ? is there any setting to change in my code in order to make it JavaUpdateStupidity proof ?

30. getResource - Traverse directory in jar    forums.oracle.com

Hi I have a directory called "SupportingFiles" in my Java project, and this is included in the jar. During runtime I would like to use all the ".txt" files available in that directory. Basically I am trying to get a list of all "*.txt" files available in "SupportingFiles". I have tried various ways with this.getClass().getResource() and this.getClass().getResourceAsStream(), but no luck. Could ...

31. Obtain jar self directory    forums.oracle.com

Hi! I have created a jar file that creates and reads files, text and properties files. When I run jar file from diferent location, the user.dir property changes, so jar file is creating files in that directories. What I need is to create files in the same directory jar file is located, or obtain that directory where jar file is located. ...

32. How to get the directory of a file within an executable jar?    forums.oracle.com

First of all, a File object represents a physical file. But this .xml thing (which WAS a file at some point) is not a file. It's just a resource within the jar (the jar is the only file here). So don't try to create a File object to represent that at all -- it won't work.

33. CLASSPATH pointing to a directory instead of a jar    forums.oracle.com

Hi All, Lets say I have a directory with 7 jar files and I need all of them in the CLASSPATH. If I set my CLASSPATH to the directory, I get a runtime exception that it doesn't know about the classes references in the jar. If I set my CLASSPATH to \.jar , it works. So does this mean that for ...

34. Create a temp directory that is kept inside a jar file    forums.oracle.com

Had you read the API for file, you would have found your solution. There are two createTempFile methods. One of them takes a File object pointing to a directory as an argument. So read the File API and then follow these steps: 1) use File to create a directory 2) change the code you have for extracting the files to use ...

35. Default directory in executable jar fie    forums.oracle.com

In which directory do you have your MyHelp.htm file. When you do not give a '/' in the bigining of the file getResourse start to look for it relatively to the class file. If your MyHelp.htm is located in a Help directory in the classpath root then the path should be "/Help/MyHelp.htm"

36. Writing to the directory where the JAR file is kept.    forums.oracle.com

Thanks, What I was trying to do is write a text config file that is user modifiable but I was having trouble figuring out where in my file system I was considering the context changes so much. I guess in the long run having it under the user directory is a better idea, but this was the only thing I could ...

39. jar -C directory option not functioning    forums.oracle.com

40. jar file Extraction in different directory...    forums.oracle.com

41. How to find directory java program .jar file is in?    forums.oracle.com

I have a Java program that needs to save some configuration and data files in the same directory as the .jar file that contains the program. If the user launches the app from that directory, it's easy. The problem is when they do something like "java -jar /dir1/dir2/program.jar". When they do that, HOW can I find the directory the .jar file ...

42. Getting a Directory within a JAR    forums.oracle.com

Hello, I've been wondering how it is possible to "get" a directory from within my JAR file. If, for example, my JAR's structure is: - meta-inf\manifest.mf - something\*.class - properties\*.properties - images\com\a.jpg - images\com\b.jpg - images\org\a.jpg - images\org\b.jpg Then, since my goal is to scan the JAR for all images recursively, and store them in a HashMap, I need to be ...

43. Creating JAR file for each directory    forums.oracle.com

Hi, I need to create one jar file for each plugin in my project. Plugins are in directories corresponding to their packages. That is: plugins/PLUGIN_TYPE/PluginID/ The last part of plugin's directory path - PluginID - is unique. I would like to create file PluginID.jar lacated in directory plugins/PLUGIN_TYPE which contains classes in specified directory. Such jar file must have directory structure ...

44. Jar Directory?    forums.oracle.com