How to set VM parameters at run time in install4j - runtime

How can we set VM parameters at runtime based on condition or in startup action or is there is any way to set VM parameters at runtime??

There is an "Add VM options" action in install4j for that purpose.
It adds VM parameters to the .vmoptions file of the selected launcher.

Related

Remote debuging with gdbserver for application with X (qt) environment

I have been trying to remotely debug an application which can only be run on a specific server because of hardware limitations. To normally run the program I would login to an ssh shell with X.11 forwarding enabled (-X option of ssh) and its QT interface will show up.
I have been trying to achieve the same but with no success while debugging via gdb with the gdbserver and the integrated gdb client of Eclipse IDE.
Is there a way to achieve this?
I have already tried to copy the settings of the system variables DISPLAY and XDG_RUNTIME_DIR of an ssh -X session (the later being empty) but with no success. Searching for it gives no relatable results (or I may need a hint on what to search).
It's not the cleanest solution, but you can manually set the DISPLAY variable in /etc/environment. Variables set in /etc/environment are available to the entire system. You'll need to reboot the server before gdb will see it.
See: https://help.ubuntu.com/community/EnvironmentVariables#A.2Fetc.2Fenvironment
Here's a one-liner to append your current DISPLAY variable
echo "DISPLAY=$DISPLAY" >> /etc/environment

How to update Windows environment variables after Ansible's win_environment module?

I am using Ansible to configure our Windows Servers 2012.
I am using Ansible's Windows modules: win_xxx. All modules are working fine except for
win_environment
win_path
I think the win_path depends win_environment module in my case.
I am installing
JDK
Apache Ant
Apache Tomcat8.
Installation works fine and setting up the environment variables for
JAVA_HOME
ANT_HOME
is not working as expected. The server is not updated with the new environment variables. I need to sign out and sign in back to the server in order the new variables are updated. Is there any way to update the system in Ansible or in Windows Batch/Powershell without signing in and out?
just to remind that "User level environment" variables will be set, but not available until the user has logged off and on again.
check then either you have selected "user" as level on you win_environment module.

javaws does not pass -J VM arguments when using remote jnlp file

when I launch my application with local JNLP file
javaws -J-Xmx64m myApplication.jnlp
the application will run with -Xmx64m.
When I launch my application with remote jnlp file
javaws -J-Xmx64m "http://myserver/myApplication.jnlp"
then the jp2launcher seems to download the JNLP file and spawn new jp2launcher that runs my application. However the -J parameters are not passed to the new spawned jp2launcher.
I can verify this with JVisualVM.
Is this expected behavior? How can I pass -Xmx and other options to my application without specifying them inside the JNLP file (e.g. max-heap-size)?
I am using Java 8 on Windows 7+.
Thank you, Jan

How to set ANT_HOME with Windows?

How can I easily set ANT_HOME under Windows? I added "D:\Installz\apache-ant-1.8.2\bin;" to my system environment variable PATH and I also created an ANT_HOME variable.
In Windows 7 you can go to Control Panel\All Control Panel Items\System or right click on Computer and then to “Advance system setting”
Choose Advanced Tab
Click "Environment Variables" button
In System Variables, click "New" button
Set Variable Name: ANT_HOME and value as {directoryPath}\apache-ant-1.8.2 (Ex: D:\Installz\apache-ant-1.8.2)
Click OK
Either click again on New button if you do not have ‘Path’ Variable in there
OR
Select it and edit by adding the value : %ANT_HOME%\bin;
Click OK
To check if ANT is properly configured - In command prompt, type ant -version
It should give the ant version installed on your machine
I expect you to be running on Windows (since you are using %).
Simply add a new environment variable (Right-click on My Computer > Properties > Advanced > environment Variable) or using SET ANT_HOME=<path> using command line (in that cas, it will only be active on that command line).
Once set you should be able to verify its value by doing echo %ANT_HOME% in command line
The % sign around the variable indicates it is an environment variable.
For linux use the export ANT_HOME=<path> in command line or in your ~/.profile (persistent, require logout/login). Use echo $ANT_HOME for verification.
I had a similar problem of installing JAVA JDK & ANT.
I tried installing JDK this way.
Oracle site --> download JDK setup --> double click on the set up file (on your desktop) --> accept all defaults --> finish.
we need to set environment variable in the deployment system.
mycomputer (right click) --> properties --> advanced settings --> Environment variable --> system variable --> add new --> variable name: JAVA_HOME, Variable path: installation path of jdk on you computer --> click ok, ok.
To check the successful installation of Java .
windows + R --> cmd --> Java -Version
you would see the response as below
C:\Users\PRAX>java -version
java version "1.6.0_38"
Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
This shows that you have successfully installed JDK & set an environment variable too.
ANT installation:
download ant file from http://ant.apache.org/bindownload.cgi
choose a mirror & download the zip (zip is the easiest method to set)
unzip the file on your computer --> copy the path (traverse till bin folder).
Now, we need to set an environment variable,
Cmd --> set ANT_HOME = installation path --> press Enter
if you have correctly entered, it wont throw any error.
now execute, echo %ANT_HOME%
you would see the result as your installation path.
your work is done.
you can check the environment variable even in computer properties by default after executing the above set up.
Hope, its useful.
ANT_HOME is the path to your ant installation dir, in your case "D:\Installz\apache-ant-1.8.2"
and JAVA_HOME is java install dir e.g. "C:\Program Files\Java\jdk1.7.0", that's on my machine
On Windows, %% (percent) symbols are used to signify variables.
so to set both variables you can do either
in command prompt, only valid for the session of the particular command propmt
SET ANT_HOME=D:\Installz\apache-ant-1.8.2
SET JAVA_HOME="C:\Program Files\Java\jdk1.7.0"
or
go to System Properties -> Advanced -> Environment Variables and set to new variables
A more flexible solution is to do all that 'environment stuff' in a batch file that starts your ant script, works also when there are no rights to change the environment variables.See a similar question that came up recently for details.

System environment variable created during install not available to current user until reboot

I have a msi package generated by wix that creates a system environment variable by populating the Environment table.
<Environment Id="CreateEnvVar" Name="DATADIR" Action="set"
System="yes" Part="all" Value="[DATA_DIR]" />
The install successfully creates the environment variable at the system level. This was verified by viewing the Environment Variables dialog from System Properties
However the currently logged in user does not have access to the newly created environment variables until the machine is rebooted ( I'm assuming that logging out then back in would also work. Just have not tried it yet). Executing an application that was just installed fails because it does not have access to the DATADIR variable.
Also, opening up a command prompt after the installation is complete the DATADIR variable does not appear when executing the set command.
I understand that a process started before executing the MSI would not get the new variables. However, why wouldn't a process started after the environment variables are added get the new ones?
FYI, I am installing on Windows Server 2003 and I am logged in through remote desktop with a user in the Administrators group.
Are you installing via Remote Desktop? If so, ensure you are using the admin console session.
To do so, launch Remote Desktop using:
mstsc /admin
Or if you are using the latest version of RDP, it is now:
mstsc /console
Try installing it from this session (or locally) and let me know the result.

Resources