Environment Variable failure
Two days ago I got a tiny tool that automatically configures JDK environment variables (details: http://www.cnblogs.com/chr-wonder/p/5208541.html ). Some minor problems were found during the debugging process. Record it here.
In the process of writing the Path environment variable, Because I add a new item at the end of the Path variable, in order to avoid conflicts (or adhesion) with the original item ), insert a; (semicolon) at the frontend of the items I inserted to separate new items. However, after the Path variable is written, the Path variable does not take effect. This left me wondering.
First, I considered whether it was because I wrote it in the user environment variable. I quickly rejected this idea because the user environment variables play the same role as the system environment variables (for the current user.
Then I considered whether it was necessary to restart. However, other environment variables take effect, but Path does not. No worries. test again after restart. The Path still does not take effect.
Finally, I carefully checked the environment variables I inserted. I found that the system I tested was a new system that was just installed. Before I wrote the environment variable, there was no Path variable in the user environment variable. So the Path variable I modified becomes: "; % JAVA_HOME % ...... "Starts with; (semicolon. After I delete the semicolon, the Path variable takes effect normally.
After some tests, I found that the Path variable starts with; (semicolon), which will invalidate the Path variable. At this point, the source of environment variable failure is found.
Why does the Path variable start with; (semicolon) become invalid? I don't understand it for the moment. I just got such a phenomenon from the test (this is not an example ). If anyone knows, please don't hesitate to give me your advice. Thank you very much. If you have any questions, please leave a message and learn from each other.