Update: I installed Eclipse and PyDev in Linux and my code works now. This confirms it was an issue setting up the Python/Jython paths. I would still like to know how to import ghidra.jar into jython so that I can use the command line in the future. Any help here would be greatly appreciated.
I am making a ghidra project on Linux. I am using a Ghidra jar and jython to code my application. I am adding ghidra to my path with system.path.append() and I am running my program with
jython main.py
.
My code worked with Pydev in Eclipse on Windows, but on Linux I am getting
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: java.net.MalformedURLException: unknown protocol: ghidra
when I reach ghidraProject.createProject()
. I investigated the source and I found that the error occurs when Java tries to make a url from a string. I know Ghidra has a protocol handler which should be handling the protocol "ghidra". I assume Java doesn't register the protocol handler somehow. I tried Handler.registerHandler()
with no luck.
Why is "ghidra" an unknown protocol on Linux, but the same code works (save for the PyDev environment) in Eclipse/Windows?