[Insight-users] RE: WrapITK error
Zhu, Yaoyao (NIH/NLM/LHC) [C]
zhuyao at mail.nih.gov
Fri Jun 22 13:47:16 EDT 2007
Gaëtan,
I attached the CMakeList.txt file here. I built WrapITK and run a java program using java wrappers. I found the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
InsightToolkit/itkImageFileWriterJNI at
InsightToolkit.itkImageFileWriterIUC2.itkImageFileWriterIUC2_New(itkImageFileWriterIUC2.java:77)
When executing: itkImageFileWriterIUC2_Pointer writer = itkImageFileWriterIUC2.itkImageFileWriterIUC2_New();
The java program is compiled and built without any problems. Could you please let me know what is wrong.
Thanks,
Yaoyao
-----Original Message-----
From: Gaëtan Lehmann [mailto:gaetan.lehmann at jouy.inra.fr]
Sent: Friday, June 22, 2007 1:07 PM
To: Zhu, Yaoyao (NIH/NLM/LHC) [C]
Cc: Insight Users
Subject: Re: WrapITK error
Hi Yaoyao,
Can you send me a patch so I can put it in cvs ?
Thanks,
Gaëtan
Le 22 juin 07 à 16:19, Zhu, Yaoyao (NIH/NLM/LHC) [C] a écrit :
>
> Gaëtan,
>
> I think I fixed the problem by specifying -J-mx512m in
> CMakeList.txt under Wrapping/WrapITK/Java.
>
> Thanks,
>
> Yaoyao
>
> -----Original Message-----
> From: Gaëtan Lehmann [mailto:gaetan.lehmann at jouy.inra.fr]
> Sent: Friday, June 22, 2007 9:48 AM
> To: Zhu, Yaoyao (NIH/NLM/LHC) [C]
> Cc: Insight Users
> Subject: Re: WrapITK error
>
>
> Le 22 juin 07 à 15:16, Zhu, Yaoyao (NIH/NLM/LHC) [C] a écrit :
>
>> Hello, all,
>>
>> I got the following error when trying to compile WrapITK in linux
>> redhat. Could anyone know what is wrong?
>
> you don't have enough memory ?
>
> Gaëtan
>
>>
>> Thanks,
>> Yaoyao
>>
>> =====================================================================
>> =
>> =====
>> The system is out of resources.
>> Consult the following stack trace for details.
>> java.lang.OutOfMemoryError: Java heap space
>> at com.sun.tools.javac.util.Position$LineMapImpl.build
>> (Position.java:139)
>> at com.sun.tools.javac.util.Position.makeLineMap
>> (Position.java:63)
>> at com.sun.tools.javac.parser.Scanner.getLineMap
>> (Scanner.java:1105)
>> at com.sun.tools.javac.main.JavaCompiler.parse
>> (JavaCompiler.java:512)
>> at com.sun.tools.javac.main.JavaCompiler.complete
>> (JavaCompiler.java:646)
>> at com.sun.tools.javac.jvm.ClassReader.fillIn
>> (ClassReader.java:1869)
>> at com.sun.tools.javac.jvm.ClassReader.complete
>> (ClassReader.java:1777)
>> at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
>> at com.sun.tools.javac.code.Symbol$ClassSymbol.complete
>> (Symbol.java:758)
>> at com.sun.tools.javac.jvm.ClassReader.loadClass
>> (ClassReader.java:1951)
>> at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:
>> 842)
>> at com.sun.tools.javac.comp.Resolve.findGlobalType
>> (Resolve.java:901)
>> at com.sun.tools.javac.comp.Resolve.findType(Resolve.java:
>> 957)
>> at com.sun.tools.javac.comp.Resolve.findIdent(Resolve.java:
>> 986)
>> at com.sun.tools.javac.comp.Resolve.resolveIdent
>> (Resolve.java:1162)
>> at com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:1711)
>> at com.sun.tools.javac.tree.JCTree$JCIdent.accept
>> (JCTree.java:1547)
>> at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
>> at com.sun.tools.javac.comp.Attr.attribType(Attr.java:390)
>> at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:
>> 1348)
>> at com.sun.tools.javac.tree.JCTree$JCNewClass.accept
>> (JCTree.java:1257)
>> at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
>> at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
>> at com.sun.tools.javac.comp.Attr.visitAssign(Attr.java:1547)
>> at com.sun.tools.javac.tree.JCTree$JCAssign.accept
>> (JCTree.java:1342)
>> at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
>> at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:384)
>> at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1017)
>> at com.sun.tools.javac.tree.JCTree
>> $JCExpressionStatement.accept(JCTree.java:1074)
>> at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
>> at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
>> at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:413)
>> make[2]: *** [Wrapping/WrapITK/Java/InsightToolkit/BaseJava.class]
>> Error 3
>> make[1]: *** [Wrapping/WrapITK/Java/CMakeFiles/ITKJavaJar.dir/all]
>> Error 2
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
>
>
>
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
-------------- next part --------------
SUBDIRS(Tests)
MAKE_DIRECTORY(${WRAP_ITK_JAVA_DIR})
MAKE_DIRECTORY(${WRAP_ITK_JAVA_DIR}/InsightToolkit)
SET(ITK_JAVA_CLASSPATH ${WRAP_ITK_JAVA_DIR})
SET(ITK_JAVA_OUTPATH ${WRAP_ITK_JAVA_DIR})
# Relative path from InsightToolkit.jar installation to dlls.
SET(ITK_JAVA_INSTALL_DIR "/../Java-SWIG")
# a macro to create sym links on apple
MACRO(APPLE_SYMLINK Kit)
IF(APPLE)
# on mac os x, java files must have the name .jnilib
# just link them with std lib file, and install the link
# STRING(REGEX REPLACE ".dylib\$" ".jnilib" tgt "${clean_library_location}")
SET(src ${LIBRARY_OUTPUT_PATH}/lib${Kit}Java.dylib)
SET(tgt ${LIBRARY_OUTPUT_PATH}/lib${Kit}Java.jnilib)
ADD_CUSTOM_COMMAND(
OUTPUT ${tgt}
DEPENDS ${Kit}Java
COMMAND ln
ARGS -sf ${src} ${tgt}
COMMENT "Creating symbolic link for ${Kit}Java")
# installing the symlink will copy the regular file, not a symlink
# so in the install tree, we don't need to have the .dylib
WRAP_ITK_INSTALL("/lib" ${tgt})
SET(ITK_JAVA_KITS_FILES ${ITK_JAVA_KITS_FILES} ${tgt})
ENDIF(APPLE)
ENDMACRO(APPLE_SYMLINK)
IF(CMAKE_CONFIGURATION_TYPES)
SET(ITK_BASE_JAVA_FILE ${WRAP_ITK_JAVA_DIR}/${CMAKE_CFG_INTDIR}/InsightToolkit/itkbase.java)
FOREACH(config ${CMAKE_CONFIGURATION_TYPES})
SET(ITK_JAVA_BUILD_DIR ${LIBRARY_OUTPUT_PATH}/${config})
CONFIGURE_FILE(
${WrapITK_SOURCE_DIR}/Java/itkbase.java.in
${WrapITK_BINARY_DIR}/Java/${config}/InsightToolkit/itkbase.java
@ONLY IMMEDIATE
)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${config}/itk_build_tree.mark
"File next to InsightToolkit.jar to mark the build tree.\n"
)
ENDFOREACH(config)
SET(ITK_JAVA_CLASSPATH
"${ITK_JAVA_CLASSPATH}\;${WRAP_ITK_JAVA_DIR}/${CMAKE_CFG_INTDIR}")
SET(ITK_JAVA_OUTPATH "${ITK_JAVA_OUTPATH}/${CMAKE_CFG_INTDIR}")
ELSE(CMAKE_CONFIGURATION_TYPES)
SET(ITK_JAVA_BUILD_DIR ${LIBRARY_OUTPUT_PATH})
SET(ITK_BASE_JAVA_FILE ${WRAP_ITK_JAVA_DIR}/InsightToolkit/itkbase.java)
CONFIGURE_FILE(
${WrapITK_SOURCE_DIR}/Java/itkbase.java.in
${ITK_BASE_JAVA_FILE}
@ONLY IMMEDIATE
)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/itk_build_tree.mark
"File next to InsightToolkit.jar to mark the build tree.\n"
)
WRAP_ITK_INSTALL(/Java ${WRAP_ITK_JAVA_DIR}/InsightToolkit.jar )
ENDIF(CMAKE_CONFIGURATION_TYPES)
SET(ORDERING_DEP)
# iterators are not supported by java
REMOVE(java_itk_modules "${WRAP_ITK_MODULES}" Iterators)
FOREACH(Kit ${java_itk_modules})
SET(KIT_JAVACLASS_DEP_FILES)
SET(DEP_FILES ${${Kit}_JAVA_DEPENDS})
SET(KIT_JAVA_NAME ${Kit})
FOREACH(File ${DEP_FILES})
SET(FULL_JAVA_DEP_FILES ${FULL_JAVA_DEP_FILES} ${WRAP_ITK_JAVA_DIR}/InsightToolkit/${File}.java)
SET(KIT_JAVACLASS_DEP_FILES ${KIT_JAVACLASS_DEP_FILES} ${WRAP_ITK_JAVA_DIR}/InsightToolkit/${File}.class)
ADD_CUSTOM_COMMAND(
OUTPUT ${WRAP_ITK_JAVA_DIR}/InsightToolkit/${File}.class
DEPENDS ${WRAP_ITK_JAVA_DIR}/InsightToolkit/${File}.java ${WRAP_ITK_JAVA_DIR}/InsightToolkit/JavaCWD.java ${ITK_BASE_JAVA_FILE} ${ORDERING_DEP}
COMMAND ${JAVA_COMPILE}
ARGS -classpath "${ITK_JAVA_CLASSPATH}" -d "${ITK_JAVA_OUTPATH}" -J-mx512m
${WRAPPER_LIBRARY_OUTPUT_DIR}/${WRAP_ITK_JAVA_DIR}/InsightToolkit/${File}.java
COMMENT "Compile ${File}.java")
ENDFOREACH(File)
SET(FULL_JAVACLASS_DEP_FILES ${FULL_JAVACLASS_DEP_FILES} ${KIT_JAVACLASS_DEP_FILES})
SET(ITK_JAVA_KIT_LIBS ${ITK_JAVA_KIT_LIBS} ${KIT_JAVA_NAME}Java)
SET(KIT_FILE_NAME ${WRAP_ITK_JAVA_DIR}/InsightToolkit/${KIT_JAVA_NAME}Java)
ADD_CUSTOM_COMMAND(
OUTPUT ${KIT_FILE_NAME}.class
DEPENDS ${KIT_FILE_NAME}.java ${FULL_JAVA_DEP_FILES} ${ITK_BASE_JAVA_FILE} ${WRAPPER_LIBRARY_OUTPUT_DIR}/${WRAP_ITK_JAVA_DIR}/InsightToolkit/JavaCWD.java ${ORDERING_DEP}
COMMAND ${JAVA_COMPILE}
ARGS -classpath "${ITK_JAVA_CLASSPATH}" -d "${ITK_JAVA_OUTPATH}" -J-mx512m
${KIT_FILE_NAME}.java
COMMENT "Building ${KIT_FILE_NAME}.class")
SET(ITK_JAVA_KITS_FILES ${ITK_JAVA_KITS_FILES} ${KIT_FILE_NAME}.class)
SET(ORDERING_DEP ${KIT_FILE_NAME}.class)
APPLE_SYMLINK("${Kit}")
ENDFOREACH(Kit)
# symlink SwigRuntime
APPLE_SYMLINK(SwigRuntime)
IF(CMAKE_CONFIGURATION_TYPES)
ADD_CUSTOM_COMMAND(
OUTPUT ${WRAP_ITK_JAVA_DIR}/${CMAKE_CFG_INTDIR}/InsightToolkit.jar
DEPENDS ${ITK_JAVA_KITS_FILES}
COMMAND ${JAVA_ARCHIVE}
ARGS -cf ${WRAP_ITK_JAVA_DIR}/${CMAKE_CFG_INTDIR}/InsightToolkit.jar
-C ${CMAKE_CFG_INTDIR}
InsightToolkit
COMMENT "Java Archive"
)
ADD_CUSTOM_TARGET(ITKJavaJar ALL DEPENDS ${WRAP_ITK_JAVA_DIR}/${CMAKE_CFG_INTDIR}/InsightToolkit.jar)
SET(DOLLAR "$")
WRAP_ITK_INSTALL(/Java ${WRAP_ITK_JAVA_DIR}/${DOLLAR}{BUILD_TYPE}/InsightToolkit.jar)
ELSE(CMAKE_CONFIGURATION_TYPES)
ADD_CUSTOM_COMMAND(
OUTPUT ${WRAP_ITK_JAVA_DIR}/InsightToolkit.jar
DEPENDS ${ITK_JAVA_KITS_FILES} ${FULL_JAVACLASS_DEP_FILES} ${FULL_JAVA_DEP_FILES} ${WRAP_ITK_JNILIB}
COMMAND ${JAVA_ARCHIVE}
ARGS -cf ${WRAP_ITK_JAVA_DIR}/InsightToolkit.jar
InsightToolkit
COMMENT "Java Archive"
)
ADD_CUSTOM_TARGET(ITKJavaJar ALL DEPENDS ${WRAP_ITK_JAVA_DIR}/InsightToolkit.jar)
WRAP_ITK_INSTALL(/Java ${WRAP_ITK_JAVA_DIR}/InsightToolkit.jar)
ENDIF(CMAKE_CONFIGURATION_TYPES)
ADD_DEPENDENCIES(ITKJavaJar ${ITK_JAVA_KIT_LIBS} SwigRuntimeJava)
FOREACH(Kit ${WRAP_ITK_MODULES})
ADD_DEPENDENCIES(ITKJavaJar "${Kit}Java")
ENDFOREACH(Kit)
ADD_LIBRARY(ITKJavaJarDummyLibrary ITKJavaJarDummyLibrary.c)
ADD_DEPENDENCIES(ITKJavaJarDummyLibrary ITKJavaJar)
SUBDIRS(CWD)
More information about the Insight-users
mailing list