Is it possible to set an environment variable for the current run of Eclipse ( RAD )?
Here is my situation
I have RAD 8.5 and RAD 9.0 installed on my box. It stopped working all of a sudden last week. It wouldn't even come up. When I checked the logs, both the versions had below error in the logs
java.lang.NoClassDefFoundError: com.mercury.ftjadin.hooks.interfaces.WToolkitHookQTJA
After some research I also found out that it is caused by HP's product that was installed on my box ( It was done as a corporate push and I wasn't even aware of it ).
Further research also revealed that there are about 4 environment variables that have a conflict with Eclipse and should be removed / blanked out for RAD to work. This will of course cause the HP product to not work.
So, I was wondering if there is a way to set these to blank in eclipse.ini file for each of the RADs or as part of the shorcut of RAD which is
C:\Software\RAD90\eclipse.exe -product com.ibm.rational.rad.product.v9.ide -showlocation -nosplash -clean
but not blank them out in the Environment Variables definition
This way, I will be able to use both the products without having to save the variable values between RAD and HP Mercury product usages and do not have to do a copy / paste every time which is prone to user errors / mistakes.
Hope the question makes sense. Please let me know, if I need to clarify anything.
You can start eclipse (for example RAD) from eclipse (for example a minimal Java plugin development) and in that case, you have the option to set the environment variables you want to use.
You have to set the target environment to the RAD instance and create a run configuration with the proper environment.
I know, this is less than ideal, but should work.
Another option would be the unsetting env variables (locally) in a batch file:
set var=
Though I do not know whether it would work or not.
This page helped my situation
Instead of playing with registry I took an option of batch
These suggestions will allow to work around this situation even with the environment variables in place and with corresponding values. Note: Conflicting application will not be recognized in a java context because it is being excluded from the java support mechanism.
Impact: Excludes Add-ins support from hooking to conflicting application executable via Windows Registry Editor
Requirement: The application must be started by an EXE file, except Java.exe/Javaw.exe/jpnlauncher.exe
Instructions:
a. Locate the executable filename of the application conflicting with add-in(s) support. Either use the Task Manager or the Microsoft Process Explorer.
b. Open Windows Registry Editor.
c. Navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\JavaAgent\Modules
For 32bits applications on Windows x64:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercury Interactive\JavaAgent\Modules
d. Create a DWORD value with the name of the conflicting software executable filenmae and set the value to 0.
Impact: Does not load Java Support for specific launched session
Requirement: Application be launched using a batch file
Instructions:
a. Create a batch file (.bat)
b. Copy/Paste below coding before executing launching of Java application.
#ECHO off
Set _JAVA_OPTIONS=
Set JAVA_TOOL_OPTIONS=
Set IBM_JAVA_OPTIONS=
This approach will disable the java environment variables for the run session of the .bat file. Once batch execution closes, environment variables changes are lost.
Related
I'm trying to install Netbeans 8.2 Java EE, but whenever I start the installer it quits after configuring it. I am trying to install it on Windows 10 64-bit.
This is not going to make sense at all, but do you happen to have the "God Mode" item on your desktop? Take it off the desktop (delete it, move it somewhere else, whatever). I have no idea why, but it worked for me: I found the solution in this bug report - https://netbeans.org/bugzilla/show_bug.cgi?id=269988
I do hope this helps you, too.
This is an Java issue, which was came up due to recent windows 10 update, that started treated differently for GodMode folder/shortcut.
This has been already fixed - https://bugs.openjdk.java.net/browse/JDK-8179014
You can verify the fix in early access build of JDK8 update 152, which is available here
We have verified the issue only with GodMode, do let us k now if there are any other scenarios that can cause such similar issues.
I'm adding this because: I had a different issue which I was unable to find addressed anywhere, this question appears near the top of a web search for "NetBeans 8.2 ee won't install on Windows 10", and someone else may have the problem I had.
My NetBeans install was almost immediately crashing with the following error:
An unexpected exception happened in thread main
Exception: javax.xml.parsers.FactoryConfigurationError: Provider for
class javax.xml.parsers.DocumentBuilderFactory cannot be created
In my Windows 10 System Properties -> Environment Variables -> System Variables, I had a previously created _JAVA_OPTIONS variable values using -Xbootclasspath/a to append some jar files to the end of the bootstrap class path. These files are used with some work I'm doing with the Oracle BI Publisher plug-in for Microsoft Word.
As soon as I renamed the _JAVA_OPTIONS variable to something else, my NetBeans installation started normally and completed with no issues.
After NetBeans installation, I reset the name of this variable back to _JAVA_OPTIONS, and discovered that the values I have for this System Variable cause NetBeans launch to crash. (Which does not completely make sense to me since I am only appending these files/classes to the class path, and not overwriting.)
Regardless, I'll have to go back to the drawing board for my work with the BI Publisher plug-in; but at least I can use NetBeans now!
Uninstall any Java installations along with NetBeans, and install Java with NetBeans (bundle) from the Oracle website.
I had the same issue, and then installed the bundle, works perfectly.
I have recently started developing an Eclipse plugin (which is basic stuff for now) and I am struggling with "default" way to run Eclipse plugin ("Run as Eclipse application").
The Eclipse is starting another instance with my plugin already installed in it (this is default behaviour).
The problem is that when I want to re-run my plugin project and I press "run" button again (or Ctrl + F11) (and the another Eclipse instance still running) I get following message:
"Could not launch the application because the associated workspace is currently in use by another Eclipse application".
The error makes sense, and when I close "testing" Eclipse instance I am able to run my plugin again.
The question is - "is it normal routine for plugin development?". Maybe I am missing something, e.g. special arguments for Eclipse?
This seems all pretty normal. The error message is since the run configuration is specifing a workspace and when you start a second instance using the same workspace it is locked and considered in use.
What I usually do when testing a plugin is to create a run configuration (click "Run...") where I disable all the plugins I wont need when testing. This makes sure that the test starts up a couple of seconds quicker. Make sure you save that run configuration as a *.launch file aswell, that makes it quicker to test the next time. Or it can be used to share the configuration.
There's a lot you can configure in the run configuration, such as eclipse arguments, vm argument, if you want environment variables set, etc. So be sure to experiment a little.
In your run configuration. Main tab->Workspace Data ->Location text box add this:
${workspace_loc}/../runtime-EclipseApplication${current_date:yyyyMMdd_HHmmss}
Note the suffix ${current_date:yyyyMMdd_HHmmss} by this every time you launch your application new workspace will be created. So you will not get any error message saying workspace is locked.
But be careful as the folder .metadata will be different for different instances as their work-spaces are different. Thus preferences stored/retrieved by different instances are NOT in sync.
You are probably missing one important point: Eclipse supports the Java hot code replacement. Therefore in many cases you can modify your Java code while your application Eclipse instance is running, save the code and continue without restarting.
If hot code replacement is not possible, Eclipse will tell you, so you always know whether the editing changes are applied to the running instance.
This works best with more recent versions of the JVM, so consider upgrading to the latest Java 7 version, even if you write code to be compliant with Java 1.5 or 6.
I have a script which needs to call one of the existing, headless Eclipse applications (example: the p2 director application) which use the Proxy API of org.eclipse.core.net for configuring its requests to HTTP servers.
On Linux, I can configure the Eclipse Proxy API by setting the environment variables http_proxy and https_proxy.
Is there similar solution for configuring the proxies from the command line in Windows?
I've tried to set HTTP proxy configuration properties specified by Java (http.proxyHost, http.proxyPort, etc.) but this doesn't work. Setting the properties just results in a log entry from Eclipse informing me that the system properties are overwritten with the values from the preferences:
!ENTRY org.eclipse.core.net 1 0 2013-08-09 15:21:19.413
!MESSAGE System property http.proxyHost has been set to proxy by an external source. This value will be overwritten using the values from the preferences
!ENTRY org.eclipse.core.net 1 0 2013-08-09 15:21:19.414
!MESSAGE System property http.proxyPort has been set to 8080 by an external source. This value will be overwritten using the values from the preferences
So another option would be a headless application which allows to configure preferences. Does this application exist (preferrably as part of the standard Eclipse distributions)?
Proxy preferences for Eclipse applications are stored in the file
<eclipse-installation>/configuration/.settings/org.eclipse.core.net.prefs
So either you edit the settings via the Eclipse preferences UI (General / Network Connections) and then copy that file to your headless application, or you create/edit that manually:
eclipse.preferences.version=1
nonProxiedHosts=localhost|127.0.0.1
org.eclipse.core.net.hasMigrated=true
proxiesEnabled=true
proxyData/HTTP/hasAuth=false
proxyData/HTTP/host=<proxy.your.org>
proxyData/HTTP/port=<port>
proxyData/HTTPS/hasAuth=false
proxyData/HTTPS/host=<proxy.your.org>
proxyData/HTTPS/port=<port>
# - Set SOCKS proxy only if neccessary -
# proxyData/SOCKS/hasAuth=false
# proxyData/SOCKS/host=<proxy.your.org>
# proxyData/SOCKS/port=<port>
systemProxiesEnabled=false
HTH.
From what I could find out, it seems that setting the proxy from the command line is not possible in Windows – but I really hope that someone else has a better answer.
There was a bug report for the fact that Eclipse ignores the Java proxy configuration (bug 298813). This bug even included a patch, but unfortunately it was abandoned for a "more general solution" (bug 257443). That bug was originally planned for Eclipse 3.5, but up to now was never completed.
So this doesn't look good...
I was facing the same problem, and I tried different solutions mentioned here and in several blogs without having one working to me.
However... one solution I found is that if you have an x32 Eclipse IDE, and an x64 OS, setting will not always save, and you may face these problems.
I had this problem with Juno x32 + Win7 x64, now it's solved using Juno x64, and Kepler x64
So, check your OS/IDE and make sure that you have the right versions.
It may be the same problem as this question
Try to put the same properties (http.proxyHost and http.proxyPort) inside the eclipse.ini file into -vmargs section using -d (-Dhttp.proxyHost=htttp://yourproxy and -Dhttp.proxyPort=port)
We provided an application installed with install4j, with bundled JRE, to one of our customers. This customer needs some proxy settings configured manually for this application.
I tried to put deployment.config file in the JRE's lib directory but it didn't seem to change anything. I couldn't find a relevant vmoptions either.
Is there a way to pass these settings to the app/jre?
Is there also a way to instruct the JRE to open the Java console when it runs?
Thanks!
/Shmulik.
You can configure the proxy by setting the VM parameters
proxySet=true
proxyHost=...
proxyPort=...
and for authentication
proxyAuth=true
proxyAuthUser=...
proxyAuthPassword=...
You can set them either in a "Run script" in the startup node of the installer action by calling System.setProperty() for the properties or by passing them on the command line like this:
-DproxySet=true -DproxyHost=... etc
As for your second question (better to ask a separate question on stackoverflow)
Is there also a way to instruct the JRE to open the Java console when it runs?
I assume you mean a terminal window, which can be done by selecting the "Windows console executable" property of the installer. You cannot change this property on the command line because this sets a static flag in the binary format of the Windows executable furing compilation.
I created an installer for WINDOWS as well as for MAC. The
application is using an embedded JRE. While the application runs, it's not
able to detect the proxy settings of the network even the option in
the browser is set to be "Auto Detect". But when the proxy settings provided explicitly in the browser, it's able to detect the proxy settings.
Even the proxy settings are not detected when "LAN Settings->Use automatic configuration script" option is selected and points to the .pac file.
Any suggestion, how to provide the proxy settings with BUNDLED JRE and java program can detect those settings without make any further changes in each machine.
Using PyDev with Eclipse Juno, I need to set some environment variables to debug every single of the many scripts in my project. I have found how to set them for a given script but it would be totally impractical to do it for all of them. The only solution I have found consists in adding those variable to the Python interpreter configuration in the Preferences. But then it will be used by all projects, which I don't want.
I thought of creating a script setting those environment variables and then launching Python, and then add it as a new Python interpreter but PyDev does not accept two interpreters with the same actual exe (I guess it checks sys.executable).
The recommended approach is really setting it at the Python interpreter level.
You can use virtualenv ( http://pypi.python.org/pypi/virtualenv ) to create a copy of your interpreter in a different path.
Just to elaborate that #FabioZadrozny's answer meets the need of the OP...
In case it hasn't occurred to you, do this:
From the menu "Window->Preference"
Navigate to "PyDev->Interpreters->Python Interpreter"
Create a new interpreter instance with "New..." button
Name it something like "python-MyProj", but use the same executable you are already using
Now in the "Environment" tab for that interpreter, set up the needed environment variable
Now, see the PyDev project to use THAT interpreter:
Right-click the project to get "Properties..."
Navigate to "PyDev-Interpreter/Grammar"
Select the newly created interpreter instance by name
Now run any python file within the project, and it should "see" the configured environment variable.
By this mechanism, you do have a "project specific setting"... which, again, for the reasons #FabioZadrozny pointed out, need to be set at the interpreter level.