Getting at a JAR file resource from an applet

I have an applet, which contains a class DBFReader (which I did not write, and do not have source code to). DBFReader takes a string as an argument that indicates the file name/location:
DBFReader mine = new DBFReader(String filelocation);
The file I want to get at is in the same JAR file as the applet it is not in a subdirectory or package. I cannot figure out how to get at the file. I have already tried the following:
DBFReader mine = new DBFReader(getClass().getResource("mydbffile.dbf"));
and
DBFReader mine = new DBFReader(getClass().getResource("mydbffile.dbf").getFile());
Neither of these work. Is there any way for me to get at this file?
Thanks,
Patrick

The error is runtime - the DBFReader throws an exception when you try to initialize it.
Patrick

Similar Messages

  • Determining the name of the jar file running from JAVA

    Hi everyone,
    This is probably a silly question, but how do you determine the name of the jar file running from within the jar file.
    E.g. If I'm running the jar file "Test.jar", then how can I get the String value "Test.jar" from within my program?
    Any help would be appreciated! Thanks:)

    I think that you can use the solution above to get the jar file resources associated with a particular jar file, and then use the JarFile class to get a manifest of whats in there, and then find your class?
    This is only off of the top of my head, and I haven't tested it. Let me know if it works

  • Jar files downloaded from SkyDrive are being renamed to jar.zip files

    I have cut and pasted the following series of exchanges from when I posted the problem onto SkyDrive's support forum. I hope that someone might be able to propose a better solution to the problem that I have. Thanks for your help.
    MDSms asked on
    Uploaded jar files convert to jar.zip files when downloaded from SkyDrive
    I have uploaded an executable jar file to SkyDrive. (I will call this FILE.jar). The file is intact and indicates that it is a jar file type when the file is viewed by Properties within Skydrive. However, when I download (or others download through a share link) the file, it is being saved onto the local computer's download file with .zip appended to the file name (FILE.jar.zip). The downloaded file can be renamed to remove the .zip appendage and subsequently run successfully. However the folder options for the folder where the downloaded file resides must be changed for disable "Hide known file extensions" prior to being able to remove the .zip appendage. While I have figured out the workaround for this problem, this manual renaming procedure is entirely too cumbersome as a solution for sharing this file with others. How can I prevent or disable the FILE.jar file from being renamed to FILE.jar.zip when it is downloaded from SkyDrive?
    All Replies (5)
    Audrey_P. replied on
    Forum Moderator
    Hi,
    Thank you for posting. Let me try to assist you with your issue with your files.
    In order for us to reproduce the issue on our end. Please provide us with the exact steps that you did when you uploaded the files as well as the steps when you are downloading it.
    We will be needing the steps to help us figure put what is causing you this issue.
    We look forward to your response.
    Thank you.
    Audrey P.
    MDSms replied on
    Reply
    The file was uploaded by first logging onto my SkyDrive account using Windows 7 Pro and Firefox browser, then a new folder in my account was created without sharing privileges, then the folder was opened and the FILE.jar was uploaded into the folder using the "Upload" option on skydrive account menu. Sharing privileges for FILE.jar were then created (view only), and the shortened url link was sent to the individuals that I was trying to share the file with. was then turned on. When these people use the link to download the file, it is being saved as FILE.jar.zip.
    When I try to download the file through the skydrive account download option, it is being saved onto my computer as FILE.jar.zip and this occurs when I try to download the file while signed into my skydrive account as well as when I am not signed into my skydrive account (using the shared file link).
    This PNG shows the information provided by clicking on the download icon (down arrow) within the Firefox browser; note that the file was downloaded as FILE.jar.zip and that the source was live.com. When I use Windows Explorer to look at the same file within the Download folder itself, examining the file's properties details also shows that it is being saved as FILE.jar.zip and is of the file type compressed zip folder.
    This PNG shows the information displayed to me from my skydrive account when I view the originally uploaded file's properties; note that the information shows that the file is a jar file type.
    When I utilize Internet Explorer 9 to access the file, FILE.jar is being downloaded onto my computer as a jar file type. This PNG shows the information provided by Tools/View Downloads within the IE9 browser. Note that in this instance, the information indicates that the file is being downloaded from yzudea.blu.livefilestore.com.
    It appears to me that the problem (the FILE.jar file being renamed to FILE.jar.zip) arises from the fact that a jar file downloaded from skydrive using firefox, is being sent from live.com whereas a jar file downloaded from skydrive using IE9 is being sent from yzudea.blu.livefilestore.com.
    I want to make sure that a person receiving a share link from me for FILE.jar is able to download it without modification to the file name regardless of which browser is being using to access the link. How can I make sure that this occurs?
    Any help is appreciated. Thanks.
    Michelle Anne D. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    I appreciate you for providing as much information as you can about the issue, as well as for uploading screenshots on what you see from the downloaded file. About your initial concern wherein the file gets renamed with .zip after the original file extension, this is solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented.
    Moreover, you may see the file servers live.com and yzudea.blu.livefilestore.com to be different with one another, but they actually are sent from the same SkyDrive server. This in turn, depends on the web browser where the file is being downloaded as well. The live.com file where it was downloaded from Firefox simply masks its original server yzudea.blu.livefilestore.com.
    As for your last query about your recipients downloading the file without the hassle of renaming it from a .zip file, you can simply tell them to download it through Internet Explorer.
    Should you have other queries or additional information that might help in our investigation, I highly encourage you to post them here.
    Regards,
    Michelle
    MDSms replied on
    Michelle,
    Thanks for your reply. Yes, I could simply tell them to download the file through Internet Explorer, but is there another solution or workaround to the problem I have described here? Am I being punished with the curse of this problem simply because I (or the individuals with which I wish to share FILE.jar with) choose to use Firefox instead of IE? Will the use of any other browser instead of IE (Chrome, Safari, etc., etc.) still result in the same problem?
    You stated that it is "solely dependent on the browser that you are using since they have a different safety/security measure that needs to be implemented"........could the problem be overcome by designating one or both of the file server addresses as Trusted Sites within the browser options setting?
    I look forward to your response. Thanks in advance.
    Joy V. replied on
    Forum Moderator Community Star Community Star
    Reply
    Hi MDSms,
    We understand your concern. Since the issue does not occur in Internet Explorer, it has something to do with Firefox's security feature. You might want to verify this concern by contacting Firefox support.
    Hope this helps. Let us know if we can further assist you with SkyDrive.
    Thanks,
    Melanie Joy

    Try to delete the mimeTypes.rdf file in the Firefox profile folder to reset all file actions.
    *http://kb.mozillazine.org/mimeTypes.rdf
    *http://kb.mozillazine.org/File_types_and_download_actions#Resetting_download_actions

  • How can I get a single jar file with NetBeans?

    How can I get a single jar file with NetBeans?
    When I create the project I get these files:
    dist/lib/libreria1.jar
    dist/lib/libreria2.jar
    dist/software.jar
    The libraries that have been imported to create the project are in separate folders:
    libreria1/libreria1.jar
    libreria2/libreria2.jar
    libreria1, libreria2, dist folders are all located inside the project folder.
    I added the following code to the build.xml:
    <target name="-post-jar">
    <jar jarfile="dist/software.jar">
    <zipfileset src="${dist.jar}" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria1.jar" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria2.jar" excludes="META-INF/*" />
    <manifest>
    <attribute name="Main-Class" value="pacco.classeprincipale"/>
    </manifest>
    </jar>
    </target>
    Of course there is also the project folder:
    src/pacco/classeprincipale.form
    src/pacco/classeprincipale.java
    Can you tell me what is wrong? The error message I get is as follows:
    C:...\build.xml:75: Problem creating jar: archive is not a ZIP archive BUILD FAILED (total time: 2 seconds)

    This is not a NetBeans forum, it is a JDeveloper forum. You might want to try http://forums.netbeans.org/. I also saw your other question - try looking in the New to Java forum: New To Java

  • Where can I get help re: a file missing from Pages in iCloud?

    Where can I get help re: a file missing from Pages in iCloud?

    If the file was also on a mac, then there was a local copy of the file in ~/Library/Mobile Documents.  If you use Time Machine or any other backup program on your computer, then try restoring the file(s).  Similarly the same thing would be done on a PC, but I'm not sure where the icloud local copies are kept.

  • Where are jar files downloaded to with Applet?

    I have an Applet and am using archive attribute in my applet tag to specify jar files needed by the applet. eg: "archive=myclassfiles.jar, foo.jar". Assume that myclassesfiles.jar has classes needed by the Applet and Foo.jar has some text files or xml files. Assume that Applet is signed.
    My question: I am assuming that all jar files are downloaded to the client when the Applet is started. Is this correct? If so, how can I open and read Foo.jar file within the Applet? I dont know the path to that file, that is, I dont know where on the client that Jar file has been downloaded to. Would the following work:
    URL aUrl = (new File("Foo.jar")).toURL();
    String path = aUrl.toString();
    would path point to the correct location of Foo.jar?

    They are downloaded to the client, and stored in a cache. I'm not sure they are readable from within the applet, however. But there are 2 solutions, depending on what you are doing.
    1) You want to get some images or other resources from the Jar file. Then do this:
    URL url = appletClass.getClass().getResource("myimage.jpg");
    ImageIcon icon = new ImageIcon(url);
    where appletClass is the applet object, and the resource ("myimage.jpg" is the relative path to the image in the Jar file.
    2) You want to muck around with the Jar (read it). Well you can't write to it that easily in an applet, as you can't access the file system without a signed applet, or you would have to POST it back to the web server via HTTP file upload. But if you want to just read it and get stuff out of it, you can always just do this:
    URL url = new URL(getDocumentBase(), "foo.jar");
    and then open the URLConnection for that URL and read the Jar in.

  • How to read file in JAR file (the one containing applet class)

    my applet needs to read a file (font file) that will be bundled in the jar file. how do i read that file?
    i tried using
    URL u = new URL("file:///myfont.ttf");
    u.openStream();i got AccessControlException. is there anyway for the applet to load file in the JAR file? i see applet can load image in the jar file so figured that it should be able to do so with some other type of file
    thanks

    The reason you're getting access violation is the way you code your URL -- it's pointing to a file on the user's local disk. If my.ttf is in the jar, try:
          URL url=myApplet.class.getClassLoader().getResource("myfont.ttf");Where myApplet is the name of your applet and the font file is assumedly kept in the same directory level in the jar file as the class file for your applet.
    ;o)
    V.V.

  • Downloading/uploading external (non-jar) files to/from client

    We are searching for a solution to upload and download non-jar files to or from the JWS-client. We've only found information to upload jar-files to a JWS-client, but we couldn't find anything about uploading non-jar files. Is there a standard solution or tool to do this with webstart?

    Hi there,
    We found a solution to upload the non-jar files, in our requirement we are trying to load the resources in the zip files. I have written the extension installer to extract the zip file from the URL to the JNLP client.
    But for this user has to click on the install pop up to allow the JWS to install the non jar files.
    Thanks,
    TSR

  • How to Remove Jar File name from the screen of nokia 40 series

    hi
    i have the problem with running midlet.
    the jar file jame is always visible on the screen, how to remove that ?

    >
    Prasanna Kumar wrote:
    > Hi ALL
    >
    > I am using  file adapter and I what to create file name dynamically by acesssing PO number and time stamp from the payload using variable substution.
    > But the problem is I am getting ":" in time stamp field value and it is not acceptable for file name .
    > So could you please tell me a way that I can remove this ":" from that particular field value and create the file name dynamically.
    >
    > Note 1)Add Time stamp option will not help me as we require a time stamp of particular zone.
    > 2) Dynamic Configuration code is also not use full as I am using 1:n file creation
    does the time stamp with the ":" a part of your output file?
    else use a replaceAll function in your mapping and replace the : with empty string then use the value in the variable substitution
    Another option is use the normal BPM for 1: N message flow. The use a simple java mapping that will introduce a dynamic configuration and you can create the file name as you want. the java mapping will be used in the flow of messages from BPM to target system.
    ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

  • How to get path of jar file

    I am using a class which is present in a jar file.
    There are lot of versions of this jar file are present on machine.
    I am accessing one class from this jar.
    How do I know which jar is used by application.
    How to get the path(path on machine like c:\java\lib) of this jar file.

    URL jarURL = this.getClass().getResource("/whatever.class");will return you a jar:// URL. Experiment with that. (Remember that "whatever.class" needs to be prefixed by the full name of the package the class is in.)

  • Can't Execute JAR file deployed from JDev 903

    Hi Everyone:
    I took the Oracle beginning Java class, and got a copy of JDeveloper 9, and started in on a project. The task was to create a small module that will allow users with no direct SQL access to change their Oracle passwords. The good news is that it runs great from within JDev; it catches exceptions cleanly, it handles multiple databases with no problems. The bad news is that I cannot get it to run from a batch file or command line (client is Windows). I have run 'setvars', I have copied the CLASSPATH from the run window in JDev, all to no avail.
    I am trying to deploy the app as an executable jar file. It's not meant to be an applet, because of the security implications.
    I would gladly RTFM, but the FM's that I have gloss over the deployment step in Jdev. I figure it's something obvious, but I just cannot figure it out.
    Any suggestions? Help a newbie...
    Thanks,
    Mike

    Hi Mike,
    I suggest you take a look at the log window of JDev, when you've successfully run your project.
    If the log window is not displayed, go to View | Log.
    Cut the command line, invoking javaw.exe, and paste it into your favorite editor.
    Change javaw.exe into java.exe, save your file as a bat file, go in a DOS console, and run the bat file.
    Let me know if it fixes your problem.
    Thanks,
    - Olivier

  • JAR file iinvoking from ANT

    We have JAR file the gets invoked from ANT file target and gives java.net.MalformedURLException: no protocol: https error.
    Ant target...
    <target name="abc">
              <java fork="true" jar="${build.home}/xyz.jar" dir="${build.home}">
                   <jvmarg value="-Xms472m"/>
                   <jvmarg value="-Xmx472m"/>
                   <arg value="${servlet.protocol}"/>
                   <arg value="${servlet.host}"/>
                   <!--arg value="9100" /-->
                   <arg value="${servlet.port}"/>
                   <arg value="${servlet.path.oconus}"/>
                   <arg value="oconus.pdf"/>
              </java>
         </target>
    xyz.jar file consists of class file that receives URL in the bufferedInputStreem and processes it to BufferedOutputStream.
    getting error...
    abc:
    [java] java.net.MalformedURLException: no protocol: https
    [java] at java.net.URL.<init>(URL.java:537)
    [java] at java.net.URL.<init>(URL.java:434)
    [java] at java.net.URL.<init>(URL.java:383)
    [java] at XXX.XXX..xyz.main(XYZ.java:28)
    Can anyone throw a pointer to what am I missing?
    Thanks!

    nothing ? that's weird, windows XP should prompt you to select the program you want to use in order to open Jar files (and give you this silly piece of advice to search the web for the appropriate program)
    you might want to check what program (if any) got associated with .jar extensions :
    in Windows Explorer : Tools => Folder Options => File Types
    hth

  • How to remove jar file name from screen of nokia 40 series

    hi,
    anybody know please tell.
    jar file name always appear on the screen, while running the midlet in nokia 40 series siut.
    how to remove that.

    >
    Prasanna Kumar wrote:
    > Hi ALL
    >
    > I am using  file adapter and I what to create file name dynamically by acesssing PO number and time stamp from the payload using variable substution.
    > But the problem is I am getting ":" in time stamp field value and it is not acceptable for file name .
    > So could you please tell me a way that I can remove this ":" from that particular field value and create the file name dynamically.
    >
    > Note 1)Add Time stamp option will not help me as we require a time stamp of particular zone.
    > 2) Dynamic Configuration code is also not use full as I am using 1:n file creation
    does the time stamp with the ":" a part of your output file?
    else use a replaceAll function in your mapping and replace the : with empty string then use the value in the variable substitution
    Another option is use the normal BPM for 1: N message flow. The use a simple java mapping that will introduce a dynamic configuration and you can create the file name as you want. the java mapping will be used in the flow of messages from BPM to target system.
    ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

  • Which jar file(s) from the Eclipse plug-in to use

    Post Author: supermonkey
    CA Forum: JAVA
    Hi,I downloaded JRC plug-in and realized there are 47 jar files for CR. Now I'm wondering how many of these 47 files are being use when running CR from Java? My Java application resides on a server and users access the application thru web start. If users have to download all 47 jar files every time they run the application, it would su*k for them very much. Now does anyone know which jar files are actually being use during execution?The document here http://support.businessobjects.com/communityCS/TechnicalPapers/cr_xi_r2_jrc_deployment.pdf.asp told me that I only need about 20 or so of them. I plugged into the classpath or my test application and errors occurred. Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/configuration/CompositeConfiguration        at java.lang.ClassLoader.defineClass1(Native Method)        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)        at java.security.AccessController.doPrivileged(Native Method)        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)        at com.crystaldecisions.reports.common.engine.ConfigurationManager.<init>(Unknown Source)        at com.crystaldecisions.reports.common.engine.Engine.configure(Unknown Source)        at com.crystaldecisions.reports.common.engine.Engine.getConfigurationManager(Unknown Source)        at com.crystaldecisions.reports.common.engine.a.a(Unknown Source)        at com.crystaldecisions.reports.common.engine.Engine.getKeycodeManager(Unknown Source)        at com.businessobjects.reports.sdk.a.a(Unknown Source)        at com.businessobjects.reports.sdk.a.<init>(Unknown Source)        at com.businessobjects.reports.sdk.a.if(Unknown Source)        at com.businessobjects.reports.sdk.JRCCommunicationAdapter.void(Unknown Source)        at com.businessobjects.reports.sdk.JRCCommunicationAdapter.connect(Unknown Source)        at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)        at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Unknown Source)        at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(Unknown Source)        at com.crystaldecisions.sdk.occa.report.application.ClientDocument.for(Unknown Source)        at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.for(Unknown Source)        at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)        at com.crystaldecisions.reports.sdk.ReportClientDocument.open(Unknown Source)        at JRCViewReport.launchApplication(JRCViewReport.java:26)        at JRCViewReport$1.run(JRCViewReport.java:50)        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Now does anyone know which jar files are actually being use during execution? Or are all them have to be present?  thanks,

    Post Author: supermonkey
    CA Forum: JAVA
    Hi Ted,Thanks for the reply. But what I was interested in knowing was how many of the Eclipse-CR plugin jar files does CR require for a successful execution? Or do I have to import all 47 jar files? thanks

  • Nexus 1000v .jar file missing from Nexus1000v.5.2.1.SV3.1.1

    Hello ALL!
    I am trying to install and configure Nexus 1000v, for the first time and looking to configure the second stage of linking the Nexus 1000v switch to vCenter and from tutorials and white papers say to continue the install using a .jar file. However not seeing this file in the latest release in 1000v zip file.
    I can see this .jar file in the version 4 release and re-downloaded the v5 just incase it was corrupt and from a different machine; no .jar file.
    %windir%\Nexus1000v.5.2.1.SV3.1.1-pkg\Nexus1000v.5.2.1.SV3.1.1.zip\Nexus1000v.5.2.1.SV3.1.1\VSM\Install
    Cant find the white papers for v5, has anything changed?
    HELP!!
    JC

    Check this:
    http://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus1000/sw/5_2_1_s_v_3_1_1/install_upgrade/workflow/nexus_1000v_r_5_2_1_s_v_3_1_1.html
    2-All files for this release can be found here:
    http://www.cisco.com/c/en/us/support/switches/nexus-1000v-switch/model.html
    HTH

