imagej / imagej/pyimagej

java.lang.java.lang.NoClassDefFoundError

Open
#296 11 comments 0 reactions 0 assignees View on GitHub
tech-support
Dominant language
Python
Stars
534
Forks
95
PR merge metrics
No merged PRs in 30d

Description

### The env
![image](https://github.com/imagej/pyimagej/assets/79073164/3a7ab40a-38c4-4707-95d0-179793231934)
![image](https://github.com/imagej/pyimagej/assets/79073164/bc1e7352-ff33-474b-84bf-86063492ecdc)
![image](https://github.com/imagej/pyimagej/assets/79073164/fc0d3ca7-35b9-45de-aac3-434ebe6bb1d0)
From a local installation ,run the code
```python
import imagej
ij = imagej.init('G:\\Fiji.app')

image_url = 'https://imagej.net/images/clown.jpg'
jimage = ij.io().open(image_url)

image = ij.py.from_java(jimage)

ij.py.show(image, cmap='gray')
```

### the result

```
D:\python_tool\.env\Scripts\python.exe D:\python_tool\de.py
Traceback (most recent call last):
File "ClassLoader.java", line 521, in java.lang.ClassLoader.loadClass
java.lang.java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: net.imglib2.img.basictypelongaccess.unsafe.owning.OwningFloatUnsafe
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "org.jpype.manager.TypeManager.java", line -1, in org.jpype.manager.TypeManager.findClassByName
Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\python_tool\de.py", line 3, in
ij = imagej.init('G:\\Fiji.app')
File "D:\python_tool\.env\lib\site-packages\imagej\__init__.py", line 1200, in init
success = _create_jvm(ij_dir_or_version_or_endpoint, mode, add_legacy)
File "D:\python_tool\.env\lib\site-packages\imagej\__init__.py", line 1424, in _create_jvm
sj.start_jvm()
File "D:\python_tool\.env\lib\site-packages\scyjava\_java.py", line 243, in start_jvm
callback()
File "D:\python_tool\.env\lib\site-packages\imglyb\util.py", line 26, in _java_setup
Helpers = scyjava.jimport("net.imglib2.python.Helpers")
File "D:\python_tool\.env\lib\site-packages\scyjava\_java.py", line 405, in jimport
return jpype.JClass(class_name)
File "D:\python_tool\.env\lib\site-packages\jpype\_jclass.py", line 99, in __new__
return _jpype._getClass(jc)
java.lang.java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: net/imglib2/img/basictypelongaccess/unsafe/owning/OwningFloatUnsafe
```
So I don't have the ideal to fix it

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example using imagej.init('G:\\Fiji.app'), then inspect imagej/__init__.py around init and _create_jvm, along with the scyjava and imglyb startup frames named in the traceback. Determine why the net.imglib2 class is unavailable; done means the example starts without the reported NoClassDefFoundError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.