How to look inside a jar?

I am getting errors when using the sun deploytool. I think there is an ejb-jar.xml inside my ejb-jar file. how do i look at it?

You can use the jar tool or any program that handles zip files (jar files are just zip files).

Similar Messages

  • How do I run a Jar file?

    Hey,
    I created a program that I want my friend to use so he can send me some information about his server. however, I can't figure out how to make it work with a jar file. For instance, I have a .class file called server and also a txt file called Manifest.txt so I write this command in my terminal.
    jar cf serv server.class Manifest.txt
    this then creates the jar file. Within the "Manifest" file I have written,
    Main-Class: server
    Now when I try to run this program I type in
    java -jar serv
    then it out puts this.
    Failed to load Main-Class manifest attribute from
    serv
    When I run the program with my JDK it works perfectly fine and the little server runs without a problem. I am extremely new to working with jar files to make programs work so I feel like im over looking something stupid. Does anyone know what else I need todo to make this program run? Thanks ,
    Cobbweb

    Isn't the "manifest" supposed to live in the jar's
    "meta-inf" folder, and be named "manifest.mf" (not
    manifest.txt)?Yeah, but wouldn't you think the "jar" command would take care of those details? The help for its "m" options just says "include manifest information from specified manifest file".
    There are stupid things to watch out for, though, like having a proper line-ending (e.g. CR/LF) on the last line of the manifest file. And usually you make the name of your jar file have a ".jar" extension, although I doubt it would be a problem if you didn't do that.
    Looking inside the jar file would tell you a lot. Such as if the server.class file wasn't in it, or was in it but in the wrong directory, and so on.

  • How to make an applet to read the Text file present inside a jar

    Hi All,
    I have writen one applet named ReadFile.java which reads a text file present in the same directory and does some manipulation of text file contents.
    The applet code runs successfully when i run the applet in command prompt like
    {color:#ff0000}*java ReadFile*{color}
    And i am getting the needed results.
    Then i made a jar file with the applet code and text file as
    {color:#ff0000}*jar cvf rf.jar ReadFile.class File1.txt*{color}
    Then i have inlcuded this applet inside a html file as
    {color:#ff0000}*<applet code= "ReadFile.class" width= "500" height= "300" archive = "rf.jar" ></applet>*{color}
    after this when i load the html file, the applet code is not executed fully. Its throwing FileNotFoundException: File1.txt.
    Applet is not recognizing trhe text file present inside the jar file.
    Can any body explain me how to overcome this problem. Any setting needs to be done for making the applet indicate the presence of Text file inside the jar file.

    what code in your applet gets the text file and reads it? are you using getResource or something similar?

  • How can i get the path to config folder placed inside the jar file?

    Hi i have developed an RCP application using eclipse.
    In my application config directory is there.
    When i export my RCP application as JNLP Project the jar file is created which contains config folder inside it.
    When i download the application using java web start , how can i get the path to config folder placed inside the jar file?
    Will the config folder exists in local cache in my system?
    Help needed.
    -Deepak

    -- This works in CS6:
    tell application "Adobe InDesign CS6"
      set myDocument to active document
      set selectedRectangles to selection of myDocument
      set theGraphicsLink to file path of item link of (graphic 1 of (item 1 of selectedRectangles))
    --> "Macintosh HD:folder/folder/filename.tif"
    end tell

  • How to redefine function in nsLoginManager.js inside omni.jar

    I would like to redefine a function. I find the definition inside omni.jar in the file nsLoginManager.js. If I rename omni.jar to omni.zip, I can see the contents, but if I try to drag an updated nsLoginManager.js to the archive, Windows 7 complains the archive is corrupt. I tried putting an extra copy of nsLoginManager.js into the components directory, but it did not override the other definition.
    How can I edit omni.jar to include my new nsLoginManager.js with my updated funtion?

    Yes, I have successfully extracted the contents already by that exact method. However, I fail when trying to update the modified file in the omni.jar as Windows 7 complains the archive is corrupt. Alternatively, if I make a new .zip for all the files including my modifications, Firefox fails to launch.
    The format of the omni.jar is not standard, how can I modify it?

  • How to read some files inside the jar

    Hi,
    I have an applet that runs with JWS. The user can input some information and then I need to show this information in a web page. As the application can be run offline, I cannnot use JSP�s to generate the web page. The information is saved in a xml file, so I use a xsl parser to generate the html code. The problem is that I have to include some javascript files (.js). I put these files inside the jar, but, how can I read these files, or how can I reference these files from inside the html page ?
    Thanks !

    You can use getClass().getResource(classpath)
    to get a stream version of the data from your
    jar file. If you need to put it in a file, you
    can write that stream to a file in a temp directory.
    classpath is the classpath of your js file

  • How to point to the HelpSet file which is inside a Jar

    Hi All,
    Can anyone please help me out on as to how I incorporate my help files (which are inside a jar) with JavaHelp. They are working fine when they are in a folder. But giving an error when i am trying to reference it from a jar file.
    Thanx in advance,
    Debopam.

    Hello,
    I have a little Example, and I hope this will help you.
    Melly
    * Opens the documentation in an JavaHelpViewer.
    protected void showDocumentation() {
         String jarFilePath = ".../test.jar";
         HelpSet hs = getHelpSet(jarFilePath);
         if (hs!= null) {
         HelpBroker hb = new HelpBroker(hs);
    hb.setDisplayed(true);
         else {
         System.out.error("Can't find the helpSet-file.");
    * Returns the HelpSet file which is in included into the given
    * jar file.
    * @param jarFilePath
    * @return the HelpSet file, or null, if the HelpSet file is not found.
    protected HelpSet getHelpSet(String jarFilePath) {
         HelpSet hs = null;
         try {
         String hsName = null;
         JarFile jar = new JarFile(jarFilePath);
         Enumeration entries = jar.entries();
         while (entries.hasMoreElements()) {
              ZipEntry entry = (ZipEntry) entries.nextElement();
              String entryName = entry.getName();
              if (entryName.endsWith(".hs")) {
              hsName = entryName;
              break;
         URL url[] = getURLs("file:" + jarFilePath);
         ClassLoader cl = new URLClassLoader(url);
         URL hsUrl = HelpSet.findHelpSet(cl, hsName);
         hs = new HelpSet(cl, hsUrl);
         catch (Exception exc) {
         System.out.error("Can't find a HelpSet file in: " +jarFilePath");
         hs = null;
         return hs;

  • I went in you tube and watched videos on how to fix my headphone jack and its not the headphones cause when I look inside I see this little white costing in there I think that's the problem how can I fix it

    I went in you tube and watched videos on how to fix my headphone jack and its not the headphones cause when I look inside I see this little white costing in there I think that's the problem how can I fix it

    - Try cleaning out/blowing out the headphone jack. Make sure that y do not leave any foreign material or leave anything in the jack. Try inserting/removing the plug a dozen times or so.
    Try the following to rule out a software problem
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    If not under warranty Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself
    iPod Touch Repair – iFixit

  • How to read, write file inside the JAR file?

    Hi all,
    I want to read the file inside the jar file, use following method:
    File file = new File("filename");
    It works if not in JAR file, but it doesn't work if it's in a JAR file.
    I found someone had the same problem, but no reply.
    http://forum.java.sun.com/thread.jsp?forum=22&thread=180618
    Can you help me ? I have tried this for all night !
    Thanks in advance
    Leo

    If you want to read a file from the JAR file that the
    application is packaged in (rather than a separate
    external JAR file) you do it like this ...
    InputStream is =
    ClassLoader.getSystemResourceAsStream("filename");Better to use
    this.getClass().getClassLoader().getResourceAsStream();
    From a class near to where the data is. This deals with multiple classloaders properly.

  • How to load class from jar file dynamically?

    After I run my Java applicatoin, I need configuring the classpath of jvm to load some classess inside a jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know where the jar file is, what the jar file name is. All depends on the user to tell the jvm the details through some UI. I've tried to write: System.setProperty("java.class.path", "c:\myClass.jar");Class.forName("MyClass"); but failed.
    Can you tell my why and how?
    Thx

    After I run my Java applicatoin, I need configuring
    the classpath of jvm to load some classess inside a
    jar file into the same jvm.How can I achive that?
    I mean, when I run my Java application, I don't know
    where the jar file is, what the jar file name is. All
    depends on the user to tell the jvm the details
    through some UI. I've tried to write:
    System.setProperty("java.class.path",
    "c:\myClass.jar");Class.forName("MyClass"); but
    failed.That won't work. By the time it gets to your code it already has a copy of the original. You can't change it (short of modifying the JVM.)
    Can you tell my why and how?The usual way is to use a custom classloader.
    You can start by looking at java.net.URLClassLoader.

  • How to package third party jars into an ejb application?

    Hello everyone, thanks for reading...
    Does anybody can give me any hints or directions on how to include inside my .ear or .jar all the dependencies of all my EJBs?
    I need to deploy inside my ejb.jar or application.ear all the dependencies. The thing it's that I have a services-ejb.jar and it depends on several jars: services-api.jar, services-util.jar, ws-client.jar, etc.
    I read somewhere that these jars should be inside the META-INF/lib directory inside the ejb-jar. Is this correct?
    I deploy to Oracle Application Server and I'm using EJB 3.0.
    Thanks in advice.

    IDE and Maven have nothing to do with it.
    You need to look at your Oracle AS docs and put the 3rd party JARs in the directory where it expects to find them. I don't know where that is. Most Java EE app servers are different. WebLogic uses an APP-INF directory at the top level of the EAR file. I don't believe it's a Java EE standard. There's more variability in EAR arrangements than there is for WAR files. Those are standard.
    %

  • Loading images inside applet JAR

    Hi
    This is my issue: I have an applet which contains images inside the applet JAR. I want to display these images in my applet, but apparently due to browser access restrictions, I'm not allowed.
    My first code was like this:
    //security restrictions on browsers do not allow getResource
    ImageIO.read(MyClass.class.getResource("imgs/img.png"));
    //getResourceAsStream should be allowed by browsers
    ImageIO.read(MyClass.class.getResourceAsStream("imgs/img.png"));Both lines work when I execute the applet locally (command line / programming IDE), but when I deploy it to my web server, the resource "imgs/img.png" becomes a relative URL to my web application context (like /webcontext/MyClass/imgs/img.png). It works locally because the call to getResource returns a URL object with "file:" protocol, but I need it to look for my images bundled inside the JAR, not web hosted images.
    I need to avoid making the applet look for these images as a web resource... how can I do it?
    Thanks!

    dev@java wrote:
    warnerja wrote:
    I'm not convinced the code you posted wouldn't work, but since this is an applet, you have access to the Applet class. Check out the Applet.getImage method in conjunction with Applet.getCodeBase.
    [http://java.sun.com/javase/6/docs/api/java/applet/Applet.html]
    getCodeBase returns my web context, like http://myhost.com/mycontext/ , so it is pretty much the same as above.
    Thanks for your replyThat is the way to load resources though. Hence back to my earlier statement about not being convinced it would not work, with this addition: It should work, assuming you actually do have the resources properly located with the web app, whether they be in a jar, or loose files relative to where the web app is. My guess at this point is that they are not.

  • Extracting and updating files inside a JAR file... from my code

    Hi.
    I need some help in the following:
    from my code, I need to search a JAR file, open it, unzipped it, then I need to search a xml and property files inside the JAR, after that I need to modify the files and finally, my code has to save the changes and update the JAR file. All that must be from my java code.
    How can I do that? I am trying to use Runtime.getRunTime().exec().... but I am not sure that it works. Besides, I don�t know what command to include in the exec() method. Is there any way to do that?
    Thanks

    The normal reason I see for this requirement is that people want to update a properties or data file. The approach I use it that I first look for the data file in a well defined location and if I find it I use it and update it as required. If I don't fine it I create it base on a template file read from the jar file using getResourceAsSrream().
    In this way I never have to update the jar file.

  • How to use a packaged Jar File?

    Greetings to everyone reading this post!
    I have a query about a thing that seems to be basic but I don't know how to accomplish, here it goes:
    I have packaged a Simple application into a Jar file. this application contains a package like this:
    lib.demo, inside this package I have a Class named MyClass with some simple methods like this one:
    public void sayHi(String name){
    //implementation here
    }Now, I would like to Know how to use the Method sayHI(String name) from an entirely different Project. I have successfully included the Jar File as a Library(in the new Project), but I have I no Clue on How to invoke a Class inside my Jar library, and more Importantly, a method.
    Could anybody help me?

    if the "project" (not a Java-related system, it's IDE-specific) already includes the JAR file in its classpath (library), then all you need is to import the package/class and invoke the method, as such:
    // in your client code:
    import lib.demo.*;         // or, import lib.demo.MyClass;
    public class Test {
      public void inAMethod() {
        MyClass myC = new MyClass();
        myC.sayHi("say hi"); 
    }simple.

  • Running a batch file inside a jar

    HI all
    I created a jar file , in which i need to run a batch file , so i wrote a main class to execute the run the batch file , but when iam running the jar it is searching for the given batch file out side the jar.
    my code is some thing like below
         public static void main(String args[])
              try
                   Runtime rt=Runtime.getRuntime();
                   Process process=rt.exec("%DIRNAME%/start.bat");
       InputStreamReader reader =
                      new InputStreamReader ( process.getInputStream () );
                   BufferedReader buf_reader =
                       new BufferedReader (  reader );
                    String line;
                    while ((line = buf_reader.readLine ()) != null)
                                 System.out.println (line);
              catch (IOException e) {
                    System.out.println (e);
         }so please help me.. is it the problem in specifing the path...?
    are does it have any other method to read the stream functions ..
    thanks in advance
    sam

    I don't think this will work. You could not go to a command line and enter, "%DIRNAME%/start.bat" if start.bat was inside a jar - the CLI doesn't know how to read a batch file inside a jar.
    I think it would work to programmatically read the lines of start.bat (when it is inside the jar) into an array of Strings and use Runtime.exec with the array as the argument.
    It would also work to extract the start.bat file, then execute it using Runtime.exec.

Maybe you are looking for

  • Downloading videos from a disk.

    Okay so I tried downloading this video that I made on another MacBook on to my Macbook, so I put it in then the DVD player comes up and goes to full screen and I can't get out of it without ejecting the disk. So, how do I go about downloading the vid

  • Error in XSLT Code

    Hi All, I am working for a scenario with XSLT Mapping(For converting xml to html). I get data into a field D_TXT with S_TXT as parent node. The data in D_TXT is space delimited. I need to split the data in D_TXT for every space in data and print the

  • MP3 files not showing up in published folder

    Hi everyone, A newbie question here: I have completed my site and published it to a folder, for later uploading to a webhost. I took a peek in my published folder and could not find any of the MP3 files that I had put on to my site. While I was creat

  • Importing graphics... blurry or possible to make clickable?

    Admittedly, I am no expert with this software but Ive been using it for over 10 years and I am stumped (probably due to exhaustion and a failing memory). What I am trying to do is so simple, and yet I cant seem to find the right process for the end r

  • How do I make a song my ringtone?

    I purchased a song through iTunes on my phone and I don't know what to do now to make it my ringtone. I also tried to buy it online through Verizon like I always did with my Blackberry but it says you cannot do that with the iphone. Can anyone please