Posts Tagged ‘windows’

OpenJDK builds for Windows now available from Redhat

June 29, 2016 Leave a comment

As I mentioned in an earlier post, officially supported OpenJDK builds for non-Linux platforms have been notoriously hard to come by in the past, at least until Azul started their Zulu builds in 2013. Unofficial community builds are also available from the ojdkbuild project on Github.

Today Redhat announced that their OpenJDK offerings now include builds for the Windows platform as well.

After Google decided to use OpenJDK in Android N, I guess this is another strong indicator of OpenJDK’s value and increasingly wide adoption.

Categories: java, windows Tags: , ,

Append entries to Windows user PATH from script or command line

January 17, 2014 Leave a comment

If you have to work in a Windows environment where you do not want to or cannot change the system level PATH, you can usually still use the “setx” command to change the user level PATH variable.

But what if you want to add (append) a directory to the user level PATH? The following would set your user PATH variable to the full (system + user) PATH plus the appended directory.

setx PATH "%PATH%;c:\whatever\else"

But this would duplicate the system PATH into your user PATH variable, which would ultimately cause duplicate entries in the full PATH.

Instead we want to append only to the user PATH variable. Unfortunately, to get its value from the Windows command-line you must query the “HKCU\Environment” registry entry and then parse the relevant part from the output string.

I wrote the add-to-user-path.bat script below to fix the problem. It has been tested on Windows 7, where “req query” uses 4 spaces to delimit its output, and it works even when the user PATH value already contains spaces:

@echo off 
setlocal EnableDelayedExpansion 

if %1.==. ( 
  echo Usage: %0 directory 
  goto End 

for /f "skip=2 tokens=*" %%A in ('reg query "HKCU\Environment" /v PATH') do ( 
   set regstr=%%A 
   for /f "tokens=3 delims=|" %%X in ("!regstr:    =^|!") do ( 
     setx PATH "%%X;%1" 
     echo PATH changes will only take effect for newly started processes. 

Categories: Uncategorized Tags: , , ,

Install and maintain Cygwin without Windows admin rights

January 10, 2014 13 comments

Sometimes you work on Windows as a restricted user, without admin rights. Like many other good software packages, Cygwin can be installed anyway (see the respective FAQ entry).

These are the steps I used:

  1. Download setup-x86.exe (32bit) or setup-x86_64.exe (64bit).
  2. Run it with the “--no-admin” option
  3. During installation select the “wget” package
  4. Create /usr/local/bin/ (for 32bit omit the “_64”):
    #! /bin/sh
    rm setup-x86_64.exe
    chmod u+x setup-x86_64.exe
    run ./setup-x86_64.exe --no-admin
  5. Make the script executable:
    chmod ugo+x /usr/local/bin/
  6. Create a copy of the Cygwin terminal shortcut, rename it “Cygwin setup”
  7. Edit the shortcut target, replace
    mintty.exe -i /Cygwin-Terminal.ico -


    mintty.exe -i /Cygwin-Terminal.ico /bin/bash -l -c ''

Whenever you want to run the Cygwin installer to install or remove packages, you can just execute the shortcut or run from the Cygwin command prompt.

Alternatively, you could also use the pure command-line tool apt-cyg.

Categories: bash, cygwin Tags: ,