JNI_CreateJavaVM method crashed

I m trying to Invoke Java from Cpp code for a certain application.
I m using JDK 1.5
Please Help me in sorting out the problem.
Thank u in advance
I m posting the sample code which i tried
#include "jni.h"
#include <dlfcn.h>
#include <link.h>
#include <iostream>
using namespace std;
void *g_handle_open = NULL;
JavaVM *g_Jvm     = NULL;     
typedef int (JNICALL JCF_CREATE_JAVA_VM)(JavaVM *, void **, JavaVMInitArgs *);
struct JCFJAVA
JNIEnv *env;          // JNI interface pointer
jclass jclsClass;     // Java class object
jmethodID jmid;          // Method ID
jobjectArray jObjArgs; // JavaVM option
jint jnReturnFlag;          // Return value of method of Java
main()
int ret_jvmInvoke =0;
JCFJAVA *r_stobject;
JavaVMInitArgs stVM_args;
JavaVMOption stJVMPptions[1] =
     {   NULL,                              
char pszJvm_path[]="/opt/jp1imm/bin/jre/lib/sparc/client/libjvm.so";
// libjvm.so is present in the above mentioned in the path
g_handle_open = dlopen(pszJvm_path, RTLD_LAZY);
if (g_handle_open == NULL)
cout << "g_handle_open NULL" << endl;
JCF_CREATE_JAVA_VM jcfJNICreateJavaVM = (JCF_CREATE_JAVA_VM) dlsym(g_handle_open,"JNI_CreateJavaVM");
stJVMPptions[0].optionString = "-XX:+AllowUserSignalHandlers";
stVM_args.nOptions = 1;
stVM_args.version = JNI_VERSION_1_4;
stVM_args.options = stJVMPptions;
stVM_args.ignoreUnrecognized = JNI_TRUE;
ret_jvmInvoke = jcfJNICreateJavaVM(&g_Jvm, (void**)&(r_stobject->env), &stVM_args);
cout << ret_jvmInvoke << endl;
Error Message
bash-2.05b# ./a.out
# An unexpected error has been detected by HotSpot Virtual Machine:
# SIGSEGV (0xb) at pc=0x00000000, pid=18759, tid=1
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b05 mixed mode, sharing)
# Problematic frame:
[error occurred during error reporting, step 60, id 0xb]
# An error report file with more information is saved as hs_err_pid18759.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
Abort (core dumped)
Core Details
ash-2.05b# pstack core
core 'core' of 18752: ./a.out
ff03cdcc lwpkill (6, 0, ff0219cc, 42844, ff064224, 6) + 8
fefbdd58 abort (416d8, 1, fecbe7cc, a65d0, ff067218, 0) + 110
febb93f4 __1cCosFabort6Fi_v_ (1, 4e44, fec5c, 1d6, fecb8000, 4c00) + 58
fec322f8 __1cHVMErrorOreport_and_die6M_v_ (0, fecd5f20, 4000, febbcaf4, fec381e2, febbcaf4) + c6c
fec326dc __1cNcrash_handler6FipnHsiginfo_pv_v_ (b, 0, ffbfd1e8, 1, ffbfd56d, ffbfd571) + 44
ff03bee4 __sighndlr (b, 0, ffbfd1e8, fec32698, 0, 1) + c
ff031318 call_user_handler (b, ffbffeff, 4, ffff, ff3a2000, ffbfd1e8) + 3b8
fec0b150 __1cIUniverseIprint_on6FpnMoutputStream__v_ (0, ffbfd770, 3d68, acee8, 0, 3c00) + 44
fec31494 __1cHVMErrorGreport6MpnMoutputStream__v_ (ffbfd770, be, ffbfe840, 1, feca2ce8, 7d0) + aac
fec31c3c __1cHVMErrorOreport_and_die6M_v_ (ffbfd840, fecd5f20, fecd5f58, 0, 4000, ffbfe840) + 5b0
fec326dc __1cNcrash_handler6FipnHsiginfo_pv_v_ (b, 0, ffbfd9d8, 1, 0, 0) + 44
ff03bee4 __sighndlr (b, 0, ffbfd9d8, fec32698, 0, 1) + c
ff031318 call_user_handler (b, ffbffeff, 4, ffff, ff3a2000, ffbfd9d8) + 3b8
fea9acb4 __1cFframeOprint_on_error6kMpnMoutputStream_pcii_v_ (ffbfdf68, feccd77c, fecdea28, 7d0, ffbfdef0, 0) + 38
fec30c60 __1cHVMErrorGreport6MpnMoutputStream__v_ (ffbfdf68, 0, ffbfe840, feca6ac1, feca2ce8, 7d0) + 278
fec31c3c __1cHVMErrorOreport_and_die6M_v_ (ffbfe038, fecd5f20, fecd5f58, 4028, 5, ffbfe840) + 5b0
fec326dc __1cNcrash_handler6FipnHsiginfo_pv_v_ (b, 0, ffbfe1d0, 1, 0, 0) + 44
ff03bee4 __sighndlr (b, 0, ffbfe1d0, fec32698, 0, 1) + c
ff031318 call_user_handler (b, ffbffeff, 4, ffff, ff3a2000, ffbfe1d0) + 3b8
fea9acb4 __1cFframeOprint_on_error6kMpnMoutputStream_pcii_v_ (ffbfe798, feccd77c, fecdea28, 7d0, ffbfe6e8, 0) + 38
fec30c60 __1cHVMErrorGreport6MpnMoutputStream__v_ (ffbfe798, 0, ffbfe840, feca6ac1, feca2ce8, 7d0) + 278
fec31a74 __1cHVMErrorOreport_and_die6M_v_ (ffbfe840, fecd5f20, 0, 0, 5834, 0) + 3e8
fe9ff2f0 JVM_handle_solaris_signal (b, ffbfecc0, ffbfea08, 5000, 4, 439b0) + 9e8
ff03bee4 __sighndlr (b, ffbfecc0, ffbfea08, fe9fe8e8, 0, 1) + c
ff031318 call_user_handler (b, ffbffeff, c, 0, ff3a2000, ffbfea08) + 3b8
00000000 ???????? (445b8, 45698, fdc7d5a3, 45324c, 0, fdcb8000) + ffffffff00fcf0a0
fd86e8ec JVM_RawMonitorCreate (5a24, 44976c, fe7b0224, 5800, fdcb8000, 445b8) + 64
fe7a219c ???????? (0, 190, 0, fe7b0000, de98, 0) + f33914
fe7a1e38 ???????? (ffbff3a8, ffbff39c, 0, 0, 0, 6224) + f335b0
fe7a1dfc ZIP_Open (ffbff3a8, ffbff39c, 43f78, fecd36e4, 4a68, 43f70) + 14
fe86e6cc __1cLClassLoaderXcreate_class_path_entry6FpcnEstat_ppnOClassPathEntry__v_ (21b20, fed82140, ffbff894, fecc7fd4, 178c, 5c10) + 25c
fe86e290 __1cLClassLoaderbBsetup_bootstrap_search_path6F_v_ (e8, 449e74, fe86da70, ffbff898, fecb8000, 0) + 110
fe86d908 __1cLClassLoaderKinitialize6F_v_ (feccb4c0, 0, ffbff984, fecc7ff8, fec60754, b) + 184
fe867420 __1cMinit_globals6F_i_ (ffbffb10, 439b0, 43f78, 0, 0, 43f70) + 1c
fe859d78 __1cHThreadsJcreate_vm6FpnOJavaVMInitArgs_pi_i_ (38c, ffbffbcc, 439b0, fec9b671, 7f92e3, 7f9d10) + 454
fe8596f4 JNI_CreateJavaVM (216e4, ff3a0740, ffbffcb4, 1, 21404, 45e9ac) + ac
00011190 main (1, ffbffd34, ffbffd3c, 21400, 0, ff3a0740) + e8
00010c78 _start   (0, 0, 0, 0, 0, 0) + 108                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

marko999,
I'm trying to do the same thing your doing. Here is my C code...
#include <stdio.h>
#include <jni.h>
#ifdef _WIN32
#define PATH_SEPARATOR ';'
#else
#define PATH_SEPARATOR ':'
#endif
int main()
JavaVMOption options[1];
JNIEnv *env;
JavaVM *jvm;
JavaVMInitArgs vm_args;
long status;
jclass cls;
jmethodID mid;
jint square;
jboolean not;
options[0].optionString = "-Djava.class.path=.";
memset(&vm_args, 0, sizeof(vm_args));
vm_args.version = JNI_VERSION_1_4;
vm_args.nOptions = 1;
vm_args.options = options;
status = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
Here is the command I'm using to compiling the code:
gcc -I/usr/java/include/
-I/usr/java/include/solaris
-L/usr/java/jre/lib/sparc/client/libjvm.so
Sample2.c -o Sample2
When I try to compile, I keep getting this error:
bash-2.03$ gcc -I/usr/java/include/ -I/usr/java/include/solaris -L/usr/java/jre/lib/sparc/client/libjvm.so Sample2.c -o Sample2
Undefined first referenced
symbol in file
JNI_CreateJavaVM /var/tmp/ccZPapf2.o
ld: fatal: Symbol referencing errors. No output written to Sample2
collect2: ld returned 1 exit status
Whats the command you used compile your c code?
Thanks for your advise

