package « jar « Java I/O Q&A





1. Can classes of same package spread across multiple Jar files?    stackoverflow.com

I am using some classes from a JAR file and they belong to a package (Say -- com.abc.xyz). The class am writing also belongs to that package but I won't be able ...

2. Dynamically generate JAR files based on package name with ANT    stackoverflow.com

My current build file has the following repetitive tasks:

<jar jarfile="${build.lib}/${prefix}-foo.jar">
    <fileset dir="${build.classes}">
     <include name="com/a/c/foo/**"/>
    </fileset> 
</jar>
<jar jarfile="${build.lib}/${prefix}-bar.jar">
    <fileset ...

3. Can I call class files that are within a jar library located in another jar file?    stackoverflow.com

I am trying to access the class files packaged as a library but unfortunately the jar libraries should be packaged in another jar file. As an example say I have a.jar ...

4. ant task to remove files from a jar    stackoverflow.com

How to write an ant task that removes files from a previously compiled JAR? Let's say the files in my JAR are:

aaa/bbb/ccc/Class1
aaa/bbb/ccc/Class2
aaa/bbb/def/Class3
aaa/bbb/def/Class4
... and I want a version of this JAR file without ...

5. reading xml file inside a jar-package    stackoverflow.com

Here's my structure:

  • com/mycompany/ValueReader.class
  • com/mycompany/resources/values.xml
I can read the file in my Eclipse project, but when I export it to a .jar it can never find the values.xml. I tried using ValueReader.class.getResource() and ValueReader.class.getResourceAsStream() but ...

6. Packaging reference documentation with jar file    stackoverflow.com

We are porting our .NET library to a java equivalent and is now looking at how to distribute this port. Packaging the classes into a jar-file seems like best practice and ...

7. Java create a JAR file for contrib packages in Lucene    stackoverflow.com

I have downloaded the source code of Apache Lucene using Subversion. Now I want to create a JAR file for a particular Java file in the contrib portion ...

8. Accessing classes in default package in a JAR file    stackoverflow.com

I have a Java application and the Java files are in a package called app. I have added a JAR file to the classpath. All classes in the JAR file are ...

9. java code snippet to read file before and after packaging into jar    stackoverflow.com

i know this must have been answered a million times, but i can't seem to find it anywhere. So here goes: in my junit test I have this to access the ...





10. hide some class file or package in jar file    stackoverflow.com

How can I export a jar without some class or package which I don't want others to use,but which is needed in project,means I can't delete them.

11. Java : Expose only a single package in a jar file    stackoverflow.com

I'd like to have a jar file in which only the API package is accessible. All the other packages (containing implementations) would not be accessible by another jar (nor by any ...

