Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

some kind of urgent war file replacing a file.

Posted on 2014-07-11
6
Medium Priority
?
326 Views
Last Modified: 2014-07-11
Hi;

I have a war file and i can see the contents as follows:

C:\Program Files\Java\jdk1.6.0_45\bin>jar -tvf "C:\mywar.war"

and i want to replace an existing file in this war without a hassle:

C:\Program Files\Java\jdk1.6.0_45\bin>jar -uf C:\mywar.war WEB-INF/test.txt

Above command fails even there is a WEB-INF folder, and i need that file to be in WEB-INF.

C:\Program Files\Java\jdk1.6.0_45\bin>jar -uf C:\mywar.war test.txt
This works but it's putting on top level. It should be one level down in WEB-INF.

What to do?

Regards.
0
Comment
Question by:jazzIIIlove
  • 2
  • 2
5 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 2000 total points
ID: 40190627
You can manipulate the content of a jar file with WinRar
0
 
LVL 37

Expert Comment

by:zzynx
ID: 40190703
Thanx 4 axxepting
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40190705
C:\Program Files\Java\jdk1.6.0_45\bin>jar -uf C:\mywar.war WEB-INF/test.txt

Open in new window


Firstly, your jdk is way out of date. If the wrong kind of code gets to use its JRE, you could be in serious trouble from a security point of view
Secondly, don't work from the bin directory - that should be in PATH
Thirdly you shouldn't really be working in a system root either

Above command fails even there is a WEB-INF folder, and i need that file to be in WEB-INF.
It should be
jar -uf C:\mywar.war WEB-INF\test.txt

Open in new window

0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 40191347
Cehj comment is also valid. Wanna reopen Cehj?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40191520
Don't worry about it
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question