How to read a .war file?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












12















I am trying to view the content of a .war file. I first did set its permissions with chmod 777 then when I try to accces it using:



cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/


It is giving cd: /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/: Not a directory and I am not able to proceed further.



Can someone help me in this issue?










share|improve this question



















  • 5





    Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

    – Braiam
    Jul 23 '13 at 11:31











  • See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

    – slm
    Jul 23 '13 at 13:31











  • Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

    – jlliagre
    Jul 23 '13 at 14:16















12















I am trying to view the content of a .war file. I first did set its permissions with chmod 777 then when I try to accces it using:



cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/


It is giving cd: /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/: Not a directory and I am not able to proceed further.



Can someone help me in this issue?










share|improve this question



















  • 5





    Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

    – Braiam
    Jul 23 '13 at 11:31











  • See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

    – slm
    Jul 23 '13 at 13:31











  • Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

    – jlliagre
    Jul 23 '13 at 14:16













12












12








12


4






I am trying to view the content of a .war file. I first did set its permissions with chmod 777 then when I try to accces it using:



cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/


It is giving cd: /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/: Not a directory and I am not able to proceed further.



Can someone help me in this issue?










share|improve this question
















I am trying to view the content of a .war file. I first did set its permissions with chmod 777 then when I try to accces it using:



cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/


It is giving cd: /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/: Not a directory and I am not able to proceed further.



Can someone help me in this issue?







files compression






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 23 '13 at 11:41









Braiam

23.7k2077142




23.7k2077142










asked Jul 23 '13 at 11:22









user1660325user1660325

171115




171115







  • 5





    Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

    – Braiam
    Jul 23 '13 at 11:31











  • See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

    – slm
    Jul 23 '13 at 13:31











  • Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

    – jlliagre
    Jul 23 '13 at 14:16












  • 5





    Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

    – Braiam
    Jul 23 '13 at 11:31











  • See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

    – slm
    Jul 23 '13 at 13:31











  • Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

    – jlliagre
    Jul 23 '13 at 14:16







5




5





Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

– Braiam
Jul 23 '13 at 11:31





Don't use chmod 777 on a compressed file. You don't need execution bit for reading it. A safe 644 or 640 is recommended.

– Braiam
Jul 23 '13 at 11:31













See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

– slm
Jul 23 '13 at 13:31





See the official Java docs: docs.oracle.com/javase/tutorial/deployment/jar/view.html

– slm
Jul 23 '13 at 13:31













Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

– jlliagre
Jul 23 '13 at 14:16





Is /usr/local/standalone/deployments/Sample.war a directory or a file ?

– jlliagre
Jul 23 '13 at 14:16










6 Answers
6






active

oldest

votes


















14














.war files are packed. You can extract the information by using either of the following commands:



jar -xvf Sample.war
unzip Sample.war


You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/






share|improve this answer




















  • 3





    jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

    – jlliagre
    Jul 23 '13 at 14:14











  • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

    – JZeolla
    Jul 23 '13 at 14:48







  • 1





    I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

    – Dror Cohen
    Mar 31 '15 at 9:52


















6














.war files are zipped archives.



You can list what they contain with either



jar tvf Sample.war


or



zipinfo Sample.war


Should you want to see the content of files stored in an archive, you need to first extract it somewhere:



mkdir /tmp/foo
cd /tmp/foo
unzip /usr/local/standalone/deployments/Sample.war
ls -l WEB-INF/classes/





