Solved

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

Posted on 2013-11-26
3
1,300 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
github account with ecipse 1 42
Java Loop 6 49
custom annotations 9 32
MySqlDump not dumping triggers 1 17
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now