12. Packaging /libs/*.jar into a single jar?    stackoverflow.com

For the purposes of a clean cross-platform distribution, I'd like to have a single JAR file which contains everything required for the project. however, I have an external lib in my ...

13. How would I go about reading from a packaged file?    stackoverflow.com

I have a file that I packaged in my JAR file, but I can't figure out how I would read the text file and store it into a String variable. Any ideas ...

14. how to get the package infomation of a jar file    stackoverflow.com

I want to get the the package infomation of a jar file with java code.That is,get all package names,list the classes in each package.

15. Java: Encrypt JPG File inside .jar package    stackoverflow.com

When bundling some images inside a .jar Package (Java+Swing), what is the best way to protect the JPG files inside to prevent users from accessing the package and copying aforesaid images ...

16. Running a Java Program from jar file not working if another package is used, classpath set    stackoverflow.com

I am importing one class(it is not there in the default jvm) from one jar package and using it in another package. like I have a class program1.class in package package1 ...





17. Benefits of seperate Jar files versus organized package structure    coderanch.com

I am in a delima. I have a library that comprises of all of my classes, about 5000 of them. It is easier for deployment issues, to use all of this huge jar file to distribute and version to my customers. But, wouldn't it be easier to split up those classes into separate identities, instead of all my classes being placed ...

18. The benefits of separate Jar files vs. Packages.    coderanch.com

I am in a delima. I have a library that comprises of all of my classes, about 5000 of them. It is easier for deployment issues, to use all of this huge jar file to distribute and version to my customers. But, wouldn't it be easier to split up those classes into separate identities, instead of all my classes being placed ...

19. Packaging an entire application in one JAR file    coderanch.com

Howdy folks, I am currently working on a relatively simple Java application that uses Swing for its GUI. As such, there are several image files that it needs to load for icons etc. There are also a few text files that it might need to read for help files. Ideally, the entire application, including all of the picture/text files, will be ...

20. jar file from multiple packages    coderanch.com

You're right, the first place you go blind is in your eyes, There is a directory tree that matches the package tree under the src directory, I can create the jar file, but it does not run, even when I try and run the jar, the manifest is correct is says "Main-Class: one.Hello" the jar contains these files: Mainfest.mf meta-inf\ Mainifest.txt ...

21. Writing properties files, JARs, packages, etc.    coderanch.com

Hi, I was reading database config. info from a properties file from within a JAR file. I then added another properties file to store and retrieve settings for the application, and then read somewhere that it's not possible to write to a file within a JAR, so I moved both the properties files outside of the JAR file. Now I seem ...

22. 2 jar files with same package and same class name    coderanch.com

Hi , I have two seperate classloaders,each loading classes from 2 seperate jar files.The problem is : both the jar files say j1 and j2 have a packeages by same name say p with the same class say c. ie structure is j1 > p > c and j2 > p > c can we load these jars with 2 seperate ...

23. package& jar file    coderanch.com

24. Problem packaging my app as jar file    coderanch.com

Hello All, I'm trying to build an application that uses a third party class that extends JTable. I developed it in Netbeans and it runs fine. Now I'm trying to package all the class files as a jar and run them from the command line. When the app first pops up on the screen the third party app isn't used and ...

25. Doubt on packages with jar file    coderanch.com

I created two packages pack1 and pack2 in the root directory C:\pack1; C:\pack2; I want to use a class in pack1 at run time inside pack2.So I created a jar file with pack1 class.My doubt is whether to create jar file at the root directory or inside pack2.Because when I am creating at the root directory run time exception(class no found ...

26. Lost with JAR files and packages    coderanch.com

HI, I am a little lost with the packages and JAR Files, I made a tree structure: c:> /java /myProyect /source/ AnimalTest.java Animal.java Dog.java So, I compile, AnimalTest.java Without package sentence, and Everything is fine. But when I specified a package for AnimalTest.java, the compiler could not find the others classes, even when they are in the same package, this is ...

28. packaging all packages in an executable jar file    coderanch.com

i have a problem...please have a look on my project directory spinner/ spinner/componets/ spinner/components/SpinnerDemo3.class spinner/components/SpringUtilities.class spinner/components/CyclingSpinnerModel.class spinner/others/ spinner/others/check.class spinner/gui/ spinner/gui/launcher.class spinner/meta-inf spinner/meta-inf/manifest.mf so very obviously i have 3 packages , components, others and gui, now i want to make an executable jar file, so i run a command from spinner directory jar -cvfm myexe.jar meta-inf/manifest.mf components/*.class gui/*.class others/*.class so , in ...

30. Importing packages from jar files    coderanch.com

Hello I am on linux and trying to compile some code which imports packages which are available in a jar file. Using the jar tool I have checked the the appropriate class files are actually in the jar and that the folder structure corresponds correctly to the the structure implied by the import statement. I have placed the jar file in ...

31. I Present a Simple Problem With Possibly A Simple Solution? On the topic of packages and .jar files.    coderanch.com

Hello! I have come to this forum in need of help. To provide a bit of background: I have been tasked with writing tests for a large program with multiple classes. I've taken a year's worth of classes in Java. With that said, I have had little experience dealing with packages, classpaths, etc as the work we did in my Java ...

32. Packaging all files into a single executable .jar    java-forums.org

Ok, my problem is simply this. When I write even a simple program, netbeans gives me an executable .jar file along with another folder containing a couple more .jar files. Is there any way for me to package all these files/folders into on .jar file that will still run just by being double clicked? Thanks.

33. Packaging the application into several jar files and class methods    java-forums.org

Question one: I am transferring an application I developed in C++ to Java. Is it possible, and is it a good Java practice, to pack the application in several jar files. Sort of like shared libraries under C/C++. I would like to develop some common classes put them in appropriate packages and then have them in separate jar files so more ...

34. Why seal a JAR File or why seal packages with a JAR file?    java-forums.org

Suppose you have package scope class that contains some 'secret' information so the information also has package scope (other classes in the same package can reach that information but nothing outside the package can see it). Suppose the information isn't sealed: that allows me to define a public class in the same pacakge as where that information is stored; my class ...

35. Frustrated Beginner - How to import a jar file, package does not exist    forums.oracle.com

Hi folks. I have spent hours and hours researching this and cannot get it to work. Believe me, I have read all about the classpath and search paths and such, but I am stuck. I need to write an OpenGL program for my job and need to learn some Java. I'm planning on doing my work using the JOGL libraries. I ...

36. Find jar file using imported packages    forums.oracle.com

You can't. Do you mean you want to download the BouncyCastle openpgp jars? If so then visit www.bouncycastle.org . Edited by: sabre150 on Sep 7, 2009 11:46 AM I give up on the OP. He has been doing this pgp now for more than 10 weeks and he seems unable to do more than ask daft questions or repeatedly ask for ...

37. Calling a jar file in a package from .java in another package    forums.oracle.com

I am developing a application where I want to execute a jar file inside a package(resource) from Main.java file in another package(installer).Can anyone help me how to execute the jar using the relative path and packaging everything in a new single jar file. Edited by: coolfx on Aug 8, 2009 11:12 AM

39. packaging Jar file inside Jar file    forums.oracle.com

Hi, I have a question on Jar Files. Here is what is happening, I tried packaging the dependency jar files in a jar file, test.jar. The manifest file has the class path entry as e.g. Manifest-Version: 1.0 Class-Path: lib/log4j-1.2.12.jar lib/activation.jar lib/mail.jar Main-Class: com.test.Test.java When I run using java -jar test.jar, it complains that it cannot find the Logger class in the ...

40. [package and jar files]    forums.oracle.com

43. Accessing App resources After packaging in a Jar file    forums.oracle.com

I have a small application that contains few packages and a folder that holds configuration files (xml files), which are accessed by my classes at runtime. The application does not work when I package it in a jar file. My classes cannot find configuration files. I unpacked (unzipped) the jar file and I can see that the folder and configuration files ...

44. how to exec .pl files which is in a jar package?    forums.oracle.com

hi, i'm new to java so hope all the experts could give me a hand on this. i've a package structure as shown below. as you can see the a.pl file is in the lib folder which will be packaged in A.jar. so how am i able to call to execute the a.pl script if the java program (A.jar) being distributed? ...

45. executing a jar file package into another jar file    forums.oracle.com

hi all, i have a first jar file named "container.jar" whos contains the following entries : images/covert.jpg lib/***.jar component.jar the component.jar contains the following entries : org/mycompany/.....*.class Main.class META-INF/MANIFEST.MF ........ Main-Class: Main the "main" class is the main class of the application, for executing main class from the component jar file , it's easy : java -jar component.jar my question is ...