this is not exactly what you need, but it may be useful:
Create a Test.java file with this content:
public class Test { public static void main (String []args) { System.out.println("hello world"); } }
1) create a binding .java file to some program for example. eclipse
1.1) for this purpose in the explorer we choose to open with the help ... 1.2) we specify the full path to the program and put a tick to remember (so that it always opens with this program)
2.1) run regedit
2.2) open the HKEY_CLASSES_ROOT\.java branch
2.3) we look at the value of the key (Default), I have it 'java_auto_file'
2.4) we are looking for 'java_auto_file' in the same thread, for me this key has approximately the following contents
java_auto_file-->shell-->open-->command: (Default)="D:\programming\java\eclipse12\eclipse.exe" "%1"
3) Create your own line in the context menu
3.1) Create another branch with the same content:
java_auto_file-->shell-->Compile-->command (Default)="D:\programming\java\eclipse12\eclipse.exe" "%1"
3.2) Replace the path to the program with the path to the java compiler:
(Default)="C:\Program Files\Java\jdk1.7.0\bin\javac.exe" "%1"
4) compile the class
4.1) in the explorer from the context menu of our file, select the item "compile" (the one we added)
4.2) an existing open item can be deleted if desired
similarly for the .class file, the default action can be made to start it