The scope and when to run the SetEnv.Cmd of Windows SDK - winapi

Sorry about being a newbie for this issue... But I'd really like to know the scope and when to run the SetEnv.Cmd under the Bin folder of the Windows SDK.
Since I only ran it in a command prompt, isn't the environment variable settings I did their only local to that session? Do I need to re-run it after I close that session? I tried and it seems to be that I don't need to, but... Why is this all done in a local session?
Sorry about the naive question,
Shawn

The SDK build tools require environment variables to be configured for the include path, library path, exe path, etc. Each version of the SDK has its own include files, etc. so each version requires different values for the variables. Hence the variables cannot be configured as permanent variables for the user (or system).
Instead, each SDK version provides the SetEnv.cmd batch file to configure the environment for that version of the SDK, and the variables are local to the current command-prompt.
When you install the SDK you get a shortcut created in the Start Menu that opens a command-prompt and runs SetEnv.cmd for you. For example, on my computer I have "Windows SDK 7.1 Command Prompt".

Related

How to move ".android" folder in win 10 to another place?

.android folder is keeping recteating inside user folder.
I saw tip about setting AnDROID_SDK_HOME but it is deprecated and variable is removed as soon as I start studio.
Sdk is located at E:\programms\androidsdk
ANDROID_HOME is supposed to be deprecated, not ANDROID_SDK_HOME. Testing on Android Studio 4.0.1, the environment variable ANDROID_SDK_HOME is honored and works correctly.
Ensure you are setting the environment variable properly as a user variable on Windows 10:
Start -> Edit the system environment variables -> Environment Variables -> User variables for <username>
An alternative solution (if the above is not working) is to use symbolic links, of which there are two methods (both accomplishing the same goal):
CMD: Using Windows Command Prompt, which may require Administrator privileges
mklink /D E:\Android\.android C:\Users\<username>\.android
GUI: Link Shell Extension
This will effectively enable you to store your .android folder at E:\Android\.android, but still support applications referencing C:\Users\<username>\.android. Note that some applications may encounter issues with symbolic links; your mileage may vary.

Bash on Windows - debug a python file with Visual Code or Visual Studio

I have a python file in my Bash on Windows environment.
Is it possible to debug it with Visual Code or Visual Studio?
Can a debugger be attached to the Linux python version that exists in the Bash on Windows environment?
I think you've got a few options for this. If you're attempting to debug a python file that's saved on your home directory in Bash on Windows, you can navigate to your home directory in Windows by going to "C:\Users\[windows username]\AppData\Local\lxss\home\[ubuntu username]\". Then you can open any of your projects or files saved on your home folder in Ubuntu. You can even make a shortcut on your desktop or something to make it easier to access this folder.
However, if you need the environment that you have on Bash for dependencies or python modules, your other option is to install a GUI and Linux-compatible IDE of your preference on Ubuntu, and use Xming on Windows to run the IDE on your screen. A tutorial on how to do this can be found here.
If you need to debug a linux python program from Visual Studio, a simple Google search yielded this. I haven't tried it but this seems to be the solution you are looking for. For connecting over the network to Bash on Windows from Windows, use localhost for the host.
Your best bet might be to just move the file. Your normal windows system is mounted under /mnt/c.
You can just copy it to your desktop by doing
cp (path to your file) /mnt/c/(your username)/Desktop
When you need to access or edit it from bash, just cd to that location (or wherever else you choose to store it).
Interesting other idea: you could mount cloud storage (e.g. google drive) via fuse in linux then set it up in windows. Copy the python to it and you can edit in windows and access in linux as needed. (Google is your friend here; look into google-drive-ocamlfuse or gdrivefs).
Hope this helps!
jBit
I would suggest making use of the Remote - WSL extension for Visual Studio code. It allows you to easily access your Windows Subsystem for Linux (WSL) and use it as a full-time dev environment.
Here is an article on how to set up Visual Studio Code Remote-WSL.
After that is set up, you can quickly load your python file in the VS Code editor using a command like: code path/to/python_file.py

Strawberry Perl: forgets environment variables?

