Installing JDK without administrator privileges

前端 未结 14 1651
旧时难觅i
旧时难觅i 2020-12-13 00:13

I am trying to install JDK at office laptop but it says I need administrator privileges. I have only access to my own account at work.

How can I install the Java Dev

相关标签:
14条回答
  • 2020-12-13 00:50

    I have tried several ways of installation, but there is a common problem:

    In the worst case, if any installation requires admin privilege, then you will not be able to use 7zip because there is no portable version of 7zip. But, in Windows 10 and later versions of Windows 7(if my memory serves me well), extracting zip file is possible without any program installation: just open the .zip file with "Windows explorer" and extract them. However, this only works a normal zip file, not with JDK installer.

    So, I have tried another way and it works(for oracle jdk 1.8-191): you can install a JDK in other PC where you have privilege, pass it to your company PC, and set it as the JDK to use.

    1. just intall the JDK in another PC where you have admin privilege, such as that you have at home
    2. Zip that JAVA_HOME folder(the parent folder of bin), copy it to a USB driver, and take that to your company.
    3. Unzip in a folder where you have full access, like C:\Users\<your_name>\java(because some company also restrict pasting into Program Files or somewhere else, but will never restrict what you do in your personal user folder
    4. Set JAVA_HOME variable to there(if you are not allowed to do that, just skip). The same applies to setting up the java path(adding bin\java to PATH variable)
    5. Open Intellij IDEA or Eclipse, setup your new JDK in the IDE to point to there.
    6. Write a simple Hello World program to verify.

    I found this because when I look into the JDK installer, I see very similar structure as in JDK folder. So I suspect the installation only consists of extracting the content into a foler, plus some config, which we can do manually. Looks like that my theory is proved.

    0 讨论(0)
  • 2020-12-13 00:56

    If you can install it on any other machine then this solution will help you.

    • Install it on another machine.
    • Bring the jdk folder on your machine and set system and classpath variable to the path where you have copied the jdk folder. You should be able to run your programs.
    0 讨论(0)
  • 2020-12-13 00:59

    Here are all the steps that got the JDK installed on Windows 7 without admin rights.

    1. You need the cabextract program to extract the installer files. I tried 7zip but it didn't extract the cab properly. Instead, I used cygwin. You can get the setup.exe program from their website, but you must rename it because Windows assumes that anything called "setup" requires admin rights. I renamed it to cygwin.exe. Run that. It'll ask you where to install. I chose the cygwin directory in my home directory. When the pop-up asks you which programs to install, type "cabinstall" in the search bar. Expand the "Archive" section and make sure the "cabinstall" is not set to "skip". (Click the "skip" text until the highest number shows.) Proceed with install. This takes a few minutes.

    2. Optional: Add cygwin\bin to your path. Do this from control panel, user accounts, change my environment variables, edit PATH.

    3. Download the JDK. I downloaded jdk-6u45-windows-x64.exe.

    4. In the directory where that file is: mkdir tmp

    5. cd tmp

    6. cabextract ..\jdk-6u45-windows-x64.exe

    7. Make a new directory for the actual JDK. I used jdk in my home directory.

    8. Extract the tools.zip file into that. It comes with the Java runtime, so you don't need the other files in the original cab, such as jre.msi.

    9. Unpack all the .pack files. You can do that manually by running the bin/unpack200 program on them, or use bash (if you installed cygwin above):

      1. bash

      2. for f in $(../cygwin/bin/find . -name "*.pack"); do bin/unpack200 $f ${f%.*}.jar; done

    10. Add jdk/bin to your PATH (see step 2 above).

    0 讨论(0)
  • 2020-12-13 00:59
    1. Download the JDK
    2. Extract it by using 7 ZIP (Extract the exe file)

    It contains a single file tools.zip, which contains all the files we need. Extract the tools.zip to the desired JDK directory (e.g. “D:\JavaJDK\”). 3. Unpack

    Now we need to unpack a few files packed with pack200. We do that by executing this script in a console windows inside the JDK directory (e.g. “D:\JavaJDK\”):

    for /R %f in (.\*.pack) do @"%cd%\bin\unpack200" -r -v -l "" "%f" "%~pf%~nf.jar"
    

    Regard that you will have to adjust the path of the unpack200 binary (“D:\JavaJDK\bin\unpack200”) to your chosen directory.

    1. Congrats you now have a working, portable JDK!

    Reference: this link

    0 讨论(0)
  • 2020-12-13 00:59

    http://www.ehow.com/how_6012601_install-java-admin-privileges.html

    Here you go man, Good luck. This worked for me.

    Instructions on above link

    1 Insert your portable USB drive into your home computer's USB slot.

    2 On your home computer, navigate to the "Download Java JDK" link in the resources section.

    3 Click the red "Download" button. When asked to log-in, click "Skip this step." Click "Save file" to download the file to your computer.

    4 Double-click the ".exe" file you downloaded to begin the installation wizard for Java SE 6. Click "Accept" to the License Agreement.

    5 On the Custom Setup page, click the small hard-drive buttons next to "Source Code," "Public JRE," and "Java DB" and for each select "Don't install this feature now."

    6 Click the "Change..." button on the bottom right corner, then from the drop down menu, under "Look in:" select your portable usb drive. Click "Create New Folder" button in the in the top right corner (the folder icon), and name the new folder "JDK". Select the JDK folder and click "OK."

    7 Click "Next" and wait while Java installs.

    8 Open Notepad by going to "Start," "Programs," "Accessories" "Notepad."

    9 In Notepad, copy-paste the following two-line batch script: set Path=%~d0\JDK\bin;%PATH% cmd

    10 Click "File," "Save as," navigate to your USB drive root directory, and type "RunMeForJava.bat" as the name of your file and click "Save."

    11 Insert your USB drive into the computer where you do not have Administrator privileges and double-click the ".bat" file in your USB root directory. A Command Prompt window will open. Type "javac" (without the quotes) to see that Java works and is fully installed.

    0 讨论(0)
  • 2020-12-13 01:00

    I guess you are on Windows. You cannot install the JDK provided by Oracle without administrator right. What you can do is installing it on an other machine (or find a machine where it is installed) and copy the jdk dir.

    0 讨论(0)
提交回复
热议问题