share|improve this answer
































    2














    If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.






    share|improve this answer























    • For this to work, you need the package unzip installed.

      – Thaoden
      Jun 2 '17 at 8:52


















    1














    First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.






    share|improve this answer






























      0














      Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.



      If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either
      cd Sample.war#uzip
      (old mc) or
      cd Sample.war/uzip://
      (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.



      This is known as the mc VFS (virtual filesystem).



      I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.






      share|improve this answer






























        0














        If the unix commands does not work, ftp the file to local machine.



        .jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -



        1. Right click the archive file

        2. 7-Zip

        3. Open archive

        You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.






        share|improve this answer






















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f84093%2fhow-to-read-a-war-file%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          14














          .war files are packed. You can extract the information by using either of the following commands:



          jar -xvf Sample.war
          unzip Sample.war


          You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/






          share|improve this answer




















          • 3





            jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

            – jlliagre
            Jul 23 '13 at 14:14











          • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

            – JZeolla
            Jul 23 '13 at 14:48







          • 1





            I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

            – Dror Cohen
            Mar 31 '15 at 9:52















          14














          .war files are packed. You can extract the information by using either of the following commands:



          jar -xvf Sample.war
          unzip Sample.war


          You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/






          share|improve this answer




















          • 3





            jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

            – jlliagre
            Jul 23 '13 at 14:14











          • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

            – JZeolla
            Jul 23 '13 at 14:48







          • 1





            I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

            – Dror Cohen
            Mar 31 '15 at 9:52













          14












          14








          14







          .war files are packed. You can extract the information by using either of the following commands:



          jar -xvf Sample.war
          unzip Sample.war


          You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/






          share|improve this answer















          .war files are packed. You can extract the information by using either of the following commands:



          jar -xvf Sample.war
          unzip Sample.war


          You should then be able to run cd /usr/local/standalone/deployments/Sample.war/WEB-INF/classes/







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 23 '13 at 14:46

























          answered Jul 23 '13 at 12:08









          JZeollaJZeolla

          615412




          615412







          • 3





            jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

            – jlliagre
            Jul 23 '13 at 14:14











          • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

            – JZeolla
            Jul 23 '13 at 14:48







          • 1





            I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

            – Dror Cohen
            Mar 31 '15 at 9:52












          • 3





            jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

            – jlliagre
            Jul 23 '13 at 14:14











          • This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

            – JZeolla
            Jul 23 '13 at 14:48







          • 1





            I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

            – Dror Cohen
            Mar 31 '15 at 9:52







          3




          3





          jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

          – jlliagre
          Jul 23 '13 at 14:14





          jar -xvf *war won't work if there is more than one war file in the current directory. tar -xvfz won't work at all, you are confusing gzipped files and zipped ones.

          – jlliagre
          Jul 23 '13 at 14:14













          This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

          – JZeolla
          Jul 23 '13 at 14:48






          This is true, I didn't mean to infer that it would work with multiple wars, just that you could use that command verbatim for any one war. I've changed it

          – JZeolla
          Jul 23 '13 at 14:48





          1




          1





          I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

          – Dror Cohen
          Mar 31 '15 at 9:52





          I think it's better to use jar -tvf and not the proposed jar -xvf way. So files aren't extracted (and contaminate your .) but just listed.

          – Dror Cohen
          Mar 31 '15 at 9:52













          6














          .war files are zipped archives.



          You can list what they contain with either



          jar tvf Sample.war


          or



          zipinfo Sample.war


          Should you want to see the content of files stored in an archive, you need to first extract it somewhere:



          mkdir /tmp/foo
          cd /tmp/foo
          unzip /usr/local/standalone/deployments/Sample.war
          ls -l WEB-INF/classes/





          share|improve this answer





























            6














            .war files are zipped archives.



            You can list what they contain with either



            jar tvf Sample.war


            or



            zipinfo Sample.war


            Should you want to see the content of files stored in an archive, you need to first extract it somewhere:



            mkdir /tmp/foo
            cd /tmp/foo
            unzip /usr/local/standalone/deployments/Sample.war
            ls -l WEB-INF/classes/





            share|improve this answer



























              6












              6








              6







              .war files are zipped archives.



              You can list what they contain with either



              jar tvf Sample.war


              or



              zipinfo Sample.war


              Should you want to see the content of files stored in an archive, you need to first extract it somewhere:



              mkdir /tmp/foo
              cd /tmp/foo
              unzip /usr/local/standalone/deployments/Sample.war
              ls -l WEB-INF/classes/





              share|improve this answer















              .war files are zipped archives.



              You can list what they contain with either



              jar tvf Sample.war


              or



              zipinfo Sample.war


              Should you want to see the content of files stored in an archive, you need to first extract it somewhere:



              mkdir /tmp/foo
              cd /tmp/foo
              unzip /usr/local/standalone/deployments/Sample.war
              ls -l WEB-INF/classes/






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jul 23 '13 at 14:16

























              answered Jul 23 '13 at 14:06









              jlliagrejlliagre

              47.7k785137




              47.7k785137





















                  2














                  If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.






                  share|improve this answer























                  • For this to work, you need the package unzip installed.

                    – Thaoden
                    Jun 2 '17 at 8:52















                  2














                  If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.






                  share|improve this answer























                  • For this to work, you need the package unzip installed.

                    – Thaoden
                    Jun 2 '17 at 8:52













                  2












                  2








                  2







                  If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.






                  share|improve this answer













                  If you don't want to extract the file you can use vim filename.war to read the contents of the file. You can read subdirectories of files by selecting them and pressing enter.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 6 '15 at 13:54









                  Martin AgfjordMartin Agfjord

                  211




                  211












                  • For this to work, you need the package unzip installed.

                    – Thaoden
                    Jun 2 '17 at 8:52

















                  • For this to work, you need the package unzip installed.

                    – Thaoden
                    Jun 2 '17 at 8:52
















                  For this to work, you need the package unzip installed.

                  – Thaoden
                  Jun 2 '17 at 8:52





                  For this to work, you need the package unzip installed.

                  – Thaoden
                  Jun 2 '17 at 8:52











                  1














                  First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.






                  share|improve this answer



























                    1














                    First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.






                    share|improve this answer

























                      1












                      1








                      1







                      First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.






                      share|improve this answer













                      First you have to extract the war file jar xvf Sample.war. Then you can cd in to the war file.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 23 '13 at 11:24









                      Manula WaidyanathaManula Waidyanatha

                      1,7031011




                      1,7031011





















                          0














                          Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.



                          If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either
                          cd Sample.war#uzip
                          (old mc) or
                          cd Sample.war/uzip://
                          (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.



                          This is known as the mc VFS (virtual filesystem).



                          I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.






                          share|improve this answer



























                            0














                            Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.



                            If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either
                            cd Sample.war#uzip
                            (old mc) or
                            cd Sample.war/uzip://
                            (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.



                            This is known as the mc VFS (virtual filesystem).



                            I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.






                            share|improve this answer

























                              0












                              0








                              0







                              Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.



                              If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either
                              cd Sample.war#uzip
                              (old mc) or
                              cd Sample.war/uzip://
                              (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.



                              This is known as the mc VFS (virtual filesystem).



                              I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.






                              share|improve this answer













                              Besides extracting them with jar or unzip, you can also use the Midnight Commander (mc) and navigate to these files and press Enter on them as if they were directories.



                              If this doesn't immediately work, your flavour of mc is not configured to know the .war suffix, but you can still use this feature by typing either
                              cd Sample.war#uzip
                              (old mc) or
                              cd Sample.war/uzip://
                              (mc in Debian unstable) and pressing Enter. As an added benefit, pressing Escape then Enter (in some terminals, also Alt-Enter but this is not portable so don’t depend on it) inserts the current filename into the command line, but you’ll have to press Backspace too because it adds a space, and the #uzip or /uzip:// needs to immediately follow the filename.



                              This is known as the mc VFS (virtual filesystem).



                              I won’t repeat the unzip/fastjar/jar answers here, but they’re also correct.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jul 24 '13 at 16:00









                              mirabilosmirabilos

                              1,228927




                              1,228927





















                                  0














                                  If the unix commands does not work, ftp the file to local machine.



                                  .jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -



                                  1. Right click the archive file

                                  2. 7-Zip

                                  3. Open archive

                                  You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.






                                  share|improve this answer



























                                    0














                                    If the unix commands does not work, ftp the file to local machine.



                                    .jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -



                                    1. Right click the archive file

                                    2. 7-Zip

                                    3. Open archive

                                    You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      If the unix commands does not work, ftp the file to local machine.



                                      .jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -



                                      1. Right click the archive file

                                      2. 7-Zip

                                      3. Open archive

                                      You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.






                                      share|improve this answer













                                      If the unix commands does not work, ftp the file to local machine.



                                      .jar or .war or .ear any archive file can be opened in 7-Zip by following the steps below -



                                      1. Right click the archive file

                                      2. 7-Zip

                                      3. Open archive

                                      You should be able to see all the archive file contents. Now browse through the folder/file and then right click -> edit the file -> save the file.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Feb 21 at 15:45









                                      Arunchunai vendan PugalenthiArunchunai vendan Pugalenthi

                                      1




                                      1



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f84093%2fhow-to-read-a-war-file%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown






                                          Popular posts from this blog

                                          Peggy Mitchell

                                          Palaiologos

                                          The Forum (Inglewood, California)