简体   繁体   中英

Get FilePath of Windows Explorer Context Menu (Right-click menu) to Java

let's suppose that I have created and added a new entry to the Windows explorer right-click menu (context menu) by adding a registry entry that points to a .exe written in C++ that just reads and returns the filename of the clicked file.

Is it possible to get this filename to an already running Java app?

I thought of using JNI but is it possible to call a method of an already running Java app from a native C++ program?

Does anybody have another idea how to solve this? Is it possible to have a pure Java solution?

Many thanks.

Edit: Is it possible to call an existing method of an already running JVM? Then I could create a C++ program that listen for right-clicks and register that .exe with a registry entry for the contextmenu. Inside the C++ program, I could call a dll that injects into an already running JVM. The dll could call a Java method and commits the clicked filepath to Java. Would that be a possibility?

You could connect to an already running Java program through a socket connection, or store values to a database of some kind that both your C++ application and Java application can access.

Besides my suggestions, here's a stackoverflow post that talks about communicating to a Java program already running without the Java program making the initial communication .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM