Integrating Java code with pre-existing C application

My team has been tasked to develop wizards for a pre-existing C application on Unix. We don't own the C code so we can make only limited changes to the native code.
The challenge is to call the Java wizard from within the C code, and then to allow the Java code to use services and data in the C code. I can call Java from C, and then call C from Java. But the C code that gets called from Java doesn't seem to have access to the data known by the C code that called the Java.
The only way I've thought of to handle this is to pass function pointers as paramters to the Java program, which can then pass the pointers on to the C code that it calls. Is there a way to pass pointers into Java?

But the C code that gets called from Java doesn't seem to have access to the data known by the C code that called the Java.
I don't know exactly what you mean here, unless you're simply saying that the scope of your C data makes it inaccessible between functions.
Is there a way to pass pointers into Java?
Yep - Just treat the pointers as opaque types and wrap them in something large enough for the platform - for example a jlong. You need to be sure to be careful in managing the lifetime of the pointers with respect to the Java objects that hold onto them - for example, with function pointers that come from a dynamically loaded shared library or any data pointers that you might be passing around. You probably want to read the section on native peers in the JNI programmer's guide.
God bless,
-Toby Reyelts
Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace

Similar Messages

  • Embedded Java code with bpelx:exec

    When I embed Java code with bpelx:exec, I would like use classes packaged in a jar file. How do I ensure that the jar file is deployed with the suitcase? I tried adding the library to the JDeveloper project (right-click project, choose properties, libraries), but that did not work.

    Although the tooling does not expose this functionality yet, the bpel packaging and bpelc command line tool support the ability to put a library in BPEL-INF/lib and using it in the exec activity. You can also put classes in BPEL-INF/classes. Please look at:
    [ORACLE_HOME]\integration\orabpel\samples\references\JavaExec for more information.
    -Edwin

  • Compiling Java code with Japanese characters

    I have a Java code with some Japanese characters. My compiler doesn't recognise these characters and gives me error messages.
    Please help me.

    Obviously it's not the copmiler's fault. You need to fix your code.
    Here is a link to the Java Language Specification.
    The link is to section 3.8 - Identifiers.
    It describes the acceptable naming:
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
    Perhaps your editor is not saving the text file in an appropriate format.
    What editor are you using?
    Try vim http://www.vim.org
    or SciTE http://www.scintilla.org/SciTE.html

  • Format Java Code with jdeveloper

    Hi Everybody,
    Can anybody tell me How I can Indent Java Code Automatically using JDeveloper 9i.
    It is a facility which is provided in almost all the editor and I believe it should be in jdeveloper also but the problem is I dont know how to go for it.
    I will be very kind to anybody who will solve this problem as this will reduce my lot of unwanted work.
    Regards,
    Amit Jain

    If you're looking for a code beautifier (a tool that can apply a coding style to your source code automatically), try the Jalopy extension. It's an open source code beautifier that is tightly integrated with JDeveloper:
    http://jalopy.sourceforge.net/plugin-jdev.html
    Thanks,
    Brian
    JDev Team

  • Integrating Java caps with tuxedo

    Hi,
    Could any one let me know the best way of integrating Java caps 6 with Tuxedo.
    Regards,
    Abdul

    But the C code that gets called from Java doesn't seem to have access to the data known by the C code that called the Java.
    I don't know exactly what you mean here, unless you're simply saying that the scope of your C data makes it inaccessible between functions.
    Is there a way to pass pointers into Java?
    Yep - Just treat the pointers as opaque types and wrap them in something large enough for the platform - for example a jlong. You need to be sure to be careful in managing the lifetime of the pointers with respect to the Java objects that hold onto them - for example, with function pointers that come from a dynamically loaded shared library or any data pointers that you might be passing around. You probably want to read the section on native peers in the JNI programmer's guide.
    God bless,
    -Toby Reyelts
    Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace

  • Java code with BSP

    Hi Experts,
    Is there any way to write java code in BSP pages or to call java code from BSP pages?
    Thanks in Advance
    Shilpa Dhawan

    Hi,
    Let there be no misunderstanding.
    Java has NOTHING to do with Javascript and vice versa.
    Check this like
    http://www.htmlgoodies.com/beyond/javascript/article.php/3470971
    http://www.dannyg.com/ref/javavsjavascript.html
    for the differences
    Eddy
    PS. Reward the useful answers and you will get <a href="/people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself">one point</a> yourself!

  • Ipad wireless data package with pre-existing Verizon data plan

    Hello,
    I have a question about the wireless plan for the ipad. If I purchase an ipad with verizon wireless carrier does that mean I have to create a
    new verizon wireless account specific for the new ipad? Or can I somehow merge it with my pre-existing verizon wireless plan?
    I have a data package plan of 4G for my phone and I was wondering whether I could share that available data usage with ipad.
    I appreciate all your comments, thank you.

    No, you can't share the data plan with your phone. Yes, you can have your iPad on the same account. It will have its own data plan but appear on the same bill.

  • Problem Integrating JAVA & Portal with BW ABAP 7.02

    Hi I'm installing a BW 7.02 and I need use Bex tool so in a same server i put ABAP & JAVA instance,<br> all is working fine, but when i try see a JAVA Report with Bex Tools i have an error: <br>
    <br><font color="#FF0000"><b>
    Connect to message server host failed<br/>Connect_PM  TYPE=B MSHOST=psbibi1d.patrimonio.com.mx:8100 GROUP=PUBLIC R3NAME=BID MSSERV=8100 PCS=1<br/><br/>LOCATION    CPIC (TCP/IP) on local host with Unicode<br/>ERROR       hostname 'psbibi1d.patrimonio.com.mx:8100' unknown<br/>TIME        Tue Feb 14 19:35:38 2012<br/>RELEASE     720<br/>COMPONENT   NI (network interface)<br/>VERSION     40<br/>RC          -2<br/>MODULE      niuxi.c<br/>LINE        1770<br/>DETAIL      NiPGetHostByName: 'psbibi1d.patrimonio.com.mx:8100' not found<br/>SYSTEM CALL getaddrinfo<br/>COUNTER     6</b></font>
    <br>
    After this i try to run the Diagnostic & Support Tool and I see next info <br>
    <br>
    BI Mastersystem<br><br>
    <font color="#FF0000"><b>
    Error while connecting to BI mastersystem via RFC: com.sap.mw.jco.JCO$Exception:Connect to SAP gateway failed <br>Connect_PM TYPE=A ASHOST=psbibi1d.patrimonio.com.mx:8000 SYSNR=00 GWHOST=psbibi1d.patrimonio.com.mx:8000 <br>GWSERV=sapgw00 PCS=1 LOCATION CPIC (TCP/IP) on local host with Unicode ERROR hostname <br>'psbibi1d.patrimonio.com.mx:8000' unknown TIME Tue Feb 14 19:15:39 2012 RELEASE 720 COMPONENT NI (network <br>interface) VERSION 40 RC -2 MODULE niuxi.c LINE 1770 DETAIL NiPGetHostByName: 'psbibi1d.patrimonio.com.mx:8000' <br>not found SYSTEM CALL getaddrinfo COUNTER 4
    <br><br>
    Check connection properties in Portal Systemlandscape for the property category 'Connector' (Systemlandscape/SAP_BW)
    </b></font>
    <br><br>
    Error in Check Class: com.sap.ip.bi.supportdesk.checks.impl.MultipleUserMappingCheck<br>
    <font color="#FF0000"><b>
    <br>The mapped user ID argument is null. java.lang.NullPointerException: The mapped user ID argument is null. at <br>com.sap.security.core.umap.imp.UserMapping.getInverseMappingData(UserMapping.java:578) at <br>com.sap.ip.bi.supportdesk.utils.UserUtils.getInverseMappings(UserUtils.java:220) at <br>com.sap.ip.bi.supportdesk.checks.impl.MultipleUserMappingCheck.runCheck(MultipleUserMappingCheck.java:29) at <br>com.sap.ip.bi.supportdesk.checks.CheckResults.runCheck(CheckResults.java:129) at <br>com.sap.ip.bi.supportdesk.checks.CheckResults.<init>(CheckResults.java:112) at <br>com.sap.ip.bi.supportdesk.j2ee.J2eeEngineSettings.readSettings(J2eeEngineSettings.java:261) at <br>com.sap.ip.bi.supportdesk.ui.SystemInfoDynPage.readSettings(SystemInfoDynPage.java:479) at <br>com.sap.ip.bi.supportdesk.ui.ConnectionPropertiesDynPage.onOkClicked(ConnectionPropertiesDynPage.java:253) at <br>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at <br>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at <br>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at <br>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at <br>java.lang.reflect.Method.invoke(Method.java:391) at <br>com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:173) at <br>com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:119) at <br>com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134) at <br>com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209) at <br>com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114) at <br>com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189) at <br>com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215) at <br>com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645) at <br>com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189) at <br>com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753) at <br>com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240) at <br>com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:561) at java.security.AccessController.doPrivileged(AccessController.java:246) at <br>com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:434) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at <br>com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) at <br>com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1060) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) at <br>com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) at <br>com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) at <br>com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at <br>com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at <br>java.security.AccessController.doPrivileged(AccessController.java:219) at <br>com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) at <br>com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    <br>
    </b></font>
    <br>
    <br>
    What can I do to fix this problem??
    <br><br>
    Regards<br>
    Daniel

    Hi I'm installing a BW 7.02 and I need use Bex tool so in a same server i put ABAP & JAVA instance,<br> all is working fine, but when i try see a JAVA Report with Bex Tools i have an error: <br>
    <br><font color="#FF0000"><b>
    Connect to message server host failed<br/>Connect_PM  TYPE=B MSHOST=psbibi1d.patrimonio.com.mx:8100 GROUP=PUBLIC R3NAME=BID MSSERV=8100 PCS=1<br/><br/>LOCATION    CPIC (TCP/IP) on local host with Unicode<br/>ERROR       hostname 'psbibi1d.patrimonio.com.mx:8100' unknown<br/>TIME        Tue Feb 14 19:35:38 2012<br/>RELEASE     720<br/>COMPONENT   NI (network interface)<br/>VERSION     40<br/>RC          -2<br/>MODULE      niuxi.c<br/>LINE        1770<br/>DETAIL      NiPGetHostByName: 'psbibi1d.patrimonio.com.mx:8100' not found<br/>SYSTEM CALL getaddrinfo<br/>COUNTER     6</b></font>
    <br>
    After this i try to run the Diagnostic & Support Tool and I see next info <br>
    <br>
    BI Mastersystem<br><br>
    <font color="#FF0000"><b>
    Error while connecting to BI mastersystem via RFC: com.sap.mw.jco.JCO$Exception:Connect to SAP gateway failed <br>Connect_PM TYPE=A ASHOST=psbibi1d.patrimonio.com.mx:8000 SYSNR=00 GWHOST=psbibi1d.patrimonio.com.mx:8000 <br>GWSERV=sapgw00 PCS=1 LOCATION CPIC (TCP/IP) on local host with Unicode ERROR hostname <br>'psbibi1d.patrimonio.com.mx:8000' unknown TIME Tue Feb 14 19:15:39 2012 RELEASE 720 COMPONENT NI (network <br>interface) VERSION 40 RC -2 MODULE niuxi.c LINE 1770 DETAIL NiPGetHostByName: 'psbibi1d.patrimonio.com.mx:8000' <br>not found SYSTEM CALL getaddrinfo COUNTER 4
    <br><br>
    Check connection properties in Portal Systemlandscape for the property category 'Connector' (Systemlandscape/SAP_BW)
    </b></font>
    <br><br>
    Error in Check Class: com.sap.ip.bi.supportdesk.checks.impl.MultipleUserMappingCheck<br>
    <font color="#FF0000"><b>
    <br>The mapped user ID argument is null. java.lang.NullPointerException: The mapped user ID argument is null. at <br>com.sap.security.core.umap.imp.UserMapping.getInverseMappingData(UserMapping.java:578) at <br>com.sap.ip.bi.supportdesk.utils.UserUtils.getInverseMappings(UserUtils.java:220) at <br>com.sap.ip.bi.supportdesk.checks.impl.MultipleUserMappingCheck.runCheck(MultipleUserMappingCheck.java:29) at <br>com.sap.ip.bi.supportdesk.checks.CheckResults.runCheck(CheckResults.java:129) at <br>com.sap.ip.bi.supportdesk.checks.CheckResults.<init>(CheckResults.java:112) at <br>com.sap.ip.bi.supportdesk.j2ee.J2eeEngineSettings.readSettings(J2eeEngineSettings.java:261) at <br>com.sap.ip.bi.supportdesk.ui.SystemInfoDynPage.readSettings(SystemInfoDynPage.java:479) at <br>com.sap.ip.bi.supportdesk.ui.ConnectionPropertiesDynPage.onOkClicked(ConnectionPropertiesDynPage.java:253) at <br>sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at <br>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at <br>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at <br>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at <br>java.lang.reflect.Method.invoke(Method.java:391) at <br>com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:173) at <br>com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:119) at <br>com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134) at <br>com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209) at <br>com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114) at <br>com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189) at <br>com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215) at <br>com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645) at <br>com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136) at <br>com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189) at <br>com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753) at <br>com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240) at <br>com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:561) at java.security.AccessController.doPrivileged(AccessController.java:246) at <br>com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:434) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at <br>com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) at <br>com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1060) at <br>com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) at <br>com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) at <br>com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) at <br>com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at <br>com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at <br>java.security.AccessController.doPrivileged(AccessController.java:219) at <br>com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) at <br>com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    <br>
    </b></font>
    <br>
    <br>
    What can I do to fix this problem??
    <br><br>
    Regards<br>
    Daniel

  • Failure of redeem code with pre-paid card.

    I just spent $600 at Amazon to get a 12-month pre-paid membership in Creative Cloud.  After scratching off the layer on the back to get membership number, I entered it in at the "redeem" web page.  It failed with a 'The code you entered was invalid.  Please try again.  I did so multiple times, to no avail.  So what the hell am I suppose to do now?

    Customer support will contact you to resolve the problem.
    Please be sure you are entering the redemption code correctly - a number 5 versus the letter S, a number 0 versus the letter O.

  • I pasted several chapters from another document with endnotes into a book document with pre-existing endnotes.  Since I have numerous pages of the same endnotes and Pages software is uber slow.  What do I  do?

    How do to combine documents both with endnotes?  When I tried, I got multiple copies of the same endnotes and very slow word processing.  thanks

    If you are wondering why you are not getting any responses, it is because you have vented a complaint without any details that make any sense or give anyone something to work on.
    If you want help, I suggest actually detailing what has happened, with versions of software etc. Anything that would let us assist.
    As a start I am guessing that you have not really got the hang of "How it all works". Firstly download the Pages09_UserGuide.pdf from under the Help menu. Read that and view the Video Tutorials in the same place. A good addition would be the iWork 09 Missing manual book and something to help you learn how to use your Mac.
    If there are specific tasks you need help with:
    http://www.freeforum101.com/iworktipsntrick/index.php?mforum=iworktipsntrick
    Is a good resource.
    Peter

  • Accessing Java Object with out any application servers

    Hi,
    I would be much thankful if any one guide/suggest me how to
    access an java object with out using any application servers.I am
    having an java object which holds dummy data and an mxml file which
    contains some text fields. My plan was to access the java object
    and put the dummy data in the text fields. I am using RemoteObject
    for this. I am not able to proceed further. Please help me.
    Thanks in advance
    Regards
    Karun Kumar

    You can check The Merapi Project it's still in the
    development phase but it'll allow to an AIR app invoke a java class
    and run it as it were inside your app. But that's something you
    can't take into production yet, why don't u wanna use a server
    backend?

  • Java code for logging from servlet on AS

    Hi guys,
    I have developed a servlet on SAP AS and I need to log information from processing. Can you please suggest me the best way to do that? I am not an Java expert but when I see the code I'd understand it. Can you please provide some Java logging example code which would work on AS 7.3?
    Thanks a lot,
    Peter

    Hi Peter,
    Please have a look of the below logging links/docs
    Sample Java Code with Logging -  Using Central Development Services - SAP Library
    Tracing and Logging -  SAPNetWeaver Application Server Java Security Guide - SAP Library
    Integrating Third-Party Logging Frameworks into SAP NetWeaver CE
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20ecb0f4-ccb0-2a10-46aa-ceee8895f34b?QuickLink=index&overridelayout=true&25009594565056
    Or
    You can simply use System.err.println() or System.out.println()
    Thanks,
    Hamendra

  • 'protect' my Java Code

    Hi friends, my question is simple:
    1) How to protect the java Desktop code, you know if i redistribute the .class files, it can be decompiled and get the java code, i want to do similar to Visual Basic, that generate a .EXE file and is hard hard decompile it, is possible? 
    2) How to protect the JSP code,  you know Netbeans Generate a .war file, but Tomcat deploy it on the server, right? but in the server the user can see the code, if i add a servlet, it generate a .class file right? again exist tools for decompile .class files, bad bad, in PHP exist a way for encrypt the php code with Zend. exist similar for JSP?
    Thanks

    1) How to protect the java Desktop code, you know if i redistribute the .class files, it can be decompiled and get the java code, i want to do similar to Visual Basic, that generate a .EXE file and is hard hard decompile it, is possible?
    2) How to protect the JSP code,  you know Netbeans Generate a .war file, but Tomcat deploy it on the server, right? but in the server the user can see the code, if i add a servlet, it generate a .class file right? again exist tools for decompile .class files, bad bad, in PHP exist a way for encrypt the php code with Zend. exist similar for JSP?
    I suggest that before you pursue any solution you make sure you REALLY have something that needs protected to begin with. There is a LOT of software out there from MAJOR companies who haven't bothered to try to 'protect' their code except through license agreements and legal channels.
    Even Oracle's FREE to download Sql Developer tool has basically no protection from 'decompiling' and it has a lot of sophisticated functionality in it.
    The most reasonable thing to do, IMHO, if you really need to do anything is to obfuscate the code. Here is a link to a free-ware/shareware application that is pretty popular.
    ProGuard
    Keep in mind that ANYTHING you do will further complicate your own production and distribution of the product as well as make upgrades and bug fixes MUCH harder.

  • Mix jython code with sql

    Hi,
    I have just read the following sentence in the odi jyhon reference:
    "Oracle Data Integrator users may write procedures or knowledge modules using Jython, and may mix Jython code with SQL, PL/SQL, OS Calls, etc."
    Does anyone of you know how jython can be mixed with SQL in a knowledge module? I just know how to embed java code with the <% %> tag. But how about jython (e.g. when used in a knowledge module task with technology = "Oracle"?
    I appreciate your help.
    best regards,
    Hans

    So Firstly I have never done this in KM but it works well in Procedure so I think it would work in a KM but I'm not sure.
    So I will show you an exemple which will be easyer than lot of explanation.
    This exemple is a step of a procedure which is supposed to send an email if there is an error in an execution.
    This Step retrieve informations about the execution as the error message or the execution context...
    In the Target Command :
    Technology= Jython
    I have :
    EmailBody = EmailBody + r'''<TR><TD><CENTER>#NO</CENTER></TD><TD>#SESS_NAME</TD><TD>#STEP_NAME
    </TD><TD>#CONTEXT</TD><TD>#DEBUT</TD><TD>#MSG</TD></TR>'''
    Contexte = '#CONTEXT'.
    --> the #variable are the informations that I will extract in the source.
    In the Source Command :
    Technology = Oracle .
    SELECT L.SESS_NO || ' / ' || L.NNO "NO", STEP_NAME, SESS_NAME, SS.CONTEXT_CODE "CONTEXT", L.STEP_BEG "DEBUT", X.TXT "MSG", L.step_rc "RC"
    FROM <%=snpRef.getObjectName("L", "SNP_STEP_LOG", "D")%> L,
    <%=snpRef.getObjectName("L", "SNP_SESS_STEP", "D")%> SS,
    <%=snpRef.getObjectName("L", "SNP_SESSION", "D")%> S,
    <%=snpRef.getObjectName("L", "SNP_EXP_TXT", "D")%> X
    WHERE L.SESS_NO = <%=snpRef.getSession("SESS_NO")%> AND
    L.SESS_NO = SS.SESS_NO AND L.NNO = SS.NNO AND S.SESS_NO = L.SESS_NO AND
    STEP_STATUS = 'E' and L.I_TXT_STEP_MESS=X.I_TXT and X.TXT_ORD=0
    And with this the Jython keep the information of the Query...
    So I would like to apologize cause in my last post I have inversed the Target and the Source... Sorry. Hope that your problem didn't come from here...
    Evidently you will have SQL as Source and Jython as Target...

  • How to pass arguments to a batch file from java code

    Hi
    I have a batch file (marcxml.bat) which has the following excerpt :
    @echo off
    if x==%1x goto howto
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; %1 %2 %3
    goto end
    I'm calling this batch file from a java code with the following line of code:
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat");
    so ,that invokes the batch file.Till that point its ok.
    since the batch file accpets arguments(%1 %2 %3) how do i pass those arguments to the batch file from my code ...???
    %1 is a classname : for ex: gov.loc.marcxml.MARC21slim2MARC
    %2 is the name of the input file for ex : C:/Downloads/Marcxml/source.xml
    %3 is the name of the output file for ex: C:/Downloads/Marcxml/target.mrc
    could someone help me...
    if i include these parameters too along with the above line of code i.e
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat gov.loc.marcxml.MARC21slim2MARC C:\\Downloads\\Marcxml\\source.xml C:\\Downloads\\Marcxml\\target.mrc") ;
    I get the following error :
    Exception in thread main java.lang.Noclassdef foundError: c:Downloads\marcxml\source/xml
    could some one tell me if i'm doing the right way in passing the arguments to the batch file if not what is the right way??
    Message was edited by:
    justunme1

    1 - create a java class (Executer.java) for example:
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    public class Executer {
         public static void main(String[] args) {
              try {
                   for (int i = 0; i < args.length; i++) {
                        System.out.println(args);
                   Class<?> c = Class.forName(args[0]);
                   Class[] argTypes = new Class[] { String[].class };
                   Method main = c.getDeclaredMethod("main", argTypes);
                   // String[] mainArgs = Arrays.copyOfRange(args, 1, args.length); //JDK 6
                   //jdk <6
                   String[] mainArgs = new String[args.length - 1];
                   for (int i = 0; i < mainArgs.length; i++) {
                        mainArgs[i] = args[i + 1];
                   main.invoke(null, (Object) mainArgs);
                   // production code should handle these exceptions more gracefully
              } catch (ClassNotFoundException x) {
                   x.printStackTrace();
              } catch (NoSuchMethodException x) {
                   x.printStackTrace();
              } catch (IllegalAccessException x) {
                   x.printStackTrace();
              } catch (InvocationTargetException x) {
                   x.printStackTrace();
              } catch (Exception e) {
                   e.printStackTrace();
    2 - create a .bat file:
    @echo off
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; Executer %TARGET_CLASS% %IN_FILE% %OUT_FILE%3 - use set command to pass variable:
    Open MS-DOS, and type the following:
    set TARGET_CLASS=MyTargetClass
    set IN_FILE=in.txt
    set OUT_FILE=out.txt
    Then run your .bat file (in the same ms dos window)
    Hope that Helps

Maybe you are looking for