1.    01 Aug 2017 #1
    Join Date : Aug 2017
    Posts : 5
    Window 10 Pro

    How do I add new .java file to context new menu?


    Hello, I want create a new blank java source code file from the context menu when I right click in
    a folder and select new.

    I have tried adding a registry edit with the following code:

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\.java\ShellNew]
    "NullFile"=""

    This does not work even after a restart.
      My ComputerSystem Spec
  2.    01 Aug 2017 #2
    Join Date : May 2015
    Central IL
    Posts : 4,229
    Mac OS Sierra

    First question would be why. The second would be what are you trying to accomplish.
      My ComputerSystem Spec
  3.    01 Aug 2017 #3
    Join Date : Jul 2017
    Posts : 18
    Win 10 Pro

    Quote Originally Posted by RedBushTea View Post
    Hello, I want create a new blank java source code file from the context menu when I right click in
    a folder and select new.

    I have tried adding a registry edit with the following code:

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\.java\ShellNew]
    "NullFile"=""

    This does not work even after a restart.
    Did you set a value?
      My ComputerSystem Spec
  4.    01 Aug 2017 #4
    Join Date : Aug 2017
    Posts : 5
    Window 10 Pro
    Thread Starter

    I want to do this so that I can create a new java source code file from the context menu, then I will open the file in
    a text editor and write the java source code as part of a set of java programming lessons.

    I can create a new text file from the context menu and then rename the file extension to .java or other work around
    methods but I think having a menu item in the context menu will be better.
      My ComputerSystem Spec
  5.    01 Aug 2017 #5
    Join Date : Aug 2017
    Posts : 5
    Window 10 Pro
    Thread Starter

    Quote Originally Posted by docpipo View Post
    Did you set a value?
    I did not set a value as I copied the code from another forum, and as far as I know this code will allow a new blank file
    to be created.
      My ComputerSystem Spec
  6.    01 Aug 2017 #6
    Join Date : Jul 2017
    Posts : 18
    Win 10 Pro

    Quote Originally Posted by RedBushTea View Post
    I did not set a value as I copied the code from another forum, and as far as I know this code will allow a new blank file
    to be created.
    I'd say try setting it to 1, and see what happens. I tried it but I didn't look up a code yet and I'm no expert, just a suggestion
      My ComputerSystem Spec
  7.    01 Aug 2017 #7
    Join Date : Aug 2017
    Posts : 5
    Window 10 Pro
    Thread Starter

    Quote Originally Posted by docpipo View Post
    I'd say try setting it to 1, and see what happens. I tried it but I didn't look up a code yet and I'm no expert, just a suggestion
    Thanks, I changed the value to 1 as you suggested but it still does not work.
      My ComputerSystem Spec
  8.    02 Aug 2017 #8
    Join Date : Aug 2017
    Posts : 5
    Window 10 Pro
    Thread Starter

    After some research and trial and error I have got it working, I found useful information in various web pages
    including:
    windows - How can I add an item to the context menu? - Super User
    and
    Adding Items to the "New" Context Menu (Tips.Net)

    So after making changes to the registry and exiting regedit, I had to close all Explorer windows and then restart Explorer for the changes to take effect.

    Below is the code I have exported from regedit, I don't know if all the changes are needed but it works

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\.java]
    "PerceivedType"="text"
    @="JavaSourceFile.Document"

    [HKEY_CLASSES_ROOT\.java\PersistentHandler]
    @="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

    [HKEY_CLASSES_ROOT\.java\ShellNew]
    "NullFile"=""
    "FileName"="C:\\Windows\\ShellNew\\Template.java"
    "~NullFile"=""

    [HKEY_CLASSES_ROOT\JavaSourceFile.Document]
    @="JAVA Source File"

    [HKEY_CLASSES_ROOT\JavaSourceFile.Document\DefaultIcon]
    @="C:\\Program Files (x86)\\Notepad++\\notepad++.exe,0"
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Customization Run as administrator - Add to PS1 File Context Menu in Windows 10
How to Add 'Run as administrator' to PS1 File Context Menu in Windows 10 Some legitimate applications require a full administrator access token (elevated) to perform their functions or tasks. For example, when a program that you are trying to run...
Tutorials
Solved How to fix 'Open with' on file context menu.
I have a few file extensions where the 'Open with' option is not working. When I right click on these extensions I get an 'Open with' option with an arrow that just produces another 'Open with' instead of a list of other programs that can open the...
General Support
Solved Desktop Context Menu: New No .txt file in there. How to add etc.
Hello Everyone, I recently noticed in the Desktop Context Menu: New no longer has the .txt file option. Does anybody know why? If it is legitly gone how do I add it back into the context menu? Before windows 10 on the task bar when you right...
General Support
Customization Add Run as administrator to Context Menu of VBS Files in Windows 10
How to Add 'Run as administrator' to VBS File Context Menu in Windows 10 Some legitimate applications require a full administrator access token (elevated) to perform their functions or tasks. For example, when a program that you are trying to run...
Tutorials
Customization Add VBScript File to New Context Menu in Windows 10
How to Add VBScript Script File to New Context Menu in Windows 10 A .vbs file is a VBScript (Visual Basic Script) file written in the VBScript scripting language that can be executed within Windows or Internet Explorer via the Windows-based...
Tutorials
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 00:52.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums