Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #35

Open
apennebaker opened this issue Sep 25, 2013 · 6 comments
Open

Windows support #35

apennebaker opened this issue Sep 25, 2013 · 6 comments

Comments

@apennebaker
Copy link

@apennebaker apennebaker commented Sep 25, 2013

jenv is pretty neat! Could we get a Windows version going?

In Windows, environment variables aren't set in dotfiles, but there are still programmatical ways to modify them, so a jenv.exe is doable.

@gcuisinier

This comment has been minimized.

Copy link
Collaborator

@gcuisinier gcuisinier commented Sep 25, 2013

The main problem is that jenv use simlinks to store path to java_home .. I'am not sure that is possible to do this in windows.
In more, I use a lot of shell functions...

A windows version is possible, but that will be a completely new implementation.

@apennebaker

This comment has been minimized.

Copy link
Author

@apennebaker apennebaker commented Sep 25, 2013

The main problem is that jenv use simlinks to store path to java_home .. I'am not sure that is possible to do this in windows.

Windows 7+ has a weak form of symlinks, though I wouldn't trust them to do the job well. We could just keep a hashmap of various variables stored in a file somewhere, and have jenv.exe set environment variables based on that.

A windows version is possible, but that will be a completely new implementation.

Yeah, completely agree. Even with Git Bash in Windows, Unix shell scripting still presents many difficulties.

In the mean time, thanks for uploading jenv! I'm sure Mac and Linux users will appreciate your efforts!

@jgiovaresco

This comment has been minimized.

Copy link

@jgiovaresco jgiovaresco commented Aug 13, 2014

Meanwhile, you could use jenv in Windows in a Cygwin environment. I recommend you Babun.

@flowersinthesand

This comment has been minimized.

Copy link

@flowersinthesand flowersinthesand commented Nov 22, 2015

@jgiovaresco Following your advice, I installed jenv using Babun but it doesn't seem to work.

{ ~ }  »  git clone https://github.com/gcuisinier/jenv.git ~/.jenv                              ~
Cloning into '/home/Donghwan/.jenv'...
remote: Counting objects: 818, done.
remote: Total 818 (delta 0), reused 0 (delta 0), pack-reused 818
Receiving objects: 100% (818/818), 355.73 KiB | 17.00 KiB/s, done.
Resolving deltas: 100% (334/334), done.
Checking connectivity... done.
{ ~ }  » echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc                                 ~
{ ~ }  » echo 'eval "$(jenv init -)"' >> ~/.zshrc                                             ~ 2
{ ~ }  » exec $SHELL -l                                                                       ~ 1
: invalid optionjenv/bin/jenv: line 2: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/home/Donghwan/.jenv/bin/jenv: line 4: $'\r': command not found
/home/Donghwan/.jenv/bin/jenv: line 5: syntax error near unexpected token `$'{\r''
'home/Donghwan/.jenv/bin/jenv: line 5: `resolve_link() {
{ ~ }  » jenv whence                                                                            ~
: invalid optionjenv/bin/jenv: line 2: set: -
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
/home/Donghwan/.jenv/bin/jenv: line 4: $'\r': command not found
/home/Donghwan/.jenv/bin/jenv: line 5: syntax error near unexpected token `$'{\r''
'home/Donghwan/.jenv/bin/jenv: line 5: `resolve_link() {

Have you experienced this issue? Maybe babun issue?

@flowersinthesand

This comment has been minimized.

Copy link

@flowersinthesand flowersinthesand commented Nov 28, 2015

I solved the above issue by adding echo $SHELLOPTS=igncr to ./zshrc

@osbald

This comment has been minimized.

Copy link

@osbald osbald commented Mar 13, 2017

FYI just an update on this. Oracle Java 1.8 on Windows actually uses symlinks to find the java executables on the machine. On my Windows 10 laptop it has installed them to 'C:\Users\All Users\Oracle\Java\javapath' if you look at the files and right-click, view properties you'll notice they're just zero length links to the actual files in the jre/bin directory. This 'All Users' dir (also a symlink) is automatically added to the PATH env var during runtime installation much like JAVA_HOME might have been used in the past.

If you type 'dir /al /s' in the root dir of your drive you should see all the linked files and folders. Windows uses symlinks and junctions (legacy symlinks) much more than you might expect.

Previous versions of the java runtime on Windows would install small stub java.exe ... executables in windows/system32/ I think to achieve an automatic inclusion into the default PATH. But you'd then have to delete all those stubs and replace with a explicit '%JAVA_HOME%/bin' addition to the PATH to wrestle back some control.

Also we now have Bash shell support in Windows 10 (https://msdn.microsoft.com/en-gb/commandline/wsl/about) though I've not tried jenv as we use Kapersky Antivrus and it currently blocks and cripples the bash shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.