Jar 3 « jar « Java I/O Q&A





1. jar files question    coderanch.com

2. Using Jar Files    coderanch.com

I need to distribute my applctn by making a jar. My application references other jars which has been included in the "lib" folder. I have created the jar containing the class files and the lib folder. Now I need to execute my main class using the option java -jar . But it doesnot seem to work as it throws an error ...

3. Making a JAR file.    coderanch.com

4. Jar File/Deployment Question    coderanch.com

Hey everyone, So I have an application I have gotten to the prototype stage. It works pretty good too. I got the multithreading to work, the network I/O, the user interface and all that working great. Now my problem is deployment. I am trying to create a JAR file that is executable. I got this to work, but no entirely. I ...

5. Refering a jar file from another jar    coderanch.com

Hi, I have one jar file that needs to refer some of the files from xerces.jar. I know that we cannot include a jar within a jar. The other way is to have a manifest file. But the problem I am facing while using the manifest file is when I place both the jar in same folders than everything works but ...

6. jar file concept    coderanch.com

7. Jar file doesn't work properly    coderanch.com

You don't have the MySQL jar in the classpath; move it to be in the same folder as this .jar. I can never remember exactly where to put it, so you may have to experiment with it until it works. And make sure you have a blank line at the end of the mainfest file. Try that, and if it doesn't ...

8. Arguments not shown properly in the .jar file    coderanch.com

Hello, I am creating a .jar file which containing an Interface that is used by the third party integrators. The problem I am facing is that the parameters of the methods in the interface is not getting passed to the Client-side in the correct format. E.G.: The method exposed in the interface public void removeDisplay (SessionId aSessionId, ObjectId aDisplayId); When accessed ...

9. Jar file referring to another jar file    coderanch.com

I want to deploy my application as a WAR file. Let's say deploying it as an EAR is not an option. I have utility1.jar in WEB-INF/lib that needs classes in other utility2.jar (which is also in WEB-INF/lib) at runtime. Do I need to classpath entry in utility1.jar manifest pointing to utility2.jar? Your help is appreciated.





10. How to work out where a jar file is coming from?    coderanch.com

Hi All, I am trying to work out where a jar file is coming from (which directory). As I am facing a problem with the wrong version of a jar being picked up and used in an application. I presume this is the result of classpath order, or another JVM argument suggesting to do this, but I would like to find ...

11. jar files    coderanch.com

hi, I am trying to run a jar file called abc.jar. I have 2 versions of jdk on my system - version 1.1.8 and version 1.3. jdk 1.1.8 is set on my system classpath.I do not want to change the classpath. The command I use to run the jar is as follows- java -classpath C:\jdk1.3\jre\lib\rt.jar;C:\jdk1.3\jre\lib\i18n.jar;C:\jdk1.3\lib\dt.jar;C:\jdk1.3\lib\tools.jar --jar c:\abc.jar. The error message I ...

12. jar file confusion...    coderanch.com

Strangely, I find myself in a situation where a class file that I'm putting into a Jar is not found. The jar is in the classpath explicitly. The file is in package com.intown.bg.jdbc and is compiled to the appropriate directory (d:\jdk1.3\lib\com\intown\bg\jdbc). If the file is compiled and left in that directory, the program runs fine. But it shouldn't NEED to be ...

13. Please explain jar files    coderanch.com

My "class to java" question is similar. A jar file is a compilation of several class files. You can look at them individually using WinZip. Consider a jar file exactly as you would a zip file. However, my question also revolves around actually seeing the source code if you only have the jar available. Let's see if anyone can help.

14. jar file    coderanch.com

15. Serialization to and from a jar    coderanch.com

For deploying a class with data already in it, can i serialize an instance, put it in a jar, and the open that instance, and reselialize to the jar to save the data (as it started or modified by the user). Basically, i want to have a platform independant place to put data without using a database. What should i do? ...

16. JAR files    coderanch.com





17. Jar files    coderanch.com

18. JEdit and jar files    coderanch.com

