On May 27, 2012, at 6:30, Mark Finkelstein <finkel.m...@gmail.com> wrote:
> That solved it; I worked through and set up everything to work consistently > with msvc. It now compiles, but I'm having trouble finding any good jcc > examples. I tried the following: Take a look at PyLucene test cases and examples. > import jcc Not necessary. Only used for building your extension. Especially if you didn't build your extension with --shared mode. > import CMMCore3 > > vm=jcc.initVM() Use CMMCore3.initVM() instead. > vm.attachCurrentThread() Not necessary from main thread. > print vm.isCurrentThreadAttached() > > core=CMMCore3.CMMCore() # this is the jcc wrapped class > > > It prints out True, but immediately afterwards gives out the > error: RuntimeError: initVM() must be called first Because your extension isn't initialized as you didn't call initVM() on it (but on jcc instead). > Which leads me to assume that the vm intialization is not global, which > seems contrary to the description? It is global (there can only be one Java VM instantiated per process) but must be called on your extension, not jcc. Andi.. > Again, many thanks for the amazing support! > > Mark. > > On Sun, May 27, 2012 at 1:42 AM, Bill Janssen <jans...@parc.com> wrote: > >> Andi Vajda <va...@apache.org> wrote: >> >>> >>> On Sat, 26 May 2012, Mark Finkelstein wrote: >>> >>>> That solved it; apparently it wasnt using the CLASSPATH variable to get >>>> this information, but specifying it directly solved this. Hopefully >> this >>>> will be one of the last errors; after pushing forward, I found myself >>>> >>>> C:\MinGW\bin\gcc.exe -mdll -O -Wall -DPYTHON -DJCC_VER="2.13" >>>> -D_java_generics -IX:\Java16/include -IX:\Java16/include/win32 >>>> -Ibuild\_CMMCore2 -IC:\Python26\lib\site-packages\jcc\sources >>>> -IC:\Python26\include -IC:\Python26\PC -c build\_CMMCore2\CMMCore2.cpp >> -o >>>> build\temp.win32-2.6\Release\build\_cmmcore2\cmmcore2.o /EHsc >>>> /D_CRT_SECURE_NO_WARNINGS >>>> gcc: error: /EHsc: No such file or directory >>>> gcc: error: /D_CRT_SECURE_NO_WARNINGS: No such file or directory >>>> error: command 'gcc' failed with exit status 1 >>>> >>>> Perhaps this is more meant for a cygwin installation, but is there a >> way to >>>> make this work for the cmd prompt? >>> >>> You've configured JCC to work with a Microsoft Visual C++ compiler but >>> you're using gcc via MinGW. I can't help you with that configuration >>> as I don't have it but MinGW has been used with JCC before and someone >>> on this list should be able to help you. >> >> Yes, consistency is important here. Those flags (/EHsc and >> /D_CRT_SECURE_NO_WARNINGS) look like Microsoft compiler directives to >> me, and won't work with GCC. >> >> In case it's of help, this is my build script for mingw and JCC 3.x. >> I haven't tried this recently, but it should still work. >> >> Bill >> >> export JCC_ARGSEP=";" >> export JCC_JDK="$WINSTYLEJAVAHOME" >> export JCC_CFLAGS="-fno-strict-aliasing;-Wno-write-strings" >> export JCC_LFLAGS="-L${WINSTYLEJAVAHOME}\\lib;-ljvm" >> export >> JCC_INCLUDES="${WINSTYLEJAVAHOME}\\include;${WINSTYLEJAVAHOME}\\include\\win32" >> export JCC_JAVAC="${WINSTYLEJAVAHOME}\\bin\\javac.exe" >> ${python} setup.py build --compiler=mingw32 install >> --single-version-externally-managed --root /c/ --prefix="${distdir}" >> if [ -f jcc/jcc.lib ]; then >> cp -p jcc/jcc.lib "${sitepackages}/jcc/jcc.lib" >> fi >> # for 3.x compiled with MinGW GCC 4.x and "--shared", we also need two >> # GCC libraries >> if [ -f /mingw/bin/libstdc++-6.dll ]; then >> install -m 555 /mingw/bin/libstdc++-6.dll "${distdir}/bin/" >> echo "copied libstdc++-6.dll" >> fi >> if [ -f /mingw/bin/libgcc_s_dw2-1.dll ]; then >> install -m 555 /mingw/bin/libgcc_s_dw2-1.dll "${distdir}/bin/" >> echo "copied libgcc_s_dw2-1.dll" >> fi >> >> >>> >>> You might want to search the list archives, this question has come up >>> before. >>> >>> Andi.. >>> >>>> >>>> Also, so many thanks in regards to the help you've given me; I >> definitely >>>> wouldnt have been able to move forward without it. >>>> >>>> On Sat, May 26, 2012 at 6:24 PM, Andi Vajda <va...@apache.org> wrote: >>>> >>>>> >>>>> On May 26, 2012, at 1:30, Mark Finkelstein <finkel.m...@gmail.com> >> wrote: >>>>> >>>>>> Apparently the correct (I think) command is: >>>>>> >>>>>> python -m jcc.__main__ --find-jvm-dll >>>>>> >>>>>> But if I use this I get: >>>>>> >>>>>> C:\Users\avastmatey>python -m jcc.__main__ --find-jvm-dll --jar >>>>> "C:\Program >>>>>> Files\Micro-Manager-1.4\plugins\Micro-Manager\MMCoreJ.jar" >>>>>> MMCoreJ.jar path = C:\Program >>>>>> Files\Micro-Manager-1.4\plugins\Micro-Manager\MMCo >>>>>> reJ.jar >>>>>> C:\Program Files\Micro-Manager-1.4\plugins\Micro-Manager >>>>>> C:\Program Files\Micro-Manager-1.4\plugins >>>>>> C:\Program Files\Micro-Manager-1.4\plugins\mm\win32 >>>>>> C:\Program Files\Micro-Manager-1.4 >>>>>> C:\Program Files\Micro-Manager-1.4\mm\win32 >>>>>> Traceback (most recent call last): >>>>>> File "C:\Python26\Lib\runpy.py", line 122, in _run_module_as_main >>>>>> "__main__", fname, loader, pkg_name) >>>>>> File "C:\Python26\Lib\runpy.py", line 34, in _run_code >>>>>> exec code in run_globals >>>>>> File "C:\Python26\lib\site-packages\jcc\__main__.py", line 104, in >>>>>> <module> >>>>>> cpp.jcc(sys.argv) >>>>>> File "C:\Python26\lib\site-packages\jcc\cpp.py", line 632, in jcc >>>>>> generics, _dll_export) >>>>>> File "C:\Python26\lib\site-packages\jcc\cpp.py", line 766, in header >>>>>> for method in cls.getDeclaredMethods(): >>>>>> jcc.cpp.JavaError: java.lang.NoClassDefFoundError: >> org/json/JSONObject >>>>> >>>>> Where is the org.json.JSONObject class defined ? If it's not in >>>>> MMCoreJ.jar then you need to tell jcc via the --classpath flag, for >>>>> example, so that it can find it. >>>>> >>>>> Andi.. >>>>> >>>>>> Java stacktrace: >>>>>> java.lang.NoClassDefFoundError: org/json/JSONObject >>>>>> at java.lang.Class.getDeclaredMethods0(Native Method) >>>>>> at java.lang.Class.privateGetDeclaredMethods(Unknown Source) >>>>>> at java.lang.Class.getDeclaredMethods(Unknown Source) >>>>>> Caused by: java.lang.ClassNotFoundException: org.json.JSONObject >>>>>> at java.net.URLClassLoader$1.run(Unknown Source) >>>>>> at java.net.URLClassLoader$1.run(Unknown Source) >>>>>> at java.security.AccessController.doPrivileged(Native Method) >>>>>> at java.net.URLClassLoader.findClass(Unknown Source) >>>>>> at java.lang.ClassLoader.loadClass(Unknown Source) >>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) >>>>>> at java.lang.ClassLoader.loadClass(Unknown Source) >>>>>> ... 3 more >>>>>> >>>>>> I tried --package org.json, but this did not work? >>>>>> >>>>>> On Sat, May 26, 2012 at 10:09 AM, Mark Finkelstein < >>>>> finkel.m...@gmail.com>wrote: >>>>>> >>>>>>> It is at C:\Python26\Lib\site-packages\jcc.dll. I can also show you >> my >>>>>>> installation log: >>>>>>> >>>>>>> *** Installation started 2012/05/14 13:29 *** >>>>>>> Source: C:\Users\avastmatey\Downloads\JCC-2.13.win32-py2.6.exe >>>>>>> 999 Root Key: HKEY_LOCAL_MACHINE >>>>>>> 020 Reg DB Key: >>>>>>> [Software\Microsoft\Windows\CurrentVersion\Uninstall]JCC-py2.6 >>>>>>> 040 Reg DB Value: >>>>>>> >>>>> >> [Software\Microsoft\Windows\CurrentVersion\Uninstall\JCC-py2.6]DisplayName=Python >>>>>>> 2.6 JCC-2.13 >>>>>>> 040 Reg DB Value: >>>>>>> >>>>> >> [Software\Microsoft\Windows\CurrentVersion\Uninstall\JCC-py2.6]UninstallString="C:\Python26\RemoveJCC.exe" >>>>>>> -u "C:\Python26\JCC-wininst.log" >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc.dll >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\config.py >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\cpp.py >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\jcc.lib >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\python.py >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\windows.py >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\_jcc.pyd >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__init__.py >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__main__.py >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc\classes >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc\classes\org >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc\classes\org\apache >>>>>>> 100 Made Dir: >> C:\Python26\Lib\site-packages\jcc\classes\org\apache\jcc >>>>>>> 200 File Copy: >>>>>>> >>>>> >> C:\Python26\Lib\site-packages\jcc\classes\org\apache\jcc\PythonException.class >>>>>>> 200 File Copy: >>>>>>> >> C:\Python26\Lib\site-packages\jcc\classes\org\apache\jcc\PythonVM.class >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc\patches >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\patches\patch.4195 >>>>>>> 200 File Copy: >> C:\Python26\Lib\site-packages\jcc\patches\patch.43.0.6c11 >>>>>>> 200 File Copy: >> C:\Python26\Lib\site-packages\jcc\patches\patch.43.0.6c7 >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\jcc\sources >>>>>>> 200 File Copy: >> C:\Python26\Lib\site-packages\jcc\sources\functions.cpp >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\functions.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JArray.cpp >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JArray.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\jcc.cpp >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JCCEnv.cpp >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JCCEnv.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\jccfuncs.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JObject.cpp >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\JObject.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\macros.h >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\sources\types.cpp >>>>>>> 100 Made Dir: C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info >>>>>>> 200 File Copy: >>>>>>> >>>>> >> C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info\dependency_links.txt >>>>>>> 200 File Copy: >>>>>>> C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info\not-zip-safe >>>>>>> 200 File Copy: >>>>>>> C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info\PKG-INFO >>>>>>> 200 File Copy: >>>>>>> C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info\SOURCES.txt >>>>>>> 200 File Copy: >>>>>>> C:\Python26\Lib\site-packages\JCC-2.13-py2.6.egg-info\top_level.txt >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__main__.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__init__.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\windows.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\python.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\cpp.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\config.pyc >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__main__.pyo >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\__init__.pyo >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\windows.pyo >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\python.pyo >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\cpp.pyo >>>>>>> 200 File Copy: C:\Python26\Lib\site-packages\jcc\config.pyo >>>>>>> >>>>>>> I also updated my PATH to be "C:\Program Files >>>>>>> (x86)\Java\jdk1.7.0_04\bin";"C:\Program Files >>>>>>> >>>>> >> (x86)\Java\jdk1.7.0_04\lib";C:\Python26;C:\Python26\Lib\site-packages;C:\Python26\Lib\site-packages\PyQt4;"C:\Program >>>>>>> Files (x86)\MiKTeX 2.9\miktex/bin/";"C:\Program >>>>>>> Files\TortoiseSVN\bin";"C:\Program Files (x86)\CMake >>>>> 2.8\bin";"C:\Program >>>>>>> Files (x86)\Java\jdk1.7.0_04\jre\bin\client" >>>>>>> >>>>>>> Again, many thanks for the help. >>>>>>> >>>>>>> On Sat, May 26, 2012 at 9:59 AM, Andi Vajda <va...@apache.org> >> wrote: >>>>>>> >>>>>>>> >>>>>>>> On May 25, 2012, at 22:57, Mark Finkelstein <finkel.m...@gmail.com >>> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hello everyone! >>>>>>>>> >>>>>>>>> I hope this is a relevant question. I was trying to use jcc to >> create >>>>> a >>>>>>>>> wrapper for a different project's library but when I try to run >> python >>>>>>>> -m >>>>>>>>> jcc.main >>>>>>>>> I get the error C:\Python26\python.exe: DLL load failed: The >> specified >>>>>>>>> module could not be found. >>>>>>>>> I'm not sure why this is since I put the directory containing >> jcc.dll >>>>>>>> into >>>>>>>>> my PATH. I am not sure if it will help, but the following is my >> PATH: >>>>>>>>> >>>>>>>> >>>>> >> C:\Python26;C:\Python26\Lib\site-packages;C:\Python26\Lib\site-packages\PyQt4;"C:\Program >>>>>>>>> Files (x86)\MiKTeX 2.9\miktex/bin/";"C:\Program >>>>>>>>> Files\TortoiseSVN\bin";"C:\Program Files (x86)\CMake >>>>>>>> 2.8\bin";"C:\Program >>>>>>>>> Files (x86)\Java\jdk1.7.0_04\jre\bin\client" >>>>>>>> >>>>>>>> I don't think jcc.dll is likely to be in any of the directories of >> the >>>>>>>> PATH you show. What is the full path of the directory containing >>>>> jcc.dll on >>>>>>>> your system ? >>>>>>>> >>>>>>>> Andi.. >>>>>>>> >>>>>>>>> >>>>>>>>> Any help would be very much appreciated. >>>>>>>>> >>>>>>>>> Thank you in advance, >>>>>>>>> >>>>>>>>> Mark. >>>>>>>> >>>>>>> >>>>>>> >>>>> >>>> >>