5

I find the ChkBugReport to be very interesting: http://developer.sonymobile.com/knowledge-base/tools/analyse-your-bugreports-with-our-open-source-tool/

so I would like to use it on my Windows7 but in a simple way.

In order to use the tool that is in jar, I need to type the following in the command prompt:

java -jar ChkBugReport_ver.jar dumplog.txt

where the dumplog.txt is the log I want to analyze by the tool.

The thing is that it is quite tiresome to run cmd and then type "java -jar... blah blah.." everytime I want to use it so I would like to link it to the mouse right-click context menu in Windows Explorer.

i.e., browse through to the file I want to analyze in Windows Explorer, then right-clicking on it would provide a menu like "run ChkBugReport.." then it does the "java -jar ChkBugReport_ver.jar clicked-file.txt" and generates the output.

Is there a way to do this?

Mifeet
  • 12,949
  • 5
  • 60
  • 108
g3han
  • 78
  • 1
  • 5

3 Answers3

6

Follow these steps:

  1. Open regedit (as administrator).

  2. Locate key HKEY_CLASSES_ROOT\*\shell. In case you want to add the context menu for a specific extension only, use e.g. HKEY_CLASSES_ROOT\.xml\shell for xml. If the shell key doesn't exist, create it (right-click on the parent key and select New -> Key).

  3. Right-click on the shell key, and select New -> Key. Enter the name of the command displayed in the context menu, e.g. Check Bug Report.

  4. Right-click on the Check Bug Report key and select New -> Key. Enter text command (in lowercase).

  5. Click on the command key and then double-click on the (Default) key in the right pane to edit the string value. Enter the command to be executed. Placeholder for the argument is %1. For ChkBugReport_ver.jar, you can use

    java -jar "C:\Path\To\ChkBugReport_ver.jar" "%1"
    

See also this tutorial.

(Works with my Windows 7)

Mifeet
  • 12,949
  • 5
  • 60
  • 108
  • I already checked this out but I would like to run it with one extra argument - the selected file so it would execute "java -jar ChkBugReport_ver.jar selected_file" – g3han Jun 01 '13 at 09:32
  • see my updated answer - the placeholder for the argument should be %1 – Mifeet Jun 01 '13 at 09:33
  • it doesn't work - the menu appears only when a folder is selected in the left tree of the Windows Explorer.. not with a file – g3han Jun 01 '13 at 09:44
  • Thanks! It works perfectly - except that the %1 also should be wrapped by the quotation marks: java - jar "C:\Path\To\ChkBugReport_ver.jar" "%1" – g3han Jun 03 '13 at 01:38
  • Works for me with .bat files, but with jars it just yields a popup with the folder path I clicked on and "Application not found". – H.v.M. Mar 15 '15 at 22:14
  • `java -jar "D:\Path\To\MyJar.jar"`. It works just fine if I enter it into the console though. I guess I should mention that I'm on Windows 8.1, but that shouldn't matter since the problem is running `java -jar` specifically. – H.v.M. Mar 16 '15 at 11:12
  • Hm, are the system variables such as PATH, JAVA_HOME and such set up correctly? – Mifeet Mar 16 '15 at 11:40
  • Well, everything else works just fine so I guess so. JAVA_HOME is `C:\Program Files (x86)\Java\jdk1.8.0_40`, and Path starts with `%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;`. – H.v.M. Mar 16 '15 at 13:25
  • Then it may be worth starting a new question with your specific conditions. – Mifeet Mar 16 '15 at 13:31
  • 2
    I tried this, but Windows 10 keeps popping up "How do you want to open this?". Any solutions? – Ryan Oct 10 '17 at 00:35
  • How do we add a custom icon? And what about selecting multiple files? – Simon Baars Oct 29 '17 at 08:27
5

The best answer above didn't work for me, it just opened a new window asking me what I'd like to open it with. I found a command that works much better. Same as first answer above but slightly different command (#4): cmd /k java instead of java. It runs it in a cmd window and the file is created in the current directory of the bug report.

  1. Locate key HKEY_CLASSES_ROOT\*\shell (Create shell key if it doesn't exist)

  2. Right-click on the shell key, select New -> Key. Enter the name of the command you'd like to display in the context menu (ie. Check Bug Report).

  3. Right-click on the "Check Bug Report" key you just created and select New -> Key. Name it command.

  4. Click on the command key, double-click on the (Default) key in the right pane and enter the following command to be executed:
    cmd /k java -jar c:\PATH\Chkbugreport.jar "%1"

Mifeet
  • 12,949
  • 5
  • 60
  • 108
BlueYorker
  • 51
  • 1
  • 2
0

try add it to HKEY_CLASSES_ROOT*\shell

I use the following registry to add Notepad2 to the right-click content menu

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT*\shell\Notepad2] @="Notepad2"

[HKEY_CLASSES_ROOT*\shell\Notepad2\command] @="D:\Tools\Notepad2\Notepad2.exe %1"

zufuliu
  • 372
  • 4
  • 5