简体   繁体   English

如何在没有管理员的情况下在USB驱动器上安装android studio

[英]How to install android studio on usb drive without administrator

I have installed both a jdk and android studio on a usb drive, however android studio doesn't seem to want to launch from that jdk (it instead says none are installed), I have looked online and these solutions have been suggested: - Adding the JDK to my system path file, as I want to run this on a school computer that wont be possible, as you need admin - Changing the settings inside of android studio, given that i cant even get it to launch this is not an option - I have tried to add something to the studio.bat, but I probably got it wrong, and it didn't work. 我已经在USB驱动器上同时安装了jdk和android studio,但是android studio似乎不想从该jdk启动(相反,它说没有安装),我在网上已经看过,建议使用以下解决方案:-添加JDK到我的系统路径文件,因为我想在无法运行的学校计算机上运行此文件,因为需要管理员-更改android studio内的设置,因为我什至无法启动它,这不是一个选择-我曾尝试在studio.bat中添加一些内容,但可能是我弄错了,并且没有用。

I think the most promising option is to add it to studio.bat, would any of you know how to do this (the jdk is located in the same drive but in/jdk no/AndroidStudio)? 我认为最有前途的选择是将其添加到studio.bat中,你们中任何人都知道如何执行此操作(jdk位于同一驱动器中,但位于/ jdk no / AndroidStudio中)吗?

I would be open to other options that don't require admin permission. 我会接受不需要管理员权限的其他选项。

I have poked around and I think this would be a solution but i can't work out how: 我四处摸索,我认为这将是一个解决方案,但我不知道如何:

I need to add E:\\JDK7 as my JAVA_HOME to this file (studio.bat): 我需要将E:\\ JDK7作为我的JAVA_HOME添加到此文件(studio.bat):

IF EXIST "%ANDROID_STUDIO_JDK%" SET JDK=%ANDROID_STUDIO_JDK%
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%~dp0\..\jre" SET JDK=%~dp0\..\jre
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%JDK_HOME%" SET JDK=%JDK_HOME%
IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME%
IF "%JDK%" == "" GOTO error

:jdk
SET JAVA_EXE=%JDK%\bin\java.exe
IF NOT EXIST "%JAVA_EXE%" SET JAVA_EXE=%JDK%\jre\bin\java.exe
IF NOT EXIST "%JAVA_EXE%" GOTO error

SET JRE=%JDK%
IF EXIST "%JRE%\jre" SET JRE=%JDK%\jre
SET BITS=
IF EXIST "%JRE%\lib\amd64" SET BITS=64

I have tried adding this to the file (below IF EXIST "%JAVA_HOME): 我尝试将其添加到文件中(在IF EXIST“%JAVA_HOME下面”):

IF NOT "%JDK%" == "" GOTO jdk
IF EXIST "E:\JDK7" SET JDK=E:\JDK7

Batch file work for me. 批处理文件为我工作。 I have jdk installed on a usb stick at the location \\Java\\jdk1.7.0_75 and a studio.bat file with: 我在位置\\ Java \\ jdk1.7.0_75的USB记忆棒上安装了jdk,并带有以下Studio.bat文件:

set Path=\Java\jdk1.7.0_75\bin;%Path%
set JDK_HOME=%JDK%\java\jdk1.7.0_75
set JAVA_HOME=%JAVA%\java\jdk1.7.0_75
\AndroidStudio\bin\studio

1) Extract tools.zip from downloaded JDK, then run 1)从下载的JDK中提取tools.zip,然后运行
for /R %f in (.\\*.pack) do @"/path/to/tools.zip/bin/unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"

2) Move the extracted folder under Android Studio, then rename it to "jre". 2)将提取的文件夹移至Android Studio下,然后将其重命名为“ jre”。

3) Profit. 3)利润。


FYI how the folder tree likes: 仅供参考,文件夹树如何:
~/AndroidStudio/ bin/ lib/ ... jre/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM