Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import java class into python #6

Open
chautuankien opened this issue Jun 16, 2023 · 1 comment
Open

How to import java class into python #6

chautuankien opened this issue Jun 16, 2023 · 1 comment

Comments

@chautuankien
Copy link

I have folder branch like below:
`.../importer/

  • xml.py
  • xml_parser folder:
    +CMXLFile.java`

I am using scyjava.jimport to import CMXLFile java class from CMXLFile.java into xml.py My code is below:

`def read_XML_file(xml_file_path):
# initialize ImageJ
ij = imagej.init()
print(f"ImageJ version: {ij.getVersion()}")
# add class path
config.add_classpath("...\Fiji.app\jars\ij-1.53t.jar")

  # xml_file = ij.io().open(xml_file_path)
  
  CXMLFile = jimport('xml_parser.CXMLFile.CXMLFile')
  print(CXMLFile)
  cxmlfile = CXMLFile()
  imp = cxmlfile.Reader(xml_file_path)
  
  return imp

`
I get the error: TypeError: Class xml_parser.CXMLFile.CXMLFile is not found
So, My question is: How to import java class into python?

@tlambert03
Copy link
Owner

This looks like an issue that might be better asked in the scyjava repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants