03/08/2005 6929 views
Does anyone know if you can edit the deployment.properties file using javaw.exe

if you run the the control panel applet it gives out the commandline below in procexp I have tried adding values etc based on guesses but it doesn't modify the deployment.properites file

"C:\Program Files\Java\JRE\1.4.2\bin\javaw.exe" -classpath "C:\Program Files\Java\JRE\1.4.2"\lib\plugin.jar -Djavaplugin.version=1.4.2_07 -Djavaplugin.nodotversion=142_07 -Duser.home="c:\Documents and Settings\<username>" sun.plugin.panel.ControlPanel

am I barking up the wrong tree. I need to set three values without a straight overwrite/copy of the file
and without the user going into the control panel - I am trying to avoid parsing the file and re-writing in a custom action also - has anyone done this successfully?

0 Comments   [ + ] Show comments


Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

All Answers

To edit the deployment.properties file I have used VBScript in a custom action in the MSI or used ActiveSetup to modify the file.
Answered 03/09/2005 by: brenthunter2005
Fifth Degree Brown Belt

didn't want to go down the vbscript route if could help it but it seems that its is my only option other than writing a custom exe to parse the file and my code is not good enough to for that any chance you would be willing to post the vbscript code?

Thanks in advance
Answered 03/09/2005 by: Lozza
Senior Yellow Belt

OK, in the following example the corporation upgraded to a newer version of J2RE and needed to update the hardcoded proxy server entry in the 'deployment.properties' file. A stub path was written to the ActiveSetup registry keys so that upon user logon, the vbscript would run and silently modify the users local 'deployment.properties' file.
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

strPath = objShell.ExpandEnvironmentStrings("%APPDATA%") & "\Sun\Java\Deployment\deployment.properties" 'Complete Path & File Name

strFldr = objShell.ExpandEnvironmentStrings("%TEMP%") & "\temp_deployment.properties" 'Complete Path & File Name of Temporary File

Set file1 = objFSO.OpenTextFile(strPath)
Set file2 = objFSO.CreateTextFile(strFldr)

Do While Not file1.AtEndofStream
strLine = file1.ReadLine
If InStr(strLine,"javaplugin.proxy.settings") Then 'When this text is found, it is overwritten with the line below.
file2.WriteLine "javaplugin.proxy.settings=http\=proxyserver"
file2.WriteLine strLine 'This just copies whatever was read in file1
End If

Set file1 = nothing
Set file2 = nothing

objFSO.DeleteFile strPath, True 'This deletes the original file

objFSO.MoveFile strFldr, strPath 'This moves and renames the temp file, replacing the original

[8D] Remember that there are many many different ways to do this. In this example, the file already existed and all the script needed to do was to update the file with the new proxy server address.

In your environment, you need to discover if the file already exists or not and make the neccessary adjustments to the script etc.
Answered 03/09/2005 by: brenthunter2005
Fifth Degree Brown Belt

I know its been a while but just wanted to say cheers - After a lot of modification and your script suggestion it worked great thanks
Answered 06/08/2005 by: Lozza
Senior Yellow Belt

Glad to hear that you got it working. [:)]
Answered 06/08/2005 by: brenthunter2005
Fifth Degree Brown Belt