Environment Variables keep changing - command-line

I am working in Win 7. So I have set the Path variable inside properties, environment variables. But when I e.g. type java in command line it doesn't recognize it up until I write set Path=... And set the exact same thing I have already manually set in the properties env variable window. And then it works. But again when I close the command line and re-open it, it doesn't recognize javac. So every time I open the command line I have to set the Path. Any idea?

In Windows using set from the command line only sets the environment variable for that process. When you are doing it from the command line and then closing it, you are losing what you did there.
You say Properties, Environment Variables, but let me run through the steps so that we're on the same page.
To make sure an environment variable "sticks" click the Start button, Right Click "Computer" and choose Properties. Click Advanced System Settings and then Environment Variables... In the dialog that comes up, under the System Variables section double click on the Path environment variable. Scroll to the end, add a semi-colon, and then add the path to your executable.
You will now have to restart any process that was already running.

Related

Can't appear environment variables editor when edit Path (System environment variable) on Windows 11

I freshly install C/C++ compiler in my new window 11 laptop using MinGW Installer. and when i try add bin folder path to System environment path variable (System Environment Variable > Path) there i can't see Environment Variables Editor instead I found System Variable Editor but my old windows 10 laptop show Environment Variables Editor.
I can't understand what happened. And I don't know how to edit system environment variables using System Variable Editor.
Windows 10 laptop show Edit Environment Variables:
Windows 11 laptop doesn't show Edit Environment Variables but here show System Variable Editor:
I am the new on this platform so please forgive me if I have made any mistakes.
Thank you.
In fact an environment variable is an entire string. Windows 10 just displays multiple values separated by semicolons in a user friendly way. If you want to add a new value, append the value you want at the end of the entire string, and make sure there is a semicolon between the value and the previous one.

How to control, reset, or edit environment variables in vscode on Linux

I'm working on an application in vscode whose behavior is impacted by the settings of a handful of specific environment variables (the three "proxy" variables). I'm doing this on an Ubuntu VM.
At one point I realized that I had to change the settings (clear them) in order for my application to work. I know that it can be challenging to change env vars in subprocesses, so I decided to keep it simple and simply restart the entire VM after I changed my .profile. After the restart, I checked a shell window and the vars were set as I wanted (not set). I then started up vscode from my Ubuntu favorites bar. In the terminal window I printed the values of those vars. They still had the values I set before. I verified that when I ran the application from vscode (not from the terminal window in vscode), it behaved badly, so it was using the old values. In the terminal window, I then manually cleared those variables to put them into the correct state. I manually ran the service from the terminal window, and it did what it was supposed so, reflecting the cleared variables.
It appears that vscode is storing environment settings on disk and never getting them from the parent shell again.
How do I control this behavior?

Flutter install in windows environment variable

I have problem when trying to install the flutter in my desktop first I get error of :
is not recognized as an internal or external command operable program or batch file.
Then I open the system environment variable and add the flutter to the user variables path plus I add all of the flutter, git, system32 to systems variables path section.
Unfortunately, the problem is still present even with a restart.
Now when I type flutter doctor to Command prompt No results are shown and I cannot write an extra line.
Welcome to stackoverflow!
You should take these steps:
Open RUN by shortcut (WINDOWS_KEY+R_KEY)
Type in RUN SystemPropertiesAdvanced.
System Properties dialog should appear, click Environment Variables.
In User variables (The Top section) select Path and click Edit.
Add the new path to flutter Binary folder like this C:\flutter\bin.
Select OK, and OK again in Environment Variables, and OK in System Properties.
Close any Command prompt you using and reboot the system.
Hooray, :D now flutter is successfully installed.

How to automatically set environment variable for eclipse terminal view?

I use the terminal view in eclipse:
Every time I start the terminal I run a command to set an environment variable, e.g.
SET HTTPS_PROXY=***.**.***.***:****
I need this as a prerequisite to be able to download some python packages with the python package manager, e.g
pip install mesa
=> Is there a way to automatically run a "startup command" when the Eclipse terminal is opened?
I expected that there would be some Eclipse setting to configure the environment variables for the terminal or to specify some initialization script. However, I could not find such a setting.
I tried to set the proxy settings in eclipse.ini
-Dhttp.proxyHost=***.**.***.***
-Dhttp.proxyPort=****
-Dhttp.nonProxyHosts=localhost|127.0.0.1
However, that does not seem to influence the proxy for the terminal view.
(I actually use a portable version of eclipse with EclipseProtable and in EclipsePortable.ini I am already able to specify some extra paths that will be known when I open a terminal view, e.g.
AdditionalPaths=./App/WinPython/python-3.7.2.amd64;
Also see https://portableapps.com/node/32861 for informatino about EclipsePortable
However, I was not able to set envirionment variables in the ini file EclipsePortable.ini.
)
You can use your system environment variable.
In Windows search the "User Account" parameter.
It must show your current account, search for "Environment variable".
Now you can set all the variables you need and they will be used by default in any terminal in Eclipse (restart Eclipse if it was running).

Run, The Command Line and that Path Variable

I'm having a very weird issue with the command line and running Ant. I point the path variable at the location of my Ant bin directory (C:\Ant\bin) and when i go into a command window and type PATH it shows the location in it. But when I go to run Ant by typing "ant" it does nothing and states that it isn't recognized. But when I go to the run window (Windows+R) and type "ant" it runs it.
I have restarted Windows twice and the problem still persists. I am running Windows Vista Ultimate with SP1 installed. I have tried "Running as Administrator" with no difference.
Any one experience anything like this before?
Sometimes you can set a system-wide (or even just personal) Environment Variable and it'll cure it, as opposed to just setting it in your shell.
Go to the Control-panel, then System, then Advanced, and look for the button on Environment Variables. From there, you can follow your nose.
Good luck.
Ant also depends on Java to be on the path. Do you have that?
I would also check to make sure the environment variables ANT_HOME and JAVA_HOME are set up properly in the console.
Is there any chance that the command window you are trying to run Ant in is a different window to the cmd windwo where you set up and verify that its in the path? If the PATH is updated after a cmd window is already open it won't recongnise the change. Not clear if that might be your issue.
If you are in the dir C:\Ant\bin and type "ant" does it recognise it?