I've installed a number of modules into my Strawberry Perl running on Windows XP, such as:
Regexp::Common
URI::Find::Schemeless
These libraries work fine in my perl code the first time directly after installing each module.
The problem is that every subsequent day I run my scripts they fail with the error:
Can't locate Regexp/Common.pm in #INC (#INC contains: C:/strawberry/perl/lib C:/ strawberry/perl/site/lib C:\strawberry\perl\vendor\lib .)
I have put all the appropriate paths into environment variables into Windows: PERL5LIB and others such as lib that were suggested on various other answers on stackoverflow and other wesites dealing with module installations.
The scripts continue to fail unless I perform the following workaround that I figured out:
Open the "edit the environment variables" window in Windows. ("My Computer" -> "Properties" -> "Advanced" tab -> "Environment Variables")
Without adding or changing anything, click OK.
Re-open any perl consoles that were already open or open a new perl window.
Now the libraries are all found without issues.
Does anyone have an idea why this might be happening? I suspect it may be something specifically related to Windows/cmd or even my company's windows environment setup?
Any suggestions would be appreciated because it is an extremely annoying problem!
Windows does not clear the environment variables daily by default, therefore it's likely something in your corporate settings resetting the environment variables.
If this is the case, you have a few options:
Get the network admins to modify the script so that it doesn't reset them (or includes the PERL5LIB directories you want to specify).
Write another daily task, running after their daily task, which re-adds the variables on your local machine.
Wrap your perl scripts with a Windows batch file, or run them with perl -I to specify the library at run time.
Run your perl scripts from Cygwin bash or mingw bash, which won't use your computer's global environment variables.

Android studio doesn't start

