launching windows 8 on a vm

My “Windows computer” is a Windows XP machine that is over 7 years old and barely works. I still have it because every once in a while I’ve used it to test something in Internet Explorer. It doesn’t have the latest patches, virus scan, software etc. And it is really slow. My work computer has Windows, but that is meant for work. I’m about to start on something where at home it would be convenient to have easy access to Windows. I already have a href=”/tag/virtualbox/”>VirtualBox on my Mac for Ubuntu and Chrome OS.

I decided to go with Windows 8 because it is the future.  No time like the present to start getting used to that OS.  My theory is that it will less aggravating using it for little things rather than waiting for it to become my primary computer one day.

Plus you can test out Windows 8.1 Enterprise for free for up to 90 days.  PCWorld has a great article about it.  The install was between 30 and 60 minutes.

Once the VM was installed, it was fairly simple to get started:

  1. Download JDK from Oracle and install
  2. Click down arrow in bottom right corner to get list of apps
  3. Type “Command” to get the DOS prompt.
  4. Right click “Command Prompt” to pin to start menu so can get to it right away next time.
  5. Update path from control panel

Overall, my first impressions are that Windows 8 is very colorful.  And that if I didn’t know what to search for, I wouldn’t have found what I needed.

Second impressions

They moved everything.  I’m able to do what I need, but it feels like someone moved around all my furniture, hid some things and said “well, you just have to ask for them.”  I am so glad that I don’t have to do work on this thing at the moment.  And it feels like it takes a lot of clicks to do anything.

Communicating with the VM

You can copy/paste from VirtualBox.  I decided to use github instead though as I already have the code I want to try on Windows in a private github repository.  Github has a Windows client.  I’ve never used it so decided to download to see what it is like.  It is only 41.2MB, but downloaded really slowly.   The app provided a UI to clone a repository in github which it automatically checks out into Documents/github/repo-name.  The UI is nice, but I wound up using the git bash shell provided with the application.  Which meant it really only saved me some setup.

Other options would have been Dropbox or just use the copy/paste functionality from VirtualBox.  (I really didn’t want to do that for whole files.)

ant vs java – using ** to match directories

Suppose I have the following files:
/MyFiles/dir/a.txt
/MyFiles/dir/child/b.txt

In Ant, this is how you write code to output all text files in any subdirectory of a “dir” directory.

<fileset id="jb" dir="/MyFiles">
  <include name="**/dir/**/*.txt" />
</fileset>

<pathconvert pathsep="${line.separator}" property="out" refid="jb"/>
<echo>${out}</echo>

In Java, the equivalent is

public class MyPathMatcher extends SimpleFileVisitor<Path> {
  private PathMatcher matcher =
     FileSystems.getDefault().getPathMatcher( "glob:**/dir/**.txt");

 @Override
 public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
   if (matcher.matches(file)) {
     System.out.println("File " + file);
   }
   return FileVisitResult.CONTINUE;
 }

  public static void main(String[] args) throws Exception {
    MyPathMatcher dirs = new MyPathMatcher();
    Files.walkFileTree(Paths.get("/MyFiles"), dirs);
   }
}

The Java documentation says “Two asterisks, **, works like * but crosses directory boundaries. This syntax is generally used for matching complete paths”. Whereas in the Ant documentation, “When ** is used as the name of a directory in the pattern, it matches zero or more directories.”

The Ant approach probably feels more natural to me because I’ve been using it longer. But the Java approach seems more logical because it doesn’t have the extra slash that doesn’t actually get matched.