Windows 10: How do I add new .java file to context new menu? Solved

  1.    01 Aug 2017 #1

    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. Posts : 4,474
    Mac OS High Sierra 10.13.5
       01 Aug 2017 #2

    First question would be why. The second would be what are you trying to accomplish.
      My ComputerSystem Spec

  3.    01 Aug 2017 #3

    RedBushTea said: 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

    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

    docpipo said: 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

    RedBushTea said: 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

    docpipo said: 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

  •    02 Aug 2017 #8

    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


  •  

    Related Threads
    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...
    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...
    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...
    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...
    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 script host (Wscript.exe), and may also use the .vb file extension. The...
    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:16.
    Find Us