I just download Android Studio for Windows 7, the wizard went ok up to the end but now when I click on the shortcut or on the .exe to start the program nothing happens, no error, no new window, it's seems like it is doing nothing. Do you have any suggestion?
It's a bug of Android Studio 0.1v
You should add JAVA_HOME to the system environment variables.
http://tools.android.com/knownissues#as0.1
Open Start menu > computer > System Properties > Advanced System
Properties
In the Advanced tab > Environment Variables, add new system
variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21
Install latest Java Development Kit.
Set path in system variables for Java (ie *C:\Program Files\Java\jdk1.7.0_21\bin*)
Set JDK_HOME system variable (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, set JAVA_HOME in system variable too (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, check if you don't have spaces at the ends of the lines in system variables (PATH, JDK_HOME, JAVA_HOME)
You don't have to restart computer after changing system variables, just reload command prompt (if you are using it).
If it still not working, you probably have java.exe in C:/Windows/System32/. Rename it, restart command prompt and type java -version to check if you are using correct version of JDK.
I've posted tutorial how to fix Android Studio with screenshots on my blog.
I have had a similar problem with Android Studio 1.0 in windows 7 x64. When I ran studio64.exe it flashed the android studio logo and it disappeared immediately. Also I tried
studio64.exe > error.log
to figure out possible errors. JAVA_HOME=C:\Program Files\Java\jre1.8.0_25 environment variable was correctly setted.
Finally I decided to uninstall all Java versions (I had a mess of different java versions installed), both jdk and jre and reinstalled last version jdk 1.8.0_25. My problem was solved.
Regards,
Sometimes it might get stuck in memory. Open task manager, terminate android stuido. Open it up again.
If you install new the version of android studio.
It requires new jdk 1.8.
Just install the latest jdk 1.8 and android studio will work without the need to manually edit any environment variables.
You have to add a new system variable named ANDROID_STUDIO_JDK or JDK_HOME with the path to your JDK install folder, such as C:\Program Files\Java\jdk1.7.0_21\
I had the same exact problem and did try to do every thing manually nothing worked except for this command when I finished it finally launched. Open CMD with administrator if possible then put the following command:
set path="$PATH":C:\Program Files\Java\jdk1.7.0_21\bin
Then just try to launch it should work.
This is the only thing that worked for me.
Make sure you have Java 1.8 (JDK) or higher and update java_home and path to this version.
I did every tips but i checked AS requirements and updated jdk do 1.8.xx
It's possible there is a problem with your username (and name of the user folder). It shouldn't contain non-latin letters.
I had solved my problem (no response to an attempt to run Android studio) when I tried running the application as another Windows user (with name that consists of English letters only)
I got the same problem, but with no error message.
I found a studio.bat file and dig in it. There, I found some tips:
I found out thet the variable suggested in a previous post is incorrect.
ANDROID_STUDIO_JDK is no good.
STUDIO_JDK is the one.
Also, just to make the things/solution worst to corner,
I've uninstalled jre and jdk then reinstall jdk only.
The setup variables are like this:
JAVA_HOME is now pointing to C:\Program Files\Java\jdk1.8.0_172\bin
JDK_HOME is pointing to C:\Program Files\Java\jdk1.8.0_172
STUDIO_JDK is pointing to C:\Program Files\Java\jdk1.8.0_172
It's a mess but it's working...
Is it because I uninstalled/reinstalled java sdk and jre? or just the env. variables? who knows :)
Specs:
i5 with 4gig ram
win 10 32bit
In addition to following the steps pointed out by Tigris I also had to run the Android Studio with Administrative rights. Not sure why but I just made it in a few minutes ago.
Follow the steps here: http://tools.android.com/knownissues#as0.1
Run Android Studio as Admin
There is Another Issue
http://tools.android.com/knownissues
open a "cmd.exe" (command prompt), cd to the android-studio\bin folder and run "studio.bat". You will most likely see an error: for example b/55267 is about the option -XX:+UseCodeCacheFlushing not being recognized. Report the error, remove the line from the studio.exe.vmoptions or studio64.exe.vmoptions and it should now work.
There could be a process still running in the background that would need to be killed in the task manager. The name of the process is studio64.exe (at least that's the name on my machine). Could be because I am running a 64-bit OS. After killing this process, try to run Android Studio again, and it should work.
If your path and/or environment variables are not pointing to the correct JDK, things won't work properly.
A rock solid solution, especially if you must have multiple JDKs installed (e.g. Java 6/7/8) is to create a batch file to launch Android Studio.
Create a new file called studio.bat and place this somewhere outside the Android Studio installation, e.g.
c:\mydevstuff\launchers\studio.bat
(if you put the batch file anywhere in the android-studio folder, then you'll have problems when updating Android Studio).
Put the following code in the new batch file:
#echo off
REM Can make paths relative to SCRIPT_PATH if necessary
set SCRIPT_PATH=%~dp0
set ANDROID_STUDIO_JDK=<JDK Path>
set JAVA_HOME=<JDK Path>
set PATH=<JDK Path>\bin;%PATH%
cd <android-studio Install Path>\bin
start studio64.exe
Replace studio64.exe with studio.exe if you need the 32-bit version.
Replace
<JDK Path>
with the path to your JDK, e.g.
C:\Program Files\Java\jdk1.7.0_25
Replace
<android-studio Install Path>
with the path to your Android Studio installation, e.g.
C:\Program Files\Android\android-studio
Now you can just run the batch file to start Android Studio.
Additional:
If you want to pin to the Taskbar, then create a shortcut to the batch file and then change it's target to:
cmd.exe /c "<path to bat>\studio.bat"
Then pin this shortcut to the Taskbar by drag-and-drop.
You can also set it's icon from the original Android Studio studio.exe file.
I ran into this problem and these steps fixed it.
Remove ALL older JRE / JDK versions
Set values for JDK_HOME & JAVA_HOME to path of JDK install
if you use android studio version 2.3.3 you should have JDK with version 1.8 in the system environment values ,
to add it
click on Computer (in windows 7)
System properties
Advanced system settings (at the right)
Advanced (tab)
environment variables button
and edit the value of name JAVA_HOME to the file which contains jdk 1.8
if you don't have this variable make a new one

configure the jre version on windows 7 (32 bit)

I have java jre7 installed and also jre6, but the current version that is in use is the jre7. How do I tell windows to use the jre6 instead of 7? I've seen some guides of how to do so but it seems that they related to winXP since they were dealing with the JAVA_HOME variable (which does not exist on win7).
I've tried to add the path of the bin folder of the jre6 to the PATH environment variable but it didn't work. Do you have any other ideas?
By the way - I do want my eclipse to run the jre7, so I figured out I need to add/change lines in the eclipse.ini file, what exactly do I need to do there?
Thanks in advance,
Guy
Like on other windows versions (and by the way like on linux too), you have to set the JAVA_HOME environment variable.
If this var doesn't exist yet, it simply means you have to create it.
Here's how you can set an env variable on Win7 : http://www.windows7hacker.com/index.php/2010/05/how-to-addedit-environment-variables-in-windows-7/
For Eclipse, go in the preferences, choose java/installed JREs and choose the one you want. But for most of your other java based programs, the JAVA_HOME is really the important variable (along with the PATH).

Resources