Bin directory windows path

How to add Java bin folder path in Windows path system

i have a problem with running a Java software which is made for Windows. Actually I want run it on kali Linux but whenever I try to run the soft it tells me add Java bin folder path in Windows path system variable.

and thats my Java version

How can I solve this?

2 Answers 2

Add Variables — Java

First, you need to Locating the Environment Variables

1. Open up the system properties (WinKey + Pause) and you should see the below screen.

2. From the system properties, tab select the «Advanced» link. This should take you to the below screen.

3. From the System Properties screen select the «Advanced Tab». On this screen click the «Environment Variables» button.

4. You should now be seeing something like the below screen.

Now You Are Ready To Add Variables — JAVA

In the system variables section click in the «New» button.

In here enter the variable name : JAVA_HOME

Enter the variable value as the location of the java jdk installed in the previous section. (This is assuming you already have installed Java SDK. If you haven’t now is the time to do it)

For Example of my location below. (Please note the variable value will vary depending on your install location and version of the jdk)

Click ok to complete this action. Once completed you should see the JAVA_HOME variable in the list of system variables.

Next, you need to add the newly created JAVA_HOME variable on to your path.

To do this locate the «Path» variable in the system variables list. Select it and click the edit button.

This should bring up the below option.

Scroll to the end of the «variable value» field and append on the following

;%JAVA_HOME%\bin

Click «OK» to confirm and leave the edit path screen.

Once complete click «OK» to confirm and leave the Environment variables screen.

Next, open a new command prompt (Winkey + R then type cmd) and run «java -version» to verify that it is correctly installed.

If it is you should see something similar to the below screenshot.

How do I put PostgreSQL /bin directory on my path in Windows?

I’ve got a fairly simple question I guess. I’m working on a Ruby on Rails app. I’m trying to switch to PostgreSQL thanks to Heroku.

In my database.yml file it states:

My question is how do I put PostgreSQL’s /bin directory on my path? Exactly which file do I modify and how?

I imagine this is my issue since when I run the «rails db» command i get:

«Couldn’t find database client: psql,psql.exe. Check your $PATH and try again.»

Thanks everyone! Robin.

4 Answers 4

Append the directory to system PATH (not user PATH ) by Environment Variables, using a semicolon to separate it from the previous entry.

Читайте также:  Просмотр локальной сети linux

You can find it from control pannel -> system -> Advanced -> Environment Variables

Ran into the same issue and tried the solution mentioned here

Should do the trick.

You need to install Postgres first then add the path to system properties > environment variables > in system variables section you will see PATH variable

This is my preferred way of adding a new location to the PATH environment variable (on modern Red-Hat-based systems):

  • PATH is a colon : separated list of directories that are search, in order, for a called program.
  • Profile configurations under /etc are persistent for all users (but require the active shell to source them to take effect).
  • The version number is tacked on to the PostgreSQL directory when it is installed from their repository.

What is the equivalent of the bin directory for Windows?

Is there an equivalent to bin for Windows? If so, how can I access it from the command prompt?

5 Answers 5

There’s nothing actually special about /bin on Unix/Linux at all. It’s just the location where executable files (including scripts, which aren’t actually binary files) are placed by convention, and it is included in the PATH environment variable by default for all users. As Ryan says, the \Windows\System32 directory on Windows is also in PATH for all Windows users (and, even if it isn’t, Windows’ program loader will search there anyhow).

You can easily create your own equivalent of /bin on Windows. To make it system-wide, place it somewhere like the root of the file system (as in C:\bin ) or under an already-restricted location like \Windows\System32\bin ), and add it to the PATH environment variable for all users. For a per-user location, create the directory in your own profile ( %USERPROFILE%\bin ) and add it to your account’s PATH environment variable. Windows combines the per-user and system-wide PATH environment variables, so anything in the machine PATH variable is also added to any user’s PATH , but not the other way around.

Of course, you’ll have to add files / scripts / shortcuts / symlinks to your bin directory yourself. Windows installers don’t expect such a thing, and won’t put files there automatically the way that Linux installers will usually do.

Adding a directory to the PATH environment variable in Windows

I am trying to add C:\xampp\php to my system PATH environment variable in Windows.

I have already added it using the Environment Variables dialog box.

But when I type into my console:

it doesn’t show the new C:\xampp\php directory:

I have two questions:

  1. Why did this happen? Is there something I did wrong?
  2. Also, how do I add directories to my PATH variable using the console (and programmatically, with a batch file)?

18 Answers 18

This only modifies the registry. An existing process won’t use these values. A new process will do so if it is started after this change and doesn’t inherit the old environment from its parent.

You didn’t specify how you started the console session. The best way to ensure this is to exit the command shell and run it again. It should then inherit the updated PATH environment variable.

Option 1

After you change PATH with the GUI, close and re-open the console window.

Читайте также:  Флешка для восстановления windows 10 fat32

This works because only programs started after the change will see the new PATH .

Option 2

Execute this command in the command window you have open:

This command appends C:\your\path\here\ to the current PATH .

Breaking it down:

  • set – A command that changes cmd’s environment variables only for the current cmd session; other programs and the system are unaffected.
  • PATH= – Signifies that PATH is the environment variable to be temporarily changed.
  • %PATH%;C:\your\path\here\ – The %PATH% part expands to the current value of PATH , and ;C:\your\path\here\ is then concatenated to it. This becomes the new PATH .

WARNING: This solution may be destructive to your PATH, and the stability of your system. As a side effect, it will merge your user and system PATH, and truncate PATH to 1024 characters. The effect of this command is irreversible. Make a backup of PATH first. See the comments for more information.

Don’t blindly copy-and-paste this. Use with caution.

You can permanently add a path to PATH with the setx command:

Remove the /M flag if you want to set the user PATH instead of the system PATH .

    The setx command is only available in Windows 7 and later.

You should run this command from an elevated command prompt.

If you only want to change it for the current session, use set.

You don’t need any set or setx command. Simply open the terminal and type:

This shows the current value of PATH variable. Now you want to add directory to it? Simply type:

If for any reason you want to clear the PATH variable (no paths at all or delete all paths in it), type:

Update

Like Danial Wilson noted in comment below, it sets the path only in the current session. To set the path permanently, use setx but be aware, although that sets the path permanently, but not in the current session, so you have to start a new command line to see the changes. More information is here.

To check if an environmental variable exist or see its value, use the ECHO command:

I would use PowerShell instead!

To add a directory to PATH using PowerShell, do the following:

To set the variable for all users, machine-wide, the last line should be like:

In a PowerShell script, you might want to check for the presence of your C:\xampp\php before adding to PATH (in case it has been previously added). You can wrap it in an if conditional.

So putting it all together:

Better still, one could create a generic function. Just supply the directory you wish to add:

You could make things better by doing some polishing. For example, using Test-Path to confirm that your directory actually exists.

Safer SETX

  • SETX by default will update your user path.
  • SETX . /M will update your system path.
  • %PATH% contains the system path with the user path appended

Warnings

  1. Backup your PATH — SETX will truncate your junk longer than 1024 characters
  2. Don’t call SETX %PATH%;xxx — adds the system path into the user path
  3. Don’t call SETX %PATH%;xxx /M — adds the user path into the system path
  4. Excessive batch file use can cause blindness 1
Читайте также:  Traceroute in linux with port

The ss64 SETX page has some very good examples. Importantly it points to where the registry keys are for SETX vs SETX /M

Usage instructions

Append to User PATH

Append to System PATH

append_system_path.cmd . Must be run as administrator.

(It’s basically the same except with a different Key and the SETX /M modifier.)

Alternatives

Finally there’s potentially an improved version called SETENV recommended by the ss64 SETX page that splits out setting the user or system environment variables.

1. Not strictly true

Handy if you are already in the directory you want to add to PATH:

It works with the standard Windows cmd, but not in PowerShell.

For PowerShell, the %CD% equivalent is [System.Environment]::CurrentDirectory .

  • Command line changes will not be permanent and will be lost when the console closes.
  • The path works like first comes first served.
  • You may want to override other already included executables. For instance, if you already have another version on your path and you want to add different version without making a permanent change on path, you should put the directory at the beginning of the command.

To override already included executables;

Aside from all the answers, if you want a nice GUI tool to edit your Windows environment variables you can use Rapid Environment Editor.

Try it! It’s safe to use and is awesome!

It does things in an intuitive way. For example:

It shows results without the need to spawn a new cmd!

Regarding point 2 I’m using a simple batch file that is populating PATH or other environment variables for me. Therefore, there is no pollution of environment variables by default. This batch file is accessible from everywhere so I can type:

Checking the above suggestions on Windows 10 LTSB, and with a glimpse on the «help» outlines (that can be viewed when typing ‘command /?’ on the cmd), brought me to the conclusion that the PATH command changes the system environment variable Path values only for the current session, but after reboot all the values reset to their default- just as they were prior to using the PATH command.

On the other hand using the SETX command with administrative privileges is way more powerful. It changes those values for good (or at least until the next time this command is used or until next time those values are manually GUI manipulated. ).

The best SETX syntax usage that worked for me:

where any equal sign ‘=’ should be avoided, and don’t you worry about spaces! There isn’t any need to insert any more quotation marks for a path that contains spaces inside it — the split sign ‘;’ does the job.

The PATH keyword that follows the SETX defines which set of values should be changed among the System Environment Variables possible values, and the %PATH% (the word PATH surrounded by the percent sign) inside the quotation marks, tells the OS to leave the existing PATH values as they are and add the following path (the one that follows the split sign ‘;’) to the existing values.

Оцените статью