Maybe you are looking for

  • Trouble with  "java.lang.OutOfMemoryError: Java heap space"

    Hello, I use a Java-based modeling tool that very few out there are probably familiar with. This tool allows me to run models (program) from within the development environment, to create Applets or create jar files that can be executed in a stand-alo

  • Pr Sequence sent to AME drops whole tracks or clips touched by Edit in Adobe Audition

    On an increasingly frequent basis in CS5.5 I have observed sequences sent from Pr to AME failing to include certain replaced audio clips (from Edit Clip in Adobe Audition) or several whole tracks (2 & 3).  In the most recent example the same sequence

  • How do I get encrypted PDFs to be read in Adobe X?

    I am testing this version, and the install went fine. When I went to view one of our encrypted documents, it said it needed a digital ID. Well, the Digital IDs are installed, they carried over from version 9. I even uninstalled and reinstalled, but g

  • FRM-40654 problems but only against one database (forms6i)

    Hi, I have one very basic form. The query data source of the block is a view. The DML data target is a table. The locking mode is set to automatic. Against our development database this form runs without any problem. We can query and update records a

  • My G-5 Won't go past the Grey Apple Screen......HELP HELP HELP

    I have a G-5 PowerMac. Its about a year old. I have used it more than sparingly. I bought it for video editing and have no other programs installed on it that didn't come with the computer besides Final Cut Pro I tried to turn it on this morning to e