Similar Messages

  • Webutil_c_api with user32.dll (ShowWindow method) crashes

    Hello,
    I am trying to hide a window by using the method ShowWindow of user32.dll.
    So I use the package webutil_c_api.
    It works, my window becomes hidden, but just after that, the Forms applet crashes with Internet Explorer.
    Here is the code :
    declare
         v_args webutil_c_api.ParameterList;
         v_param webutil_c_api.ParameterHandle;
         v_res pls_integer;
    begin
      v_args := webutil_c_api.create_parameter_list;
      v_param := webutil_c_api.add_parameter(v_args, webutil_c_api.C_LONG, webutil_c_api.PARAM_IN, 66152);
      v_param := webutil_c_api.add_parameter(v_args, webutil_c_api.C_INT, webutil_c_api.PARAM_IN, 0);
      v_res := webutil_c_api.invoke_long('user32.dll', 'ShowWindow', v_args);
      MESSAGE('ShowWindow -> ' || v_res);
    EXCEPTION
         WHEN OTHERS THEN
           message('Error code: '||to_char(sqlcode)||'  Txt: '||sqlerrm);
           PAUSE;
           raise form_trigger_failure;
    end;Notice : I had to hardcode the Window Handler 66152 because I'm not able to find it (there is another problem).
    Do you have some hints?
    Thanks,
    Nicolas.

    When it crashes, it produces a file that is placed on my desktop :
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x2
    Function name=(N/A)
    Library=(N/A)
    NOTE: We are unable to locate the function name symbol for the error
          just occurred. Please refer to release documentation for possible
          reason and solutions.
    Current Java thread:
         at oracle.forms.webutil.cApi.CFunc.callInt(Native Method)
         at oracle.forms.webutil.cApi.CApiFunctions.invokeCApi(CApiFunctions.java:837)
         at oracle.forms.webutil.cApi.CApiFunctions.getProperty(CApiFunctions.java:144)
         at oracle.forms.handler.UICommon.onGet(Unknown Source)
         at oracle.forms.engine.Runform.onGetHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Dynamic libraries:
    0x00400000 - 0x00419000      C:\Program Files\Internet Explorer\IEXPLORE.EXE
    0x77F50000 - 0x77FF7000      C:\WINNT\System32\ntdll.dll
    0x77E60000 - 0x77F46000      C:\WINNT\system32\kernel32.dll
    0x77C10000 - 0x77C63000      C:\WINNT\system32\msvcrt.dll
    0x77D40000 - 0x77DCC000      C:\WINNT\system32\USER32.dll
    0x77C70000 - 0x77CB0000      C:\WINNT\system32\GDI32.dll
    0x77DD0000 - 0x77E5D000      C:\WINNT\system32\ADVAPI32.dll
    0x78000000 - 0x78086000      C:\WINNT\system32\RPCRT4.dll
    0x70A70000 - 0x70AD5000      C:\WINNT\system32\SHLWAPI.dll
    0x71700000 - 0x71849000      C:\WINNT\System32\SHDOCVW.dll
    0x71950000 - 0x71A34000      C:\WINNT\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
    0x773D0000 - 0x77BC2000      C:\WINNT\system32\SHELL32.dll
    0x77340000 - 0x773CB000      C:\WINNT\system32\comctl32.dll
    0x771B0000 - 0x772D1000      C:\WINNT\system32\ole32.dll
    0x74720000 - 0x74764000      C:\WINNT\System32\MSCTF.dll
    0x71500000 - 0x715FD000      C:\WINNT\System32\BROWSEUI.dll
    0x72430000 - 0x72442000      C:\WINNT\System32\browselc.dll
    0x75F40000 - 0x75F5F000      C:\WINNT\system32\appHelp.dll
    0x76FD0000 - 0x77048000      C:\WINNT\System32\CLBCATQ.DLL
    0x77120000 - 0x771AB000      C:\WINNT\system32\OLEAUT32.dll
    0x77050000 - 0x77115000      C:\WINNT\System32\COMRes.dll
    0x77C00000 - 0x77C07000      C:\WINNT\system32\VERSION.dll
    0x76670000 - 0x76757000      C:\WINNT\System32\SETUPAPI.dll
    0x5AD70000 - 0x5ADA4000      C:\WINNT\System32\UxTheme.dll
    0x63000000 - 0x63096000      C:\WINNT\system32\WININET.dll
    0x762C0000 - 0x76348000      C:\WINNT\system32\CRYPT32.dll
    0x762A0000 - 0x762B0000      C:\WINNT\system32\MSASN1.dll
    0x76F90000 - 0x76FA0000      C:\WINNT\System32\Secur32.dll
    0x10000000 - 0x1012D000      c:\program files\google\googletoolbar1.dll
    0x1A400000 - 0x1A47A000      C:\WINNT\system32\urlmon.dll
    0x71AD0000 - 0x71AD8000      C:\WINNT\System32\WSOCK32.dll
    0x71AB0000 - 0x71AC5000      C:\WINNT\System32\WS2_32.dll
    0x71AA0000 - 0x71AA8000      C:\WINNT\System32\WS2HELP.dll
    0x76C30000 - 0x76C5B000      C:\WINNT\System32\WINTRUST.dll
    0x76C90000 - 0x76CB2000      C:\WINNT\system32\IMAGEHLP.dll
    0x76B40000 - 0x76B6C000      C:\WINNT\System32\WINMM.dll
    0x76380000 - 0x76385000      C:\WINNT\System32\MSIMG32.dll
    0x6D510000 - 0x6D58D000      C:\WINNT\System32\DBGHELP.DLL
    0x71C20000 - 0x71C6E000      C:\WINNT\System32\netapi32.dll
    0x71B20000 - 0x71B31000      C:\WINNT\system32\MPR.dll
    0x75F60000 - 0x75F66000      C:\WINNT\System32\drprov.dll
    0x71C10000 - 0x71C1D000      C:\WINNT\System32\ntlanman.dll
    0x71CD0000 - 0x71CE6000      C:\WINNT\System32\NETUI0.dll
    0x71C90000 - 0x71CCC000      C:\WINNT\System32\NETUI1.dll
    0x71C80000 - 0x71C86000      C:\WINNT\System32\NETRAP.dll
    0x71BF0000 - 0x71C01000      C:\WINNT\System32\SAMLIB.dll
    0x76EE0000 - 0x76F17000      C:\WINNT\System32\RASAPI32.DLL
    0x76E90000 - 0x76EA1000      C:\WINNT\System32\rasman.dll
    0x76EB0000 - 0x76EDB000      C:\WINNT\System32\TAPI32.dll
    0x76E80000 - 0x76E8D000      C:\WINNT\System32\rtutils.dll
    0x75F70000 - 0x75F79000      C:\WINNT\System32\davclnt.dll
    0x722B0000 - 0x722B5000      C:\WINNT\System32\sensapi.dll
    0x75A70000 - 0x75B15000      C:\WINNT\system32\USERENV.dll
    0x76990000 - 0x769B4000      C:\WINNT\System32\ntshrui.dll
    0x76B20000 - 0x76B35000      C:\WINNT\System32\ATL.DLL
    0x76170000 - 0x761F8000      C:\WINNT\System32\shdoclc.dll
    0x74770000 - 0x747FF000      C:\WINNT\System32\mlang.dll
    0x63580000 - 0x63830000      C:\WINNT\System32\mshtml.dll
    0x75E90000 - 0x75F37000      C:\WINNT\System32\SXS.DLL
    0x6B700000 - 0x6B790000      C:\WINNT\System32\jscript.dll
    0x746F0000 - 0x74716000      C:\WINNT\System32\msimtf.dll
    0x746C0000 - 0x746E7000      C:\WINNT\System32\MSLS31.DLL
    0x76390000 - 0x763AC000      C:\WINNT\System32\IMM32.DLL
    0x76620000 - 0x7666E000      C:\WINNT\System32\cscui.dll
    0x76600000 - 0x7661B000      C:\WINNT\System32\CSCDLL.dll
    0x325C0000 - 0x325D2000      C:\Program Files\Office2003\OFFICE11\msohev.dll
    0x71A50000 - 0x71A8B000      C:\WINNT\system32\mswsock.dll
    0x71A90000 - 0x71A98000      C:\WINNT\System32\wshtcpip.dll
    0x76F20000 - 0x76F45000      C:\WINNT\System32\DNSAPI.dll
    0x76FB0000 - 0x76FB7000      C:\WINNT\System32\winrnr.dll
    0x76F60000 - 0x76F8C000      C:\WINNT\system32\WLDAP32.dll
    0x02C70000 - 0x02C83000      C:\Program Files\Labtec\Labtec Mouse Software\2.0\MOUDL32A.DLL
    0x76FC0000 - 0x76FC5000      C:\WINNT\System32\rasadhlp.dll
    0x6D350000 - 0x6D35D000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\npjinit13118.dll
    0x6D130000 - 0x6D15B000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\beans.ocx
    0x6D300000 - 0x6D316000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\jpishare.dll
    0x6D3F0000 - 0x6D4C7000      C:\PROGRA~1\Oracle\JINITI~1.18\bin\hotspot\jvm.dll
    0x6D220000 - 0x6D227000      C:\PROGRA~1\Oracle\JINITI~1.18\bin\hpi.dll
    0x6D380000 - 0x6D38D000      C:\PROGRA~1\Oracle\JINITI~1.18\bin\verify.dll
    0x6D250000 - 0x6D268000      C:\PROGRA~1\Oracle\JINITI~1.18\bin\java.dll
    0x6D390000 - 0x6D39D000      C:\PROGRA~1\Oracle\JINITI~1.18\bin\zip.dll
    0x6D020000 - 0x6D12B000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\awt.dll
    0x73000000 - 0x73023000      C:\WINNT\System32\WINSPOOL.DRV
    0x6D1E0000 - 0x6D21C000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\fontmanager.dll
    0x5ED00000 - 0x5EDC6000      C:\WINNT\System32\OPENGL32.dll
    0x68B20000 - 0x68B3E000      C:\WINNT\System32\GLU32.dll
    0x73760000 - 0x737A4000      C:\WINNT\System32\DDRAW.dll
    0x73BC0000 - 0x73BC6000      C:\WINNT\System32\DCIMAN32.dll
    0x0DD70000 - 0x0DFA2000      C:\WINNT\System32\ialmgicd.dll
    0x0DFB0000 - 0x0E02B000      C:\WINNT\System32\ialmgdev.dll
    0x6D340000 - 0x6D348000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\net.dll
    0x0FFA0000 - 0x0FFC1000      C:\WINNT\System32\dssenh.dll
    0x6D370000 - 0x6D37A000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\packager.dll
    0x0E860000 - 0x0E870000      C:\Program Files\Oracle\JInitiator 1.3.1.18\bin\JNIsharedstubs.dll
    0x76BF0000 - 0x76BFB000      C:\WINNT\System32\PSAPI.DLL
    Local Time = Tue Aug 29 08:53:29 2006
    Elapsed Time = 4
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.3.1_04-b02 mixed mode)
    #

  • Facing problem during invoking JNI_CreateJavaVM()  method

    Hi,
    I am stucking in this problem, the method returns -1. So I am not able to resolve this problem. I am using j2sdk1.4.2_14 and and using VC++6.0 for creatinf exe
    Any help will be appreciated.
    Rgds
    ojak
         #include <jni.h>
         #include <windows.h>
         #define PATH_SEPARATOR ';'
    //     #define USER_CLASSPATH "C:\\ojak\\JNIEXAMPLES\\attachThread\\" /* where Prog.class is */
    //     #define USER_CLASSPATH "." /* where Prog.class is */
         void main() {
         JNIEnv *env;
         //JavaVM jvm = (JavaVM )0;
              //JNIEnv *env=0;
         JavaVM *jvm=0;
         jint res;
         jclass cls;
         jmethodID mid;
         jstring jstr;
         jobjectArray args;
         HINSTANCE hVM = NULL;
         JavaVMInitArgs vm_args;
         JavaVMOption options[4];
         printf("\noptions");
         options[1].optionString = "-Djava.class.path=c:\\j2sdk1.4.2_14\\jre\\lib\\rt.jar;C:\\ojak\\JNIEXAMPLES\\attachThread"; /* user classes */
    //     options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_14\\lib\\jvm.lib"; /* set native library path */
         options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_14\\jre\\bin\\client\\jvm.dll"; /* set native library path */
         options[0].optionString = "-Djava.compiler=NONE";
         //options[1].optionString = "-Djava.class.path=c:\\My Folder"; /* user classes */
         //options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_04\\include";
         options[3].optionString = "-verbose:jni";
         printf("%s\n",options[0].optionString);
         printf("%s\n",options[1].optionString);
         printf("%s\n",options[2].optionString);
         printf("%s\n",options[3].optionString);
         hVM = LoadLibrary("C:\\j2sdk1.4.2_14\\jre\\bin\\client\\jvm.dll");
         printf("\nversion info");
         //vm_args.version = JNI_VERSION_1_4;
         vm_args.version = JNI_VERSION_1_2;
         vm_args.options = options;
         vm_args.nOptions = 4;
         vm_args.ignoreUnrecognized = JNI_FALSE;
         printf("\ncreate\n");
         if (hVM == NULL)
         printf("hVM is null ");
         if(jvm==NULL)
         printf(" It has not value\n");
         else
              printf("It contains value\n");
         res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
    if(jvm==NULL)
              printf("JVM is null\n");
         if(env==NULL)
              printf("ENV is null\n");
         if (res < 0) {
         fprintf(stderr, "Can't create Java VM \n",res);
         exit(1);
         cls = env->FindClass("HelloWorld");
         //cls = env.FindClass(env,"helloWorldClass");
         if (cls == 0) {
         fprintf(stderr, "Can't find Prog class\n");
         exit(1);
         mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
         if (mid == 0) {
         fprintf(stderr, "Can't find Prog.main\n");
         exit(1);
         jstr = env->NewStringUTF(" from C!");
         if (jstr == 0) {
         fprintf(stderr, "Out of memory\n");
         exit(1);
         args = env->NewObjectArray(1, (*env).FindClass("java/lang/String"), jstr);
         if (args == 0) {
         fprintf(stderr, "Out of memory\n");
         exit(1);
         env->CallStaticVoidMethod(cls, mid, args);
         jvm->DestroyJavaVM();

    Hi,
    I am stucking in this problem, the method returns -1. So I am not able to resolve this problem. I am using j2sdk1.4.2_14 and and using VC++6.0 for creatinf exe
    Any help will be appreciated.
    Rgds
    ojak
         #include <jni.h>
         #include <windows.h>
         #define PATH_SEPARATOR ';'
    //     #define USER_CLASSPATH "C:\\ojak\\JNIEXAMPLES\\attachThread\\" /* where Prog.class is */
    //     #define USER_CLASSPATH "." /* where Prog.class is */
         void main() {
         JNIEnv *env;
         //JavaVM jvm = (JavaVM )0;
              //JNIEnv *env=0;
         JavaVM *jvm=0;
         jint res;
         jclass cls;
         jmethodID mid;
         jstring jstr;
         jobjectArray args;
         HINSTANCE hVM = NULL;
         JavaVMInitArgs vm_args;
         JavaVMOption options[4];
         printf("\noptions");
         options[1].optionString = "-Djava.class.path=c:\\j2sdk1.4.2_14\\jre\\lib\\rt.jar;C:\\ojak\\JNIEXAMPLES\\attachThread"; /* user classes */
    //     options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_14\\lib\\jvm.lib"; /* set native library path */
         options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_14\\jre\\bin\\client\\jvm.dll"; /* set native library path */
         options[0].optionString = "-Djava.compiler=NONE";
         //options[1].optionString = "-Djava.class.path=c:\\My Folder"; /* user classes */
         //options[2].optionString = "-Djava.library.path=C:\\j2sdk1.4.2_04\\include";
         options[3].optionString = "-verbose:jni";
         printf("%s\n",options[0].optionString);
         printf("%s\n",options[1].optionString);
         printf("%s\n",options[2].optionString);
         printf("%s\n",options[3].optionString);
         hVM = LoadLibrary("C:\\j2sdk1.4.2_14\\jre\\bin\\client\\jvm.dll");
         printf("\nversion info");
         //vm_args.version = JNI_VERSION_1_4;
         vm_args.version = JNI_VERSION_1_2;
         vm_args.options = options;
         vm_args.nOptions = 4;
         vm_args.ignoreUnrecognized = JNI_FALSE;
         printf("\ncreate\n");
         if (hVM == NULL)
         printf("hVM is null ");
         if(jvm==NULL)
         printf(" It has not value\n");
         else
              printf("It contains value\n");
         res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
    if(jvm==NULL)
              printf("JVM is null\n");
         if(env==NULL)
              printf("ENV is null\n");
         if (res < 0) {
         fprintf(stderr, "Can't create Java VM \n",res);
         exit(1);
         cls = env->FindClass("HelloWorld");
         //cls = env.FindClass(env,"helloWorldClass");
         if (cls == 0) {
         fprintf(stderr, "Can't find Prog class\n");
         exit(1);
         mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
         if (mid == 0) {
         fprintf(stderr, "Can't find Prog.main\n");
         exit(1);
         jstr = env->NewStringUTF(" from C!");
         if (jstr == 0) {
         fprintf(stderr, "Out of memory\n");
         exit(1);
         args = env->NewObjectArray(1, (*env).FindClass("java/lang/String"), jstr);
         if (args == 0) {
         fprintf(stderr, "Out of memory\n");
         exit(1);
         env->CallStaticVoidMethod(cls, mid, args);
         jvm->DestroyJavaVM();

  • Why does using a static jclass variable within a method crash the JVM?

    I have some native code, that in a single thread, loops over a Java method. To improve performance, I tried this:
        static jclass clazz = env->FindClass("foo");
        /*FIXME: GetStaticMethodID crashes with "Bad global or local reference"*/
        jmethodID mid = env->GetStaticMethodID(clazz, "makeEvent", sig);But with the static declaration of clazz, the JVM crashes on the second iteration. Why? Is this really any different then using a C++ member field ?
    My loop is really a bit more complicated then this, in that it starts several calls up. I hate the idea of
    A) actually calling FindClass every iteration.
    B) passing the clazz pointer through 3 layers of calls, just to avoid calling FindClass
    Is there a better way?
    Thanks!

    Well I tried this, and it does not compile, becuase NewGlobalRef returns jobject not jclass.
    Yes "jclass" is a pointer to a c++ object jclass, and jclass extends _object. However,
    static jclass myGlobalRef dynamic_cast<jclass>( NewGlobalRef (myJClass));Does not compile either. The error is
    error C2683: 'dynamic_cast' : '_jobject' is not a polymorphic type
    static jclass myGlobalRef static_cast<jclass>( NewGlobalRef (myJClass));
    DOES compile, but it is very dangerous. And using static_cast when dynamic_cast fails is a super-bad idea.
    Just for laughs, I tried it anyway, and when I use -Xcheck:jni, the JVM dies with a fatal error.
    Edited by: charlweed on Sep 19, 2009 3:56 PM
    Typo

  • After AttachCurrentThread: Calling back to Java method crashes JVM

    Hi,
    so I managed to get my multithreaded native code being invoked from a Java program.
    However, as soon as I try to invoke a Java callback from native code not running in the main thread, the program segfaults. Here's my code:
    // in the main thread, I store a pointer to the JVM that invokes this code
        if (env->GetJavaVM(&jvm) < 0) {
            std::cerr << "JNI ERROR: Failed getting reference to Java VM" << std::endl;
            return;
        assert (jvm != NULL);
    // in some other concurrently running (native) thread:
        JNIEnv *env;
        if (jvm->AttachCurrentThread((void**)&env, NULL) != JNI_OK) {
            std::cerr << "ERROR: Could not attach event thread to JVM" << std::endl;
            return;
        assert (env != NULL);
        assert (connector != NULL);
        assert (focusEventCallback != NULL);
        // the following line segfaults
        env->CallVoidMethod(connector, focusEventCallback);"connector" is a POJO, focusEventCallback the jmethodID referencing the Java callback.
    Am I missing something?
    Thanks in advance,
    Matthias

    jschell wrote:
    What do you mean by that? I get this reference in the main thread in JNI_OnLoad and I use it in another thread. So I use it across thread boundaries. Is that what you mean?Generally not a good idea.So what do you suggest?
    Getting that reference inside the thread where I use it didn't work, because the class lookup failed (ClassNotFoundException).Which means your code was wrong, not that it wouldn't work.So, what in particular was wrong about my code? Here is the section of the code that did not work, because the class lookup failed:
        JNIEnv *env = NULL;
        // "import" the native user level thread as a Java thread in the JVM
        if (jvm->AttachCurrentThread((void**)&env, NULL) != JNI_OK) {
            std::cerr << "JNI ERROR: Could not attach X11 event thread to JVM" << std::endl;
            return;
        jclass connectorClass = env->FindClass("de/dfki/km/mydesk/nativeInterfaces/linux/NetWmConnector");
        if (env->ExceptionOccurred()) {
            env->ExceptionDescribe(); // will output ClassNotFoundException
        }The same code works inside JNI_OnLoad.
    Well, an assertion is supposed to do that: Terminate the program if there is a condition that would stop the program from operating properly. The crashes I was talking about are segmentation faults. A failing assertion is not a crash, it will just terminate the program with an "assertion failed" message.You are not writing a C/C++ app. You are running some code in a shared library that is run from a VM.
    Very different.
    I haven't tried it but I am rather certain that if you cause an assertion failure that you are going to see a crash. So far as I know the only exit mechanism that doesn't cause the VM to crash explicitly is a system exit call. And that probably shouldn't be used either (not normally.)Well, as far as I know, assert() sends an abort signal and terminates the process (which is the VM in this case). I probably overused assertions in that I used them to probe for runtime errors, not for programming errors. I'll remove them from the retail code anyway, so for now, it's just fine that the program terminates if something goes wrong. It helps locating the offending LOC.

  • Create method crashing

    Hi all,
    I trying to build a small spread sheet application as a midlet. everything went well till I tried to do some file access. "NOTE I use the sony-ericcson SDK " I am trying to create a file. below is my code. I always get YOU HAVE NO ACCESS. that means that the FileConnection cannot write to it. any ideas?
        public void showFile(String fileName) {
           try {
               FileConnection fc = (FileConnection)
                                   Connector.open("file:///root1/1.txt");
               if(fc1.exists()){System.out.println("IT EXISTS");}
               if(fc.canWrite()){System.out.println("YES CAN WRITE");
                   if (!fc.exists())
                       fc.create();  // create the file if it doesn't exist
                   fc.close();
          }else
               System.out.println("YOU HAVE NO ACCESS");
           } catch (Exception e) {System.out.println("1654388635");
               e.printStackTrace();
        }

    Hi.
    public boolean canWrite()
    Checks if the file or directory is writable. This method checks the attributes associated with a file or directory by the underlying file system. Some file systems may not support associating a write attribute with a file, in which case this method returns true.
    Returns:
    true if the connection's target exists, is accessible, and is writable, otherwise false.
    So, function canWrite() checks that "1.txt" is writable, etc. Try to create the "1.txt" file and then lunch youre code. It works :) There are different ways to create a file.
    See the JSR-75 for more info.

  • What is happening in InputStream.Skip method?

    Hi,
    I need to read inputstream on Nokia 9500 under special circumstances, but the read method crashes because of a nokia implementation bug*. Interrestingly the skip method works correctly. According to MIDP2 API:
    The skip method of InputStream creates a byte array and then repeatedly reads into it until n bytes have been read or the end of the stream has been reached. Subclasses are encouraged to provide a more efficient implementation of this method.
    If this is true the skip method manages to read the stream that I don't manage to. My question is: is it possible to check somehow what is happening exactly when the skip method is called? Is it a usual java code? Is it public?
    If yes I could copy the code from the skip method and avoid the error above.
    I would greatly appreciate any pointers in this!
    Thanks!
    �rs
    *For details please see:
    http://discussion.forum.nokia.com/fo...d.php?t=102222

    The section, which you are reffering to, describes the behaviour of the skip method from InputStream, but it's quite rare case, where the pure InputStream class is used. More likely implementation overides this method in one of the subclasses because, it's obvious, that more effective techinics can be used fir skip(). So the behavior of the read() & skip() methods is quite different.
    In any case there is no way to touch internals of skip() realization.

  • JVM crash on Debian Linux

    Hi
    I am running some simple web applications in Tomcat on a Debian Linux machine and my JVM is crashing frequently. The server load is very low.
    Mostly it is the java.net.Inet4AddressImpl.getHostByAddr(Native Method) that causes the crash but i have also seen java.lang.Thread.start(Native Method) crash. The library /lib/tls/libc.so.6 is always involved.
    Configuration:
    J2SE v 1.4.2_07-b05 SDK
    GNU/Linux 2.6.11.2 Debian Sarge
    Tomcat 5.0.30
    I would be very thankful if someone could help me out with this!
    Here is the error log:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0xB7F25604
    Function=memchr+0x104
    Library=/lib/tls/libc.so.6
    Current Java thread:
    at java.net.Inet4AddressImpl.getHostByAddr(Native Method)
    at java.net.InetAddress$1.getHostByAddr(InetAddress.java:774)
    at java.net.InetAddress.getHostFromNameService(InetAddress.java:464)
    at java.net.InetAddress.getHostName(InetAddress.java:407)
    at java.net.InetAddress.getHostName(InetAddress.java:379)
    at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:1011)
    at org.apache.coyote.Request.action(Request.java:367)
    at org.apache.coyote.tomcat5.CoyoteRequest.getRemoteHost(CoyoteRequest.java:1226)
    at org.apache.coyote.tomcat5.CoyoteRequestFacade.getRemoteHost(CoyoteRequestFacade.java:346)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:557)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:534)
    Dynamic libraries:
    08048000-0804f000 r-xp 00000000 08:05 339473 /usr/java/jakarta-tomcat-5.0.30/bin/jsvc
    0804f000-08050000 rw-p 00006000 08:05 339473 /usr/java/jakarta-tomcat-5.0.30/bin/jsvc
    9d2d2000-9d38c000 r-xp 00000000 08:05 337392 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libfontmanager.so
    9d38c000-9d3a7000 rw-p 000b9000 08:05 337392 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libfontmanager.so
    9d3e9000-9d3fd000 r-xp 00000000 08:05 562292 /usr/X11R6/lib/libICE.so.6.3
    9d3fd000-9d3fe000 rw-p 00013000 08:05 562292 /usr/X11R6/lib/libICE.so.6.3
    9d400000-9d408000 r-xp 00000000 08:05 562247 /usr/X11R6/lib/libSM.so.6.0
    9d408000-9d409000 rw-p 00007000 08:05 562247 /usr/X11R6/lib/libSM.so.6.0
    9d409000-9d4cd000 r-xp 00000000 08:05 562279 /usr/X11R6/lib/libX11.so.6.2
    9d4cd000-9d4d0000 rw-p 000c4000 08:05 562279 /usr/X11R6/lib/libX11.so.6.2
    9d4d0000-9d4d4000 r-xp 00000000 08:05 562290 /usr/X11R6/lib/libXtst.so.6.1
    9d4d4000-9d4d5000 rw-p 00004000 08:05 562290 /usr/X11R6/lib/libXtst.so.6.1
    9d4d5000-9d4e2000 r-xp 00000000 08:05 562741 /usr/X11R6/lib/libXext.so.6.4
    9d4e2000-9d4e3000 rw-p 0000c000 08:05 562741 /usr/X11R6/lib/libXext.so.6.4
    9d4e3000-9d530000 r-xp 00000000 08:05 562249 /usr/X11R6/lib/libXt.so.6.0
    9d530000-9d533000 rw-p 0004d000 08:05 562249 /usr/X11R6/lib/libXt.so.6.0
    9d534000-9d53b000 r-xp 00000000 08:05 562262 /usr/X11R6/lib/libXp.so.6.2
    9d53b000-9d53c000 rw-p 00006000 08:05 562262 /usr/X11R6/lib/libXp.so.6.2
    9d541000-9d594000 r-xp 00000000 08:05 337388 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libmlib_image.so
    9d594000-9d595000 rw-p 00052000 08:05 337388 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libmlib_image.so
    9d595000-9d866000 r-xp 00000000 08:05 337389 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libawt.so
    9d866000-9d87c000 rw-p 002d0000 08:05 337389 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libawt.so
    9d8a1000-9d8d8000 r-xp 00000000 08:05 337393 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libjpeg.so
    9d8d8000-9d8d9000 rw-p 00036000 08:05 337393 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libjpeg.so
    9d910000-9d963000 r-xp 00000000 08:05 337394 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libcmm.so
    9d963000-9d965000 rw-p 00052000 08:05 337394 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libcmm.so
    9e210000-9e21f000 r-xp 00000000 08:01 40440 /lib/tls/libresolv-2.3.2.so
    9e21f000-9e220000 rw-p 0000f000 08:01 40440 /lib/tls/libresolv-2.3.2.so
    9e222000-9e24f000 r--s 00000000 08:05 337819 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-util.jar
    9e24f000-9e253000 r--s 00000000 08:05 337818 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-jni.jar
    9e253000-9e271000 r--s 00000000 08:05 337817 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-jk2.jar
    9e271000-9e272000 r--s 00000000 08:05 337816 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-jk.jar
    9e272000-9e27f000 r--s 00000000 08:05 337815 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-http11.jar
    9e27f000-9e284000 r--s 00000000 08:05 337814 /usr/java/jakarta-tomcat-5.0.30/server/lib/tomcat-coyote.jar
    9e284000-9e28a000 r--s 00000000 08:05 337813 /usr/java/jakarta-tomcat-5.0.30/server/lib/servlets-webdav.jar
    9e28a000-9e28c000 r--s 00000000 08:05 337811 /usr/java/jakarta-tomcat-5.0.30/server/lib/servlets-invoker.jar
    9e28c000-9e292000 r--s 00000000 08:05 337810 /usr/java/jakarta-tomcat-5.0.30/server/lib/servlets-default.jar
    9e292000-9e293000 r--s 00000000 08:05 337809 /usr/java/jakarta-tomcat-5.0.30/server/lib/servlets-common.jar
    9e293000-9e294000 r--s 00000000 08:05 337807 /usr/java/jakarta-tomcat-5.0.30/server/lib/jkshm.jar
    9e294000-9e29c000 r--s 00000000 08:05 337806 /usr/java/jakarta-tomcat-5.0.30/server/lib/jkconfig.jar
    9e29c000-9e2a3000 r--s 00000000 08:05 337805 /usr/java/jakarta-tomcat-5.0.30/server/lib/jakarta-regexp-1.3.jar
    9e2a3000-9e2be000 r--s 00000000 08:05 337804 /usr/java/jakarta-tomcat-5.0.30/server/lib/commons-modeler.jar
    9e2be000-9e2c4000 r--s 00000000 08:05 337803 /usr/java/jakarta-tomcat-5.0.30/server/lib/commons-fileupload-1.0.jar
    9e2c4000-9e2df000 r--s 00000000 08:05 337802 /usr/java/jakarta-tomcat-5.0.30/server/lib/commons-digester.jar
    9e2df000-9e30e000 r--s 00000000 08:05 337801 /usr/java/jakarta-tomcat-5.0.30/server/lib/commons-beanutils.jar
    9e30e000-9e3bc000 r--s 00000000 08:05 337800 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina.jar
    9e3bc000-9e3d7000 r--s 00000000 08:05 337799 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-optional.jar
    9e3d7000-9e3dd000 r--s 00000000 08:05 337798 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-i18n-ja.jar
    9e3dd000-9e3e3000 r--s 00000000 08:05 337797 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-i18n-fr.jar
    9e3e3000-9e3e9000 r--s 00000000 08:05 337796 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-i18n-es.jar
    9e3e9000-9e408000 r--s 00000000 08:05 337795 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-cluster.jar
    9e408000-9e40d000 r--s 00000000 08:05 337794 /usr/java/jakarta-tomcat-5.0.30/server/lib/catalina-ant.jar
    9e40d000-9e41b000 r--s 00000000 08:05 404959 /usr/java/jakarta-tomcat-5.0.30/common/lib/activation.jar
    9e41b000-9e470000 r--s 00000000 08:05 405025 /usr/java/jakarta-tomcat-5.0.30/common/lib/mail.jar
    9e470000-9e473000 r--s 00000000 08:05 404902 /usr/java/jakarta-tomcat-5.0.30/common/lib/jta-spec1_0_1.jar
    9e473000-9e475000 r--s 00000000 08:05 404901 /usr/java/jakarta-tomcat-5.0.30/common/lib/jdbc2_0-stdext.jar
    9e475000-9e486000 r--s 00000000 08:05 404849 /usr/java/jakarta-tomcat-5.0.30/common/lib/mssqlserver.jar
    9e486000-9e495000 r--s 00000000 08:05 404850 /usr/java/jakarta-tomcat-5.0.30/common/lib/msutil.jar
    9e495000-9e4dc000 r--s 00000000 08:05 404848 /usr/java/jakarta-tomcat-5.0.30/common/lib/msbase.jar
    9e4dc000-9e53d000 r--s 00000000 08:05 404899 /usr/java/jakarta-tomcat-5.0.30/common/lib/mysql-connector-java-3.1.7-bin.jar
    9e53d000-9e555000 r--s 00000000 08:05 337793 /usr/java/jakarta-tomcat-5.0.30/common/lib/servlet-api.jar
    9e555000-9e560000 r--s 00000000 08:05 337792 /usr/java/jakarta-tomcat-5.0.30/common/lib/naming-resources.jar
    9e560000-9e561000 r--s 00000000 08:05 337791 /usr/java/jakarta-tomcat-5.0.30/common/lib/naming-java.jar
    9e561000-9e565000 r--s 00000000 08:05 337790 /usr/java/jakarta-tomcat-5.0.30/common/lib/naming-factory.jar
    9e565000-9e56c000 r--s 00000000 08:05 337789 /usr/java/jakarta-tomcat-5.0.30/common/lib/naming-common.jar
    9e56c000-9e579000 r--s 00000000 08:05 337788 /usr/java/jakarta-tomcat-5.0.30/common/lib/jsp-api.jar
    9e579000-9e594000 r--s 00000000 08:05 337787 /usr/java/jakarta-tomcat-5.0.30/common/lib/jasper-runtime.jar
    9e594000-9e5eb000 r--s 00000000 08:05 337786 /usr/java/jakarta-tomcat-5.0.30/common/lib/jasper-compiler.jar
    9e5eb000-9e5f6000 r--s 00000000 08:05 337785 /usr/java/jakarta-tomcat-5.0.30/common/lib/commons-pool-1.2.jar
    9e5f6000-9e612000 r--s 00000000 08:05 337784 /usr/java/jakarta-tomcat-5.0.30/common/lib/commons-el.jar
    9e612000-9e62d000 r--s 00000000 08:05 337783 /usr/java/jakarta-tomcat-5.0.30/common/lib/commons-dbcp-1.2.1.jar
    9e62d000-9e6b6000 r--s 00000000 08:05 337782 /usr/java/jakarta-tomcat-5.0.30/common/lib/commons-collections-3.1.jar
    9e6b6000-9e7ab000 r--s 00000000 08:05 337781 /usr/java/jakarta-tomcat-5.0.30/common/lib/ant.jar
    9e7ab000-9e7ae000 r--s 00000000 08:05 337780 /usr/java/jakarta-tomcat-5.0.30/common/lib/ant-launcher.jar
    9e7ae000-9e7cd000 r--s 00000000 08:05 404834 /usr/java/jakarta-tomcat-5.0.30/common/endorsed/xml-apis.jar
    9e7cd000-9e8c4000 r--s 00000000 08:05 404833 /usr/java/jakarta-tomcat-5.0.30/common/endorsed/xercesImpl.jar
    9e8c4000-9ebc5000 r--s 00000000 08:05 404841 /usr/java/jakarta-tomcat-5.0.30/common/endorsed/xalan.jar
    9ebc5000-9ebd5000 r-xp 00000000 08:05 337384 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libnet.so
    9ebd5000-9ebd6000 rw-p 0000f000 08:05 337384 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libnet.so
    9ebd6000-9ebdd000 r--s 00000000 08:05 337757 /usr/java/jakarta-tomcat-5.0.30/bin/commons-logging-api.jar
    9ebdd000-9ec31000 r--s 00000000 08:05 337763 /usr/java/jakarta-tomcat-5.0.30/bin/jmx.jar
    9ec31000-9ec39000 r--s 00000000 08:05 337750 /usr/java/jakarta-tomcat-5.0.30/bin/bootstrap.jar
    9ec39000-9ec3c000 r--s 00000000 08:05 337755 /usr/java/jakarta-tomcat-5.0.30/bin/commons-daemon.jar
    9ec3c000-9f118000 r--s 00000000 08:05 355210 /usr/java/j2sdk1.4.2_07/lib/tools.jar
    9f118000-9f1d4000 r--s 00000000 08:05 354117 /usr/java/j2sdk1.4.2_07/jre/lib/ext/localedata.jar
    9f1d4000-9f1e1000 r--s 00000000 08:05 353577 /usr/java/j2sdk1.4.2_07/jre/lib/ext/ldapsec.jar
    9f1e1000-9f1e4000 r--s 00000000 08:05 353575 /usr/java/j2sdk1.4.2_07/jre/lib/ext/dnsns.jar
    9f1e4000-9f200000 r--s 00000000 08:05 353574 /usr/java/j2sdk1.4.2_07/jre/lib/ext/sunjce_provider.jar
    9f400000-9f407000 r--p 01a81000 08:05 167297 /usr/lib/locale/locale-archive
    9f407000-9f607000 r--p 00000000 08:05 167297 /usr/lib/locale/locale-archive
    b38c2000-b38c5000 r-xp 00000000 08:01 40433 /lib/tls/libnss_dns-2.3.2.so
    b38c5000-b38c6000 rw-p 00003000 08:01 40433 /lib/tls/libnss_dns-2.3.2.so
    b5973000-b5ecc000 r--s 00000000 08:05 337449 /usr/java/j2sdk1.4.2_07/jre/lib/charsets.jar
    b5ecc000-b5edd000 r--s 00000000 08:05 337404 /usr/java/j2sdk1.4.2_07/jre/lib/jce.jar
    b5edd000-b5fba000 r--s 00000000 08:05 337448 /usr/java/j2sdk1.4.2_07/jre/lib/jsse.jar
    b5fba000-b5fd0000 r--s 00000000 08:05 337403 /usr/java/j2sdk1.4.2_07/jre/lib/sunrsasign.jar
    b601a000-b79c3000 r--s 00000000 08:05 337346 /usr/java/j2sdk1.4.2_07/jre/lib/rt.jar
    b79c3000-b79d7000 r-xp 00000000 08:05 337381 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libzip.so
    b79d7000-b79da000 rw-p 00013000 08:05 337381 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libzip.so
    b79da000-b79fa000 r-xp 00000000 08:05 337379 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libjava.so
    b79fa000-b79fc000 rw-p 0001f000 08:05 337379 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libjava.so
    b79fc000-b7a0c000 r-xp 00000000 08:05 337378 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libverify.so
    b7a0c000-b7a0e000 rw-p 0000f000 08:05 337378 /usr/java/j2sdk1.4.2_07/jre/lib/i386/libverify.so
    b7a0e000-b7a12000 rw-s 00000000 08:08 64258 /tmp/hsperfdata_tomcat/17768
    b7a12000-b7a1a000 r-xp 00000000 08:05 337367 /usr/java/j2sdk1.4.2_07/jre/lib/i386/native_threads/libhpi.so
    b7a1a000-b7a1b000 rw-p 00007000 08:05 337367 /usr/java/j2sdk1.4.2_07/jre/lib/i386/native_threads/libhpi.so
    b7a1b000-b7a27000 r-xp 00000000 08:01 40439 /lib/tls/libpthread-0.60.so
    b7a27000-b7a28000 rw-p 0000c000 08:01 40439 /lib/tls/libpthread-0.60.so
    b7a2a000-b7a4b000 r-xp 00000000 08:01 40429 /lib/tls/libm-2.3.2.so
    b7a4b000-b7a4c000 rw-p 00020000 08:01 40429 /lib/tls/libm-2.3.2.so
    b7a51000-b7e4f000 r-xp 00000000 08:05 337373 /usr/java/j2sdk1.4.2_07/jre/lib/i386/client/libjvm.so
    b7e4f000-b7e6b000 rw-p 003fd000 08:05 337373 /usr/java/j2sdk1.4.2_07/jre/lib/i386/client/libjvm.so
    b7e7d000-b7e86000 r-xp 00000000 08:01 40434 /lib/tls/libnss_files-2.3.2.so
    b7e86000-b7e87000 rw-p 00008000 08:01 40434 /lib/tls/libnss_files-2.3.2.so
    b7e87000-b7e8f000 r-xp 00000000 08:01 40436 /lib/tls/libnss_nis-2.3.2.so
    b7e8f000-b7e90000 rw-p 00007000 08:01 40436 /lib/tls/libnss_nis-2.3.2.so
    b7e90000-b7ea1000 r-xp 00000000 08:01 40431 /lib/tls/libnsl-2.3.2.so
    b7ea1000-b7ea2000 rw-p 00011000 08:01 40431 /lib/tls/libnsl-2.3.2.so
    b7ea4000-b7eab000 r-xp 00000000 08:01 40432 /lib/tls/libnss_compat-2.3.2.so
    b7eab000-b7eac000 rw-p 00006000 08:01 40432 /lib/tls/libnss_compat-2.3.2.so
    b7eac000-b7fd5000 r-xp 00000000 08:01 40426 /lib/tls/libc-2.3.2.so
    b7fd5000-b7fdd000 rw-p 00129000 08:01 40426 /lib/tls/libc-2.3.2.so
    b7fe1000-b7fe3000 r-xp 00000000 08:01 40428 /lib/tls/libdl-2.3.2.so
    b7fe3000-b7fe4000 rw-p 00002000 08:01 40428 /lib/tls/libdl-2.3.2.so
    b7fea000-b8000000 r-xp 00000000 08:01 40401 /lib/ld-2.3.2.so
    b8000000-b8001000 rw-p 00015000 08:01 40401 /lib/ld-2.3.2.so
    Heap at VM Abort:
    Heap
    def new generation total 18176K, used 8742K [0x9f8c0000, 0xa0c70000, 0xa0c70000)
    eden space 16192K, 51% used [0x9f8c0000, 0xa00eabf0, 0xa0890000)
    from space 1984K, 19% used [0xa0a80000, 0xa0adecd8, 0xa0c70000)
    to space 1984K, 0% used [0xa0890000, 0xa0890000, 0xa0a80000)
    tenured generation total 241984K, used 18638K [0xa0c70000, 0xaf8c0000, 0xaf8c0000)
    the space 241984K, 7% used [0xa0c70000, 0xa1ea3860, 0xa1ea3a00, 0xaf8c0000)
    compacting perm gen total 14592K, used 14337K [0xaf8c0000, 0xb0700000, 0xb38c0000)
    the space 14592K, 98% used [0xaf8c0000, 0xb06c07e8, 0xb06c0800, 0xb0700000)
    Local Time = Mon May 2 09:21:20 2005
    Elapsed Time = 321329
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_07-b05 mixed mode)
    #

    Hi
    Does a simple java.net.InetAddress.getHostName fail?
    How about not using NPTL? Not too familiar with linux but since u mentioned tls is always seen when using tls.
    Hope this helps.

  • Temp tables left behind by SDO_PC_PKG methods?

    I have a bunch of MDPCE tables after playing with SDO_PC_PKG last week.
    Are these temp tables left behind by SDO_PC_PKG methods? Is it safe to drop them?
    What circumstances could have left them behind, and why were they committed when the call to the PL/SQL method crashed the client program? (copy/paste error in my OCI code).
    Thanks, --DD
    SQL> select table_name from user_tables;
    TABLE_NAME
    MDPCE_1_12565$$$
    MDPCP_1_12565$$$
    MDPCE_1_125BC$$$
    MDPCP_1_125BC$$$
    MDPCE_1_12653$$$
    MDPCP_1_12653$$$
    MDPCE_1_1266A$$$
    MDPCP_1_1266A$$$
    MDPCE_1_12681$$$
    MDPCP_1_12681$$$
    MDPCE_1_12698$$$
    MDPCP_1_12698$$$
    MDPCE_1_126AF$$$
    MDPCP_1_126AF$$$
    MDPCE_1_126C6$$$
    MDPCP_1_126C6$$$
    MDPCE_1_126DD$$$
    MDPCP_1_126DD$$$
    MDPCE_1_126F4$$$
    MDPCP_1_126F4$$$
    MDPCE_1_1270B$$$
    MDPCP_1_1270B$$$
    VSET_TAB
    VSET_TAB$BLK
    VSET_POINT_TAB
    MDRT_136E4$
    SQL> desc MDPCE_1_12565$$$
    Name                                            Null?    Type
    PTN_ID                                                   NUMBER
    MIN_D1                                                   NUMBER
    MAX_D1                                                   NUMBER
    MIN_D2                                                   NUMBER
    MAX_D2                                                   NUMBER
    MIN_D3                                                   NUMBER
    MAX_D3                                                   NUMBER
    SQL>

    I tried the test on 11.2.0.4.  On that release I get an error during a rename:
    ERROR at line 1:
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13199: Invalid Parameters for Partition_Table
    ORA-13249: Stmt-Execute Failure: RENAME "MDPCI_a_26062$$$" TO "M3_A_26062$$"
    ORA-29400: data cartridge error
    ORA-04043: object MDPCI_a_26062$$$ does not exist
    ORA-06512: at "MDSYS.PRVT_PC", line 3
    ORA-06512: at "MDSYS.PRVT_PC", line 157
    ORA-06512: at "MDSYS.SDO_PC_PKG", line 74
    ORA-06512: at line 17

  • Call Java Method from Callback function

    I am writing a JNI wrapper in c++ for a particular event driven DLL. The DLL makes a network connection to another device and then calls a callback function when events are raised on the device. The DLL has 3 basic functions: connect, disconnect, and registerEventListener. RegisterEventListener takes a function pointer which is called each time an event is raised on the device.
    My wrapper DLL exposes connect and disconnect functions via JNI. I can call these functions just fine from my Java code. Now the question... How do I call a Java method from my c++ callback function? I can call a Java method using env->CallXXXMethod(...) from within a function that is accessible to Java but I don't have access to the JNI parameters in my Callback function.
    So how do I call a Java method from a callback function? If this cannot be done then what is the "right way" to handle native event notification with JNI?

    jschell wrote:
    JNI parameters? Meaning what exactly?
    General outline of a callback
    1. Entry
    2. Get the VM, env - there are methods for this
    3. Attach the thread
    4. Get a java object - how depends on what you are doing, but create it or a static reference.
    5. Get the java method
    6. Call the java method.That is exactly correct. The callback function is called from a separate thread so using a cached pointer to JNIEnv, obtained from the original native method, crashes the JVM. The jmethodID and jclass objects (which are needed to call the static Java method) can be cached without problem. The following is the code I used to attach the current thread and call my static method.
    void MyClass::onEvent(int system_id, char* data)
         //get a pointer to the Java Environment
         JNIEnv *env;
         jvm->AttachCurrentThread((void **)&env, NULL);
         //Call the Java method with the newly aquired data
         jstring js = env->NewStringUTF(data);
         env->CallStaticVoidMethod(cls, mid, system_id, js);
    }My last question is about cleanup in this function. When I use NewStringUTF to "convert" my char* to jstring do I need to do anything special to clean up or will the Java garbage collector take care of it since the jstring is being passed to a Java method?
    Thanks for you help

  • How can I live trace a hand sketch line work and cut from background to apply to new coloured backgr

    I placed a hand drawn scanned photo of artwork to illustrator cs4 in an attempt to trace the lines and remove from paper and add the line drawing to a brochure artwork. this to give illusion of an old artist's manuscript with drawings. first attempt with the psd file in trying to apply trace as a "hand drawn " method crashed illustrator. I tried again and used ink drawing which came out blotchy. Tried simple trace and got a warning that the file was too large. I'm thinking that the drawing itself is very soft and the paper around it is grainy and dim. I had tried to brighten   and lighten in the scan mode.I did get it as far as a trace at one point and used outline stroke but then couln't fill in the lines or cut it out. I have taken it to photoshop and drew a pen selection around the soft lines and used a transparent background on it, hoping to stroke it in illustrator and drag it off over to the brochure template .But didn't try it yet. I also just made the resolution 250 and the size document to 6 x 9 in approx. But now am fearful of another experiemental attempt. Am I on the right track or is there another method to bringing in a line drawing that is not defined well and getting it to trace and remove from it's background to apply onto the illustrator document being worked on. I have done placing and tracing before but not a line work. Any suggestions that won't crash my program would be welcome. As an artist I will want to do this again and again so want to know the proper method or what I am missing. I've been using illustrator for 7 months now.

    Maybe Li[ve trace] is not t]he way[ to go
    I have some suggestion one leave it as is and use a blending mode of multiply to give it a color background like this
    leave it as is make it a grayscale tiff import int Illustrator and color it it in Illustrator like this
    Or trace over it with the brush tool aand then give it a color ground.
    Or do the original over and do a cleaner job with no tone or a minimum of tone. Then Live trace.

  • What is the best way to archive large mailboxes

    I am using Mail on Mavericks 10.9.5 with my corporate mail (Exchange 2007). I am getting issues trying to archive my email, and remove it from the Exchange Server. I usually divide mail into years, e.g  mailbox for 2012, 13 etc.
    I have 2 years of mail with about 14000 messages, and I want to migrate it off. I have taken the usual steps of creating a new mail box local to my mac and moving mail this way. However, unless I pick a very small no of messages, this method crashes mail. I have tried this over a few different versions of Mail, 10.8.x and 10.9.x and I get the same result.
    Is there a way to just move the current exchange mailbox on my mac, from a live state to a archive state at the terminal or cmd line level?
    If I can do this, I will then archive that mail from the Exchange server such that I start with a fresh/empty mailbox.
    Thanks
    Niall
    13" MBAir mid 2012
    8GB Ram
    256GB Storage (156GB free).

    Hi, 
     Are you asking with regards to on-premises Exchange? With Microsoft Online SaaS services (aka Exchange Online) there is no control and no need to control which data center a mailbox resides in.
     With regard to on-premises Exchange, you have two choices: you can move it over the WAN in which case you would either do a native mailbox move (assuming you have Exchange 2010 or later you can suspend the move after the copy so you can control the
    time of the cutover) or create a database copy in the second data center and once the database copies have synchronized change the active copy.
    The other choice is to move is out of band which would usually involve an offline seed of the database (you could conceivably move via PST file but that would disrupt access to the mailbox and is not really the 'best way').
    In general, Exchange on-premises questions are best asked on the Exchange forum: http://social.technet.microsoft.com/Forums/office/en-US/home?category=exchangeserver
    Thanks,
    Guy 

  • How do I join together arcs and lines in a single Shape???

    I am out of my depth, I am probably missing something spectacular .... I need to construct a shape from arcs and lines to get something like this, only closed:
    Like a winding river sort of thing... I do not need to draw this I need to have this shape and its area available to me.... How do I join these two arcs and two lines into a shape from which I can find - area.contains(xy.getX(), xy.getY()); , preatty please?
    here is the code that causes numerous errors:
    import java.awt.*;
    import java.awt.Graphics.*;
    import java.awt.Graphics2D.*;
    import java.awt.geom.RectangularShape.*;
    import java.awt.geom.Arc2D;
    import java.awt.geom.Line2D;
    import java.awt.geom.Rectangle2D;
    import java.awt.geom.Area;
    import java.awt.geom.GeneralPath;
    class MyShapes //extends Arc2D
    public static Arc2D outerOne;
    public static Arc2D innerOne;
    public static Line2D upLine, bottomLine;
    public static Area area = new Area();
    public MyShapes(double[] upper, double [] lower)
    outerOne.setArc(upper[0], upper[1], upper[2], upper[3], upper[4], upper[5], (int)upper[6]);
    //                         x,          y,               w,          h,               OA,      AA, int OPEN =1
    innerOne.setArc(lower[0], lower[1], lower[2], lower[3], lower[4], lower[5], (int)lower[6]);
    //outerTR=this.makeClosedShape(outerTopRightArc,middleTopRightArc);
    upLine     = new Line2D.Double(outerOne.getX(),outerOne.getY(),innerOne.getX(),innerOne.getY());
    bottomLine = new Line2D.Double(outerOne.getX()+outerOne.getWidth(),outerOne.getY()+outerOne.getHeight(),innerOne.getX()+innerOne.getWidth(),innerOne.getY()+innerOne.getHeight());
    area = this.joinAll(outerOne,innerOne, upLine, bottomLine);     
    private Area joinAll(Arc2D out, Arc2D in, Line2D one, Line2D two)
    GeneralPath joiner = new GeneralPath(out);
    joiner.append(in, true);
    joiner.append(one, true);
    joiner.append(two, true);      
    Area temp = new Area(joiner);
    return temp;     
    public boolean isInArea(Point xy)
    return area.contains(xy.getX(), xy.getY());     
    public boolean isItClosed()
    return area.isSingular();     
    Thanks

    Glad to hear you find what was wrong. Still, it doesn't the main problem : why is that method crashing?
    Here is what I've done in the mean time. See if it fits your purpose.import javax.swing.*;
    import java.awt.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.geom.*;
    public class MyShapes {
         private Arc2D outerOne;
         private Arc2D innerOne;
         private Shape line1;
         private Shape line2;
         public MyShapes(double[] upper, double[] lower) {
              outerOne = new Arc2D.Double(upper[0],
                                                 upper[1],
                                                 upper[2],
                                                 upper[3],
                                                 upper[4],
                                                 upper[5],
                                                 0);
              innerOne = new Arc2D.Double(lower[0],
                                                 lower[1],
                                                 lower[2],
                                                 lower[3],
                                                 lower[4],
                                                 lower[5],
                                                 0);
              line1 = new Line2D.Double(outerOne.getStartPoint().getX(),
                                              outerOne.getStartPoint().getY(),
                                              innerOne.getStartPoint().getX(),
                                              innerOne.getStartPoint().getY());
              line2 = new Line2D.Double(outerOne.getEndPoint().getX(),
                                              outerOne.getEndPoint().getY(),
                                              innerOne.getEndPoint().getX(),
                                              innerOne.getEndPoint().getY());
         public void paint(Graphics2D aGraphics2D) {
              aGraphics2D.draw(outerOne);
              aGraphics2D.draw(innerOne);
              aGraphics2D.draw(line1);
              aGraphics2D.draw(line2);
         public static void main(String[] args) {
              double [] XO= {56, 58, 400, 280, 90, 90};// outter arc
              double [] XI={114, 105, 300, 200, 90, 90}; // inner arc
              final MyShapes myShapes = new MyShapes(XO, XI);
              JPanel panel = new JPanel() {
                   protected void paintComponent(Graphics g) {
                        super.paintComponent(g);
                        Graphics2D g2 = (Graphics2D)g;
                        myShapes.paint(g2);
              final JFrame frame = new JFrame("Test shape");
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.setContentPane(panel);
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.show();
    }

  • JVM help

    hello,
    I am trying to get the hang of this JNI and JVM stuff...killing me.
    I am trying to get a C++ application to interrupt a java program that is in idle or just have it interrupt a certain thread then I can have the java application do something.
    I've tried JNI but with that it is really tough (i think, not sure), if at all possible, to get the interruption I want...
    So, I was thinking that JVM could do something of that nature. By putting JVM in the C++ I could call the java methods i want to when I want to. I found this bit of code online and when I go to compile it it throws these errors>>
    testingJVM.obj : error LNK2001: unresolved external symbol [email protected] : error LNK2001: unresolved external symbol __imp__JNI_GetDefaultJavaVMInitArgs@4
    Debug/testingJVM.exe : fatal error LNK1120: 2 unresolved externals
    I amguessing that it can not find where the JNI_CreateJavaVM method is located or they are not linked.
    If anyone could help me I would be grateful..thanks
    //////////////Java Code/////////////////
    package jvmtester;
    public class testing {
    public testing() {
    public static void main(String[] args) {
    System.out.println("Hello World from Java!!");
    testing testing1 = new testing();
    }//end java
    ////////////////C++ CODE/////////////////
    void CTestingJVMApp::mainTest() {
    JNIEnv *env;
    JavaVM *jvm;
    JDK1_1InitArgs vm_args;
    jint res;
    jclass cls;
    jmethodID mid;
    jstring jstr;
    jobjectArray args;
    char classpath[1024];
    /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
    vm_args.version = 0x00010001;
    JNI_GetDefaultJavaVMInitArgs(&vm_args);
    /* Append USER_CLASSPATH to the end of default system class path */
    sprintf(classpath, "%s%c%s",
    vm_args.classpath, PATH_SEPARATOR, USER_CLASSPATH);
    vm_args.classpath = classpath;
    /* Create the Java VM */
    res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
    if (res < 0) {
    fprintf(stderr, "Can't create Java VM\n");
    exit(1);
    cls = env->FindClass("Prog");
    if (cls == 0) {
    fprintf(stderr, "Can't find Prog class\n");
    exit(1);
    mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
    if (mid == 0) {
    fprintf(stderr, "Can't find Prog.main\n");
    exit(1);
    jstr = env->NewStringUTF(" from C!");
    if (jstr == 0) {
    fprintf(stderr, "Out of memory\n");
    exit(1);
    args = env->NewObjectArray(1,
    env->FindClass("java/lang/String"), jstr);
    if (args == 0) {
    fprintf(stderr, "Out of memory\n");
    exit(1);
    env->CallStaticVoidMethod(cls, mid, args);
    jvm->DestroyJavaVM();

    http://java.zu5.net explains it very well

  • Flushing & Cathicng Exceptions

    Hello ABAP-Experts,
    I have a problem in understanding how to catch exceptions after calling method cl_gui_cfw=>flush.
    Why calling "flush": Well, otherwise if there is no FLUSH after directory_create (for example) is called, the value of rc (methods internal return code) is checked prematurely.
    Here my attempt:
    " Calling method directory_create
    call method cl_gui_frontend_services=>directory_create
          exporting
            directory                = tmpdir
          changing
            rc                       = returncode
          exceptions
            directory_create_failed  = 1
            cntl_error               = 2
            error_no_gui             = 3
            directory_access_denied  = 4
            directory_already_exists = 5
            path_not_found           = 6
            unknown_error            = 7
            not_supported_by_gui     = 8
            wrong_parameter          = 9
            others                   = 10.
          sy-subrc = my_sy_subrc " <=== ???!
    " Calling method flush
    call method cl_gui_cfw=>flush
      exceptions
        cntl_system_error = 1
        cntl_error        = 2
        others            = 3.
          sy-subrc = my_sy_subrc2 " <=== ???!
    Now my problem: How can I be sure to catch the execeptions of method cl_gui_frontend_services=>directory_create (1 to 10), since the flush method has its own exceptions (1 to 3)? After calling flush, I think they are overwritten by the flush exception -- checking them before the flush makes no sense, because the method is probably not executed (Automation queue).
    (Background: I am writing test-programs for some frontend methods, and want to catch all possible exceptions and to write them in a internal table, so that I can see which method crashes.)
    I hope my problem is clear and someone can clarify.
    Thanks a lot in advance
    Regards
    Jasmin

    Hi,
    You can rely on the SUBRC after calling the directory_create because the flush is already present in it
    Look at the code of the method :
    >    call method handle->call_method
    >     exporting
    >        method  = 'CreateDirectory'
    >        p1      = directory
    >        p_count = 1
    >        queue_only = ' '
    >      importing
    >        result = rc
    >      exceptions
    >        others = 1.
    >
    >    if sy-subrc <> 0.
    >      raise cntl_error.
    >    endif.
    >
    >    call method cl_gui_cfw=>flush
    >      exceptions
    >        cntl_system_error = 1
    >        cntl_error        = 2
    >        others            = 3.
    >    if sy-subrc <> 0.
    >      raise cntl_error.
    >    endif.

Maybe you are looking for

  • How to reverse PGI @ VL09 for delivery with subsequent invoice

    Greetings Our business process sometimes requires billing to happen prior to PGI. Hence, we have modified copy control settings to allow billing based off delivery creation (rather than PGI delivery). No modifications to the item categories and we ar

  • What is a trusted program for document recovery?

    Yes, I foolishly trashed and emptied a document - no backup.  I can find the file name in Word but there is no data.  Is there any program to potentially retrieve my work?  Thanks.

  • Searching the User List using cfquery

    I have a inventory web site, and I'm trying to create multiple search engine, so I have a lot of text boxes and search buttons in one page and I wanna be able to search by each category. I'm suppose to have 121 records in my database, but it shows on

  • IOS 7 on 4S - Camera problemes

    I take photos with Camera app in iOS 7 on 4S and they don't show up in Photos app... In the bottom left of Camera app I see a thumbnail for the photo I just took but there are no photos in that album...

  • Lightroom outdated for Mac 10.6.8?

    I have a Mac 10.6.8. This computer is not that old, and it is the desktop on which I do all of my photography work. My lightroom 3.6 now does not recognize the files from my SD card from my canon 5D. I have been told that there is no more tech suppor