19. File.jar    coderanch.com

20. Jar file    coderanch.com

Hi, make a Manifest File with the following contents and while making jar use the created manifest file. Manifest file contents Manifest-Version: 1.0 Main-Class: Main Class Name Created-By: 1.3.0rc2 (Sun Microsystems Inc.) jar cvmf < manifestfilename> < jarfilename> *.class For applet < applet code=AppletClassName codebase="." archive="jarfilename.jar"> < /applet> Shiva. (Marilyn put spaces after < s) [This message has been edited by ...

21. jar file    coderanch.com

22. getting the name of a jar file from inside the jar    coderanch.com

This is one solution. It's painful. I hope there is a better way, but I don't know one. Grrr. HTML is not enabled. import java.net.URL; public class Test { public static void main(String[] args) { Class cl = Test.class; URL url = cl.getResource("/" + cl.getName().replace('.', '/') + ".class"); System.out.println(url); // in the form file:/to/where/the/jar/is.jar!/Test.class String path = url.getPath(); System.out.println("Path: " + ...

23. Creating a JAR file    coderanch.com

Hi Guys; I am a Java "Greenhorn", I am trying to create a JAR file for the first time and I am having some problems. I was successful in creating a package. I had to use the SET CLASSPATH so that my package could be found. I then tried the next step to create a JAR file. I compressed the directory ...

24. Execution of JAR files and memory    coderanch.com

Trent was essentially correct. Launching an app with the -jar command line switch just tells the runtime to look in the jar for the specified class that declares a main method. However, the entire jar is not loaded into memory, unlike say a DLL would be. Instead, whenever the virtual machine needs to load a class, it looks in the jar ...

25. writing back to jar file ??    coderanch.com

I think maybe you are trying to make this too difficult. But I have to ask a question or 2. Are you having a problem with basic I/O in JAVA or Is your problem with how to write to a file that exists inside a JAR file? If the latter is true, then is your java program running from the same ...

26. Jar files not being seen    coderanch.com

27. jar files with htm files in them    coderanch.com

I just want to have one file, a jar file and i want to include all my icons and help documentation within this one jar file. I don't have a problem with the icons but i can't figure out how to get IE or netscape to understand the html files while they are in the jar. Basicly the url link looks ...

28. About JAR files...    coderanch.com

I've packaged up a jar file with my classes and libs neatly placed in their directory structure. I've created a cmd file that will be used to call the main method of the application to start the application. I'm having trouble adding the libs within the jar to the classpath so my application can find and use them. Here is the ...

29. Question on jar file    coderanch.com

30. JAR File    coderanch.com

Hello! to All, When I run the ".jar" file using: java -jar abc.jar The following error appears: Failed to load Main-Class manifest attribute from abc.jar. I updated the manifest.mf file in the META-INF folder of the abc.jar file, like that: Manifest-Version: 1.0 (I added) Main-Class: RF2 (Note: RF2 is the name of the class which contains the main() method, i.e, the ...

31. jar files    coderanch.com

32. jar files    coderanch.com

33. Jar file doesn't work    coderanch.com

Hello. I have created a jar file and put a shortcut on my desktop so I can just click on it and run it. However, when I double click the shortcut, it acts like it's going to work, but then the hourglass goes away and nothing ever comes up. No errors either. Can someone please tell me what's going on?? Thanks! ...

34. create jar files    coderanch.com

35. jar files    coderanch.com

36. Imbedded jar file    coderanch.com

I have an application packaged as a jar file, and it uses two other jar files when it runs. I get it to work with no problem when I add the "Class-Path" header into the manifest file as follows: Class-Path: firstFile.jar secondFile.jar In this scenario, the jar files are located in the same directory as the jar that I am envoking. ...

37. Help with this jar file    coderanch.com

I am a newbie with creating jar files, but I suspect that you need to change the name of mainclass to manifest. I think there is also a way to specify the file to use as the manifest file, but I'm not exactly sure. Alternatively, you can specify a class name to run explicitly when you use the java command. In ...

38. Compiler cannot see jar file?    coderanch.com

Hi Linda, Not sure about this, but I think jar file are place inside lib directory inside where you install SDK, and I thought classpath is to only to read .class files, but not .jar. if you have install the SDK in C:\j2sdk1.4.1_01\ then jar file should be place here: (thats how I did it) C:\j2sdk1.4.1_01\lib then set the path: path ...

39. creating jar file programatically    coderanch.com

What's wrong with your code as-is? It looks like it does all the things you need: 1) Directories are created on the filesystem as the jar fiel is unjarred somewhere. Creating entries "something/something/filebytes" will create the directory something/something when it is unjarred. 2) The jar file is automatically created through the FileOutputStream, 3) Unless you actually wanted to return the jar ...

40. Obtaining jar files.    coderanch.com

41. How to create JAR files    coderanch.com

Hi all! I'm very newbie in Java. I got to do an application for my school where my teacher haven't teached us very well. My application is finished but I want to know how to create a JAR file. Is a JAR file an executable file? What's a manifest file? I've got a main Swing form, several classes, a folder where ...

42. jar files???    coderanch.com

hi, i have 1 class which will call other classes where this classes is in a jar files. however both are in the same directory. when i try to compile my class(the calling class), i get an error says that it cannot resolve symbol. the error was at the line where i call the classes in jar file. how to handle ...

43. Help building a JAR file...    coderanch.com

I just downloaded about 4,000 pages of public domain HTML. In order to display these pages offline, I found some java code on the web which creates a smart browser for this. I would like to take these four .java files and put them, together with the 4,000 plus HTML pages and put them into a single jar file. I'd like ...

44. Where to put jar files    coderanch.com

I have just started with Java, using 1.4.2, in windows. I have a couple of questions about where 3rd party jar files should be placed. I am using iText, a set of java classes to create PDF files. Now to get my programs to compile, I placed the itext-1.3.jar file in the same folder as my java source file. Now I ...

45. Generat JAR file with resouces such as picture and music!    coderanch.com

try it like this, if it still doesn't display - check the capitalisation of the image fileName import java.net.URL; import java.awt.*; import javax.swing.*; import javax.imageio.ImageIO; class ImageInJar extends JFrame { Image img; public ImageInJar() { loadPicture("TEST.GIF"); setLocation(200,100); setSize(600,300); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().add(new ImagePanel(img)); } public void loadPicture(String path) { try { URL url = new URL(getClass().getResource(path), path); img = ImageIO.read(url); } catch(Exception e){JOptionPane.showMessageDialog(null,"URL ...

46. how can we make a jar file    coderanch.com

47. Jar file uses?    coderanch.com

Hello there, I am currently learning about the use of and how to implement jar files , when a jar file is created is it solely for portability of code and space reduction , or can a jar file actually be used within an application as a jar file , when I read the explanation I have in front of me ...

48. Jar File    coderanch.com

I have a executable jar file which pop's up a GUI but while uploading GUI it should populate Data in a combo box with the help of MySql database but it doesn't it gives an error java.lang.ClassnotFoundException : com.mysql.jdbc.Driver, i no it's mysql driver i have downloaded it and added to classpath of System env but it still gives the exception. ...

49. trouble creating jar file    coderanch.com

I keep getting a "Can't find main class. Program will exit". This is what I have: Copy.java has been compiled to copy.class. Here is the source code: import java.io.*; public class Copy { public static void main(String[] args) throws IOException { File inputFile = new File("text.txt"); File outputFile = new File("outagain.txt"); FileReader in = new FileReader(inputFile); FileWriter out = new FileWriter(outputFile); ...

50. List the files of a jar    coderanch.com

Hi all, I need some help. I have a jar that contains many package and files and i am accessing that file in an application .In the jar files there is some files in a perticular folder that means, com.org.twinkle.Test I need to get all the Class files in this folder to my application I tried several way but can't get ...

51. locked jar file    coderanch.com

Hi all, I am developing a java program which has 2 threads, one to read the inbound MQ and the other to write message to the outbound Q. Since it is still in the development stage and sometimes the program aborted with exceptions. Then I tried to change the code and rebuild the program but I couldn't delete the previous jar ...

52. creating a jar file    coderanch.com

Maybe it's just me but the Java Tutorial documentation is not helpful. I know the commands but can't seem to create one. Every time I go into a command line or a shell in Win, it says the command jar is unrecognized. I get the same when I go into the Gnome Terminal on my Linux box. Thanks.

54. How to make a jar file ?    coderanch.com

Rather than giving you the answer straight up, I'll assume you want to do this from the command line. So type jar at the command line and you will get a screen of usage information for this command plus a couple of examples as well. Try it and see how you go. Regards, JD

55. .jar file question    coderanch.com

Yeah, I went there to check it out and saw that it's a pay site. I don't have a problem with paying a few bucks if I really need the service. Although, right now I'm doing OK with un-jaring files and hunting for the class/package I need. As for using google, well, I do that and all I can seem to ...

56. Jar file    coderanch.com

Thank you for your help. This is my situation: I have developed code that I need to give it to client in form of jar. The environment in which client will be using the my jar file has its own JVM provided by CISCO. This JVM, for some reason, does notallow my client use java.util.Arrays. My thought was that if I ...

57. .jar file    coderanch.com

58. jar files    coderanch.com

You do not need to supply the main class' name in the manifest, but then you will not be able to execute it, unless you supply the fully qualified name with the jar in your classpath. Most of the packages are packaged in this way - i.e. try and execute javaee.jar ...

59. listing files in a jar file    coderanch.com

I've been fiddling about with jar files, lately... Currently I'm using a .jar that contains a number of resources such as fonts, images and so on. As long as I attempt to access a resource (e.g. using getClass().getResource(String s) for images or getClass().getResourceAsStream(String s) for setting up of a custom font, respectively) things work properly. I tried to create a new ...

61. Bundle picture files in a jar file?    coderanch.com

ok i have a GUI that i am making into a jar file, but how do you get the .GIF files to bundle in with it? cause the jar file (after execution) will show the pictures if in the same folder, but when i move it out, it won't? Thanks, Justin Fox

62. 2 Files with the same Name in JAR - which wins?    coderanch.com

I'm assuming your talking about which resource (class, properties, etc...) will get loaded? 1.) They may be loaded by different class loaders, in which case it is usually the highest ancestor class loader that wins. Unless the jars gets loaded as part of a webapp (in servlet 2.4 spec and above) then, usually, it is the webapp classloader. 2.) If it ...

63. jar file help please    coderanch.com

jar cmvf manifest.txt jahok.jar * why wont it keep my images in the jar file, if my jar is in the same folder as the images they show up, but when i move the jar to desktop , it doesnt draw, or read from files its supposed to... Thanks, Justin [ February 05, 2007: Message edited by: Bear Bibeault ]

65. Is there a way I can store pictures/sounds into my Jar file?    coderanch.com

Yes, the JAR needs to be in the classpath, but if the Java program itself (the game Paul is talking about) is in the same JAR file, then it will already be in the classpath. So there's nothing special you have to do with the classpath. The easiest way to access files like images etc. that are inside a JAR is ...

66. how to make a jar file    coderanch.com

67. compileing with .jar file    coderanch.com

thanks, I tried to compile a source on dos prompt with your command like javac -cp.... -CP option is not valid for compiler. anotherone, e.g, a test.java source is in c:\APP\PGM\ and import B.UTIL.Iaddress; import B.UTIL.Ilookup; .... jar is in c:\lib\utility.jar what contains for Iaddress and Ilookup etc.. In this case, where I need to compile and how , what I ...

68. jar file with in a jar file    coderanch.com

Is this possible? I have a scenario where I have a third party jar file that I use in a package. I want to create a single jar file for both my package and also any third party jars I used in my package. what is my path of action for this? Brian

69. Setting classpth for jar files    coderanch.com

70. why are JAR files created    coderanch.com

Originally posted by prasanna sheregar: one more doubt, suppose i have A.class,B.class and C.class in a single JAR file which has name XYZ.jar then how can i get only A.class file back JAR files are a special kind of ZIP files. Using a ZIP application, such as WinZip, TugZIP or Windows XP's built in unpacker, you can easily extract any file ...

71. Referencing Jar files    coderanch.com

72. JAR file    coderanch.com

Dear friends, I created a JAR file called Test.jar. Now there are some classes inside another jar and i have to use those classes inside Test.jar to make it a complete working jar. The main class is in Test.jar only. I don't know how to include the other jars inside Test.jar. Kindly provide your help in resolving this problem. Regards, Viay ...

73. Jar file    coderanch.com

74. jar files    coderanch.com

75. What is the use of jar file?    coderanch.com

76. .jar file association stolen    coderanch.com

Hey guys, I am new to Java after having spent about 5 years in web development. I seem to have accidentally told windows to associate .jar files with something other than java, and now I can't get it back. If I run a .jar from the command line using java -jar it works just fine. I tried reinstalling the JRE and ...

77. jar files in vista business    coderanch.com

hi I am presentely using vista business os and the latest jcreator but when trying to make a jar file i get this error message "java.io.FileNotFoundException: classes (Access is denied)" my former machine was xp pro and jar files worked perfectely why am I having problems now setup similar to the other machine thanks a bunch olly

78. File dates in JAR verbose display    coderanch.com

Why are the file dates later than the manifest creation date ? File dates interest me - you could have copied the wrong version of the file into the directory to be JAR'ed. http://java.sun.com/docs/books/tutorial/deployment/jar/view.html The JAR tool will display additional information if you use the v option: jar tvf TicTacToe.jar For example, the verbose output for the TicTacToe JAR file would ...

79. Import *.jar File in Java Code    coderanch.com

The following is a simple SWT HelloWorld code, /* * SWTHelloWorld * * A dialog box with the title "Hello World" */ import org.eclipse.swt.widgets.*; import org.eclipse.swt.*; public class SWTHelloWorld { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Label label = new Label(shell, SWT.NONE); label.setText("Hello, World!"); shell.pack(); label.pack(); shell.open(); while (!shell.isDisposed()) { if ...

80. Question on making a Jar file    coderanch.com

81. regarding JAR files    coderanch.com

Hi Folks, I am sorry if i am posting my question in wrong area. I am creating a jar file using a batch file. It will create the jar files jar -cvf0 c:\upload\temp\afile.jar c:\datafiles\*.xml c:\datafiles\*.doc it is creating "afile.jar". I need to unjar this file in a UNIX meshine. I copied it to UNIX meshine and unjared it. It is creating ...

82. Classpaths and Jar files.    coderanch.com

83. Jar files    coderanch.com

If you set it in a command window, it will affect only the PATH for that command window and that session. It will not affect other command windows or shells (such as Windows Explorer which is the primary Windows GUI). If you add it to your environment variables settings, than it will be present for all command windows opened after its ...

84. how to know the version of java used to create a jar file    coderanch.com

Hi, How to know the version of the java used to create a jar file? I know that MANIFEST.MF may contain Created-By field which may tell you. But this is not true all the time. Sometimes Created-By field is not there are sometimes it has some arbitrary value. So anybody has any other suggestion? Regards, Litty Preeth

85. to make a user friendly jar file    coderanch.com

86. jar file    coderanch.com

Agreed with all Manish said! it would be more clear for someone to help, if you could specify your intentions and the jar type. If you need to browse through the files inside the jar. Use any application that can open zip files. If you are sure it is an executable jar, you may have associated it to an incorrect application. ...

87. Regarding Jar File    coderanch.com

In my application iam using some external libraries.... I want to build an executable jar file for my application.... I want the external jar files should also be present in the jar file.... I have tried, but failed to execute the jar file.....as my application unable to find the external jar files in classpath I need help regarding... Note: -------- I ...

88. Files inside the Jar    coderanch.com

89. Need Help on :: Programatically Creating Jar file From Existing Jar file    coderanch.com

I am trying to create dummy jar file based on existing jar file; using java.util.Jar package classes like JarFile, JarOutputStream, Manifest class objects. What I am tryig to do is I have A.jar file read A.jar; JarFile get its manifest object with JarFile.getManifest() manifest.put("READER", "MyName"); If i specify this manifest in JarOutputStream(outputstream, manifest); Get ZipException -> Duplicate META-INF\META-INF.MF entry What is ...

91. Jar Files: Kill me NOW.    coderanch.com

I want to create an executable JAR file, with the following structure: /com/mycompany/whatever/(All my classes go here) /lib/(All my dependency JAR files go here) Seems like, no matter what I put in the Class-Path entry of Manifest.mf, Java can't find the dependency jars in the embedded /lib folder. I've tried many variations on the following: Class-Path: lib/depJar1.jar lib/depJar2.jar or Class-Path: ../lib/depJar1.jar ...

93. How to create Jar file[Greenhorn]    coderanch.com

Hi Kris, you should check out the help for the jar command "jar -help" Simple example: "java cvfm .jar manifest.txt -C classes ." or "jar cvfe .jar

-C classes ." classes is the directory containing all .class files. The period "." represents everything in that directory. The manifest file contains what the main class, classpath if ...

94. Recursively list all files in a jar    coderanch.com

I have a jar with Scala source files in it and I want to list all the file names. It seems like it should be a pretty simple, but the best I could come up with is this convoluted mess. Please tell me there is a better way. package filelister; import java.io.*; import java.util.*; import java.util.jar.*; public class JarDir { public ...

95. packing java file into JAr file    coderanch.com

96. JAR files cached in JVM ?    coderanch.com

Hi, I have a folder named lib which basically contains all the JAR files needed for the system. Now, in some time, a specific JAR file will be automatically generated and replace an existing JAR file in the lib folder. When doing so, the system is still seeing the old JAR file and not the new one. Do i have to ...

97. Doubts in .jar files...    coderanch.com

i have two sets of jar files at two different locations say, c:/temp/a.jar and c:/sample/b.jar. There is a file in a.jar which accesses the class which is there in b.jar. When i try to execute this, i am getting noclassdef found error.... but, both jar's are perfect with the files. Should there be anything extra to be done/added, if jar's are ...

98. jar files and their parameters    coderanch.com

Hello, and thanks for any help you can offer me The background for my question is that we are creating some jar files where I work, so we can reuse some code on many projects... the problem is that once i add the jars to the classpath, and i try to use the methods i have in the jars, the parameters ...

99. How to get number of top-level files/directories ina Jar file?    coderanch.com

Hi, I have a jar file, I want to get the number of the top level files/directories without extracting it. For example, if I have the following contents in a jar file: about.html META-INF\MANIFEST.MF README.txt sample\sample.java sample\calc.java On top level, I have 2 files ( about.html and README.txt) and 2 directroies ( META-INF and sample), so the total number of top ...

100. jar file not working    coderanch.com

import java.awt.*; import java.awt.event.*; public class TestII extends Frame { public TestII() { super("buton example"); Button b1,b2,b3; Panel p; Label l; System.out.println("testing"); b1=new Button("C"); b2=new Button("B"); b3=new Button("A"); p=new Panel(new FlowLayout()); p.add(b1); p.add(b2); p.add(b3); this.add(p,BorderLayout.NORTH); l=new Label("some label"); msHandler h=new msHandler(l); b1.addMouseListener(h); b2.addMouseListener(h); b3.addMouseListener(h); this.add(l,BorderLayout.SOUTH); } public static void main(String args[]) throws Exception { TestII t; t=new TestII(); t.setSize(300,200); t.setVisible(true); t.addWindowListener( ...