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
Solved

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

Posted on 2013-11-26
3
1,318 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
  • 2
3 Comments
 
LVL 34

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 23

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 34

Accepted Solution

by:
Dan Craciun earned 500 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Clear Filter 8 59
Button function on table is in trouble 3 20
How do I extract data from Excel worksheets? 5 39
American Express @Work site and Java 4 23
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

856 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