Why do you want to do it? You can do it by unzip it and drop classes into yours. Then re-jar them into one jar file.
can run the jar alone with nothing else?
may be or may be not. If the third party classes in the jar depends on other jar files, then you still need other jar files to run. [ October 31, 2006: Message edited by: wise owen ]
William Yan
Ranch Hand
Joined: Sep 26, 2006
Posts: 69
posted
0
And what about a file, when i wirte a class that uses another file, say a .txt file, and put all the manifest, .txt, .class all in a jar. But i cannot use it. Must the .txt be put outside the jar?
Originally posted by William Yan: And what about a file, when i wirte a class that uses another file, say a .txt file, and put all the manifest, .txt, .class all in a jar. But i cannot use it. Must the .txt be put outside the jar?
Thank you
Yes, you may place other types of files in a jar file. However, if you do, you will need the classloader to get the file since the File class only deal with files in the filesystem.
See the getResourceAsStream() method of the java.lang.Class class.