Jar « API « Java I/O Q&A





1. JarFile from inside a *.jar or inputstream to file?    stackoverflow.com

I have a jar or war. I'm programmaticaly reading this jar, and when I find jar inside this jar I'd like to programmaticaly read it again. But JarFile provides only getInputStream, which ...

2. which .jar file has javax.xml.stream.*?    stackoverflow.com

Going nuts again with my Mac running Java 1.5.... where do I get a .jar file that has javax.xml.stream.XMLInputFactory ? I want to use StAX but don't know how to get ...

3. How can I access a txt file in a jar with FileInputStream?    stackoverflow.com

I am aware of the getResourceAsStream() method but there is an issue with the parser that reads the file, the whole structure was implemented to expect a FileInputStream() and the getResourceAsStream() ...

4. How to read a file from a jar file?    stackoverflow.com

I have a file on a jar file; it's 1.txt for example how can I call it ; my source code is :

Double result=0.0;
        try ...

5. ResourceBundles outside a jar file    stackoverflow.com

I'm facing a problem when I need to distribute my java application, created using NetBeans 6.8. I have some translation files made with gettext as class files - made with msgfmt ...

6. Loading from JAR as an InputStream?    stackoverflow.com

Is there a ClassLoader implementation I can use to load classes from an InputStream? I'm trying to load a JAR for which I have an InputStream into a new ClassLoader.

7. How can I read a UTF-8 text file from a jar using the Java method Class.getResourceAsStream()?    stackoverflow.com

I have a UTF-8 file stored inside a java jar file. I am trying to read it using the method getResourceAsStream(), but the input stream reader that is returned by the ...

8. Reading persistence.xml from a POJO    stackoverflow.com

I have created an EJB3 project and a JPA project. I'm trying to create a helper class(which will be in a separate project/jar) that will return the Persistence Unit Name from ...

9. How can my JAR open itself as a stream?    stackoverflow.com

I'm trying to open a JAR as a stream, but can't understand where to get this stream...

JarInputStream s = new JarInputStream(/* what is here? */);
Where to get this stream? I'm trying ...





10. How can a Java program use files inside the .jar for read and write?    stackoverflow.com

I need to store data into files inside .jar file and read it again. I know that I can use Class.getResourceAsStream() method but it returns an InputStream that I can read from. ...

11. Why does InputStreamReader throw a NPE when reading from a jar?    stackoverflow.com

I'm trying to iterate over the class files in a known directory using streams. The ultimate goal is to obtain the class names for all classes that exist in a particular ...

12. Read an external file from a Jar    stackoverflow.com

I am using below mentioned code to read a file (.cer file) from a java class. The java class will be bundled inside a Jar and then be included into a ...

13. Read a file from inside the .jar folder    stackoverflow.com

I need to read the file, that is inside the jar folder in this way:

 DataSource coverdata = new FileDataSource(new File("here is the path"));
How do I get the exact path? I ...

14. I have an OutOfMemory error when reading images    stackoverflow.com

All right, so I am reading images in a subdirectory in the .jar file called 'images', and of course I have to access them via a stream because it's in a ...

15. How to detect a JAR file?    stackoverflow.com

How could I know if a inputstream is a JAR file? I can detect a JAR file by using:

try {
  JarFile jar = new JarFile("file");
} catch(ZipException e) {
  // not ...

16. Java Jar File As Stream Class Loader    stackoverflow.com

How can I load classes from a jar file stored as a blob in a database as the URL Class loader only accept a URL or file path?





17. JAR and Class file reader    coderanch.com

18. how to get class in the jar as inputstream    coderanch.com

Presumably, this relates to the Original Poster's earlier questions, where he wanted to find out all classes used by a particular class. Doing that involves reading the class file. One pit-fall in trying to read classes from Jars is that the name needs to use slashes, not dots, as package delimiters. So "java.lang.String" is "java/lang/String" in the Jar.

19. Loading Jar file dynamically from an InputStream    coderanch.com

Hello, I have this requirement of loading jar from an inputstream. My application is a jar file and I have encrypted it using encrytion algo. Now when my application starts, my main class will decrypt this file which returns an outputstream as decrypted stream. I want to use this stream without saving it to file. I can convert this stream to ...

20. DataInputStream and DataOutputStream in Jar file (no need to reply now)    coderanch.com

Hello. I've been learning I/O recently and everything seems fine except for when i put my program into a jar file. My current program is a game that tests how fast you can type the alphabet and i want it to store the fastest time, which is a double variable in a file. I wanted to use serialisation instead of just ...

21. Using FileInputStream with a relative location not working with JAR    coderanch.com

Ok, so somewhere in my rickroll application i've got a file which is rickroll.mp3 and is the argument for a fileinputstream. Now when i test my application in eclipse everything works fine. But when i export my source to a executable jar with eclipse the sound seems to be not loaded. I'm also using JLayer to play the mp3 file but ...

22. FileChannel for a jar file    forums.oracle.com

Gen.Java wrote: I don't want to treat it as a File, I just want to get a FileChannel so that I can map it to a MappedByteBuffer A FileChanel can only be created from a File so you are trying to treat a resource in a jar as a File. Why do you want a MappedByteBuffer? I suspect that you want ...

23. how to convert .jar file to byte stream?    forums.oracle.com

24. bufferedwriter using from jar    forums.oracle.com

of course i have got it compile, this problem turn up after i try to replace my old code, that doesnt work after packing it inside a jar.. ok thanks.. now it is working, but now, i cant read, can olny write.. i print out all the path and all are correct

25. Get OutputStream within jar    forums.oracle.com

26. Using FileReader to read a file inside JAR    forums.oracle.com

I have the following code: private void readFile(String type) { BufferedReader in = null; URL file = getClass().getResource("Hello.txt"); try { in = new BufferedReader(new FileReader(file.getPath())); } catch (FileNotFoundException ex) { ex.printStackTrace(); System.out.println("Unable to open file."); } } This works great within the compiler since the file is located within the pakage, however when I try to run the jar it does ...