?
Solved

need a script to change one line within a java settings file

Posted on 2013-11-26
3
Medium Priority
?
1,392 Views
Last Modified: 2013-11-28
we need to Change the Setting
deployment.security.level   to MEDIUM like displayed at the code at the bottom
within
%userprofile%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

this line can have some different Settings or completely missing
other lines should not be altered
the user should call the script while logging in or before starting the app.

#deployment.properties
#Tue Nov 26 11:29:51 CET 2013
deployment.expiration.decision.timestamp.10.40.2=1385050638
deployment.security.level=MEDIUM
Sun\\Java\\Deployment\\cache\\6.0\\splash\\splash.xml
deployment.version=7.21

I am unable do write scripts ... can someone help me please?
0
Comment
Question by:Dirk Kotte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39677454
Try this, in powershell:

# name and path of the file
$file = %userprofile%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

# delete the line containing deployment.security.level, if it exists
(Get-Content $file) | Foreach-Object {$_ -replace "^deployment\.security\.level=.*?$", ""} |
Set-Content $file

# add the required line
echo "deployment.security.level=MEDIUM" >> $file


HTH,
Dan
0
 
LVL 24

Author Comment

by:Dirk Kotte
ID: 39677498
great, nearly perfect :-)
$file = %userprofile%\AppData\Loc...    has to be
$file = "$env:userprofile\AppData\Local...

but results in leading spaces and a space between every character...:
...
deployment.javaws.jre.0.args=
   d e p l o y m e n t . s e c u r i t y . l e v e l = M E D I U M
0
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 2000 total points
ID: 39677533
It should of been
echo "`ndeployment.security.level=MEDIUM" >> $file

to force a new line.

Yes, you're right, it's $env:userprofile . I wrote the script for a text file and then copied your path :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

765 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