Good/robust/high performance solution for calling Java from C
Hi,
I am looking for a good/robust/high performance solution for invoking a local java component from a C application in Windows.
About Java component:
- It has multiple methods that would be called very frequently from C application
- It will reside in local machine. This machine may not have access to internet/LAN.
My preference is to implement this java component as indepent running exe and have C application make outprocess calls. Is this possible?
Any help/suggestions on this are greatly appreciated
Thanks,
-Arun
I will stop replying to this conversation, unless it
remains professional and without getting personal.I suggest you read your replies again then since you were the one that strayed from the topic and referred to my competency.
>
Or conversely those that have been working with JNIfor close to 10 years >might have a different opinion
that someone who is promoting a commercial >product?
I cannot see anything wrong with sharing and letting
people know of potential solutions that might help to
solve their problems.Not a problem at all.
You however stated an absolute. I asked you to back up that absolute with something that was objective.
You then lashed out at me and questioned my competency.
>
So you are questioning my competence as well as myintent?
And not bothering to address the question at all.
I am guessing you haven't actually attempted tocompare JNI to on board >sockets but instead you are
just guessing.
Frankly, I don't see how a socket solution with
process switching overhead is going to work faster
than a direct method call, passing parameters over
the stack, the whole operation taking place
in-process.
And thus, as I thought, you haven't actually attempted to compare the two.
And in terms of competency I can only wonder if youare competent enough
to write the test frameworks that would demonstrateone or the other.
As said earlier, there is no need to get personal,
let's keep professional!
And as I said earlier I would suggest that you look to your own replies.
As mentioned, I do have enough experience for those
who need to interoperate with Java using JNI, and can
show how to do it in a safe and productive manner.
And as I have said for the third time now that has nothing to do with what I actually asked you.
The code that someone writes via JNI has much lessusage, and thus is much >more likely to have
problems. Even if someone is competent in creating
JNI >and C code.
Thus JNI Is less stable.
And by the way that includes the commercial productthat you are promoting >as well.
Expressing an opinion on a product just based on its
underlying technology without proper evaluation
doesn't sound like constructive criticism.
So you are claiming that your product is in fact more stable than the VM or at least as stable even though it has had far, far less usage?
The only thing that can be said about the product so
far, it that a product that is in production for some
years without any problems, has a certain level of
reliability and quality, whatever the underlying
technology might be, and that there is enough
competency with JNI to produce it and advice about
the technology.
True. But you were the one that brought up unrelated issues and then, as best as I can tell, thought to challenge my knowledge by pointing out how VMs "really" work.
Similar Messages
-
Can ActiveX bridge used for calling Java from Delphi?
Also trying to solve this problem, after creating the bean i packaged/registered it successfully, (tested the bean using beanbox, works perfectly) then tried calling it via createoleobject in delphi 7
(*Code Snip *)
Var
v : variant;
begin
try
v := createoleobject(Edit1.text); // my class name ie WorldPort.Bean (also tried WorldPort.Bean.1
except on e:exception do
showmessage(e.Message)
end;
end;
(*Code Snip*)
After this simple code failed i started backtracking , eventually after getting "Access Violation...etc in axbridge.dll" all the time. tried delphi "import activex control" got the same access violation.
Decided to test the example from http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/examples.html........ they both crashed on execution (calc.exe and boundprop.exe).
After this failed I tested these example classes on another machine, both crashed again.....
Also tried this experiment in VC++ , after adding the class to the Toolbox , i try to drop it onto a form, once again access violation.**PS**
('You will need VC++ and the Microsoft SDK to build the dll, download c++beta for free from microsoft site it you need it')** and a simple cmd file todo the job would look something like this:
echo - ** Build Java ActiveX Bridge **
echo Make sure these folders exist in jre--> axbridge\lib and axbridge\bin
cd\SDK\jre\axbridge\bin
set path=%path%;C:\MSDN\Bin;C:\VisualC++\lib
echo path
javac WorldPort.java
jar cmf Manifest.txt WorldPort.jar WorldPort.class
"C:\SDK\bin\packager.exe" -clsid {162193C4-AD5C-4A06-9F88-A737AE9B43AD} -out "C:\SDK\jre\axbridge\bin" WorldPort.jar WorldPort-reg
*** After running this cmd you will find the dll in bin folder and the jar in lib folder..***
Must Read:http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
Hope some of this helps , if you have successfully created / installed/ used a "JavaActiveX" in Delphi , i would really like to try replicate it on my machine.. -
I'm looking for Failover/High available solutions for IPS 4200 Series
Hi all,
I tried to find out Failover/High available solutions for IPS 4200 series,I didn't saw failover solutions in IPS guide document. Anybody can be help me!I do not know if this is documented anywhere, but I can tell you what I do. As long as the IPS 4200 has power, with the right software settings, the unit can fail such that it will pass traffic. Should the unit loose power, it does stop all traffic. I run a patch cable in parallel with the in line IPS unit, in the same VLAN, with a higher STP cost. Thus all traffic will traverse the IPS unit when possible, but should something happen to it, a $10 patch cable takes over.
Mike -
Any program for calling bapi from ABAP step by step
any program for calling bapi from ABAP step by step
points will be rewarded,
thank you,
Jagrut BharatKumar ShuklaHi Jagrut,
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
ex BAPI:
API_SALESORDER_CREATEFROMDAT1
BAPI_SALESORDER_CREATEFROMDAT2
You can get good help form the following links,
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sappoint.com/abap/bapiintro.pdf
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://sap-img.com/bapi.htm
<b>EG::</b>
<b>Here is the step by step procedure for creating BAPIs.</b>
There are 5 different steps in BAPI.
- Create BAPI Structure
- Create BAPI Function Module or API Method.
- Create BAPI object
- Release BAPI Function Module.
- Release BAPI object.
Step1. Creating BAPI Structure:
- Go to <SE11>.
- Select Data Type & Enter a name.
- Click on Create.
- Note: Always BAPI should be in a development class with request number (Not Local Object).
- Select Structure & hit ENTER.
- Enter the fields from your database. Make sure that the first field is the Primary Key Field.
- Then SAVE & ACTIVATE.
Step 2. Creating BAPI module:
- Enter TR.CODE <SE37>.
- Before entering any thing, from the present screen that you are in, select the menu
Goto -> Function Groups -> Create Group.
Enter a name (Note: This name Must start with ZBAPI)
Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
Click on the Third ICON that says Inactive Objects.
Select the group that you just created and click on Activate.
Notice that the group you created will disappear from the list of inactive objects.
- Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
Then click on the second tab that says [IMPORT].
Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box Pa. All remotely enabled functional modules MUST be Pa enabled, where Pa means Passed by Value and if you dont select Pa, then that means it will be passed by reference..
Then click on tab that says [EXPORT].
Enter the following as is in the first three fields
RETURN TYPE BAPIRETURN (These 3 field values are always same)
Here also select Pa meaning Pass by value.
Note: BAPIRETURN contains structure with message fields.
Then SAVE and ACTIVATE.
Step 3. Creating BAPI object:
- Enter Tr.Code <SWO1> (Note. It is letter O and not Zero).
- Enter a name and then click on create. Enter details.
NOTE: Make sure that that Object Type and Program name are SAME.
- Enter Application M, if you are using standard table Mara. If you are using your own database then select Z at the bottom.
- Then hit <ENTER>.
- Now we have to add Methods. High light METHODS and then select the following from the menu:
Goto Utilities -> API Methods -> Add Methods.
- Enter function Module name and hit <ENTER>.
- Select the second FORWARD ARROW button (>)to go to next step.
- Check if every thing looks ok and again click on FORWARD ARROW button (>).
- Then select YES and click on <SAVE>.
- Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.
- Goback to TR.CODE <SWO1>.
Here select the menu combination shown below in the same order.
- Edit -> Change Release Status -> Object Type Component -> To Implemented.
- Edit -> Change Release Status -> Object Type Component -> To Released.
- Edit -> Change Release Status -> Object Type -> To Implemented.
- Edit -> Change Release Status -> Object Type -> To Released.
- Then click on <SAVE>.
- Then click on Generate Button (4th button from left hand side looks like spinning wheel).
- Then Click on the button that says PROGRAM to see the source code.
To check if this is present in work flow goto TR.CODE <BAPI>.
Here it shows business object repository.
- First click on the middle button and then select ALL and hit ENTER.
- Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully
<b>Reward pts if found usefull :)</b>
regards
Sathish -
Is it possible to call java from Sybase trigger ? If so can you please supply example or URL to one ? Alternative solution is to call shell script from sybase trigger (as app is based on Solaris).
Regards
MichalThank for your opinion, but what idea is better ?Doing things in the middle tier, where Java lives.
Ever heard of event-based trading systems?
pooling a table every 30 sec. ?. I need to implment
real-time system which process each trade from table
once it appears there.Sounds like you have it backwards - you're trying to drive Java from the database.
I think it'd be better to write that event-based system in Java and leave the database just for persistence.
GigaSpaces and their ilk are being used this way for highly transactional trading systems. Maybe you could see how they're doing it.
% -
Questions abt. calling Java from C
I have a java class that contains a method I need to make accessable to C functions. It looks something like this:
public class ExportName
private SomeObj theObj;
public ExportName(SomeObj theObj)
this.theObj = theObj;
} //end ExportName
public String getName()
return theObj.getName();
public native String getNameJNI();
}Using javah I have my ExportName.h, and I'm in the process of writing ExportName.c:
#include <stdio.h>
#include <jni.h>
#include "ExportName.h"
JNIEXPORT jstring JNICALL Java_ExportName_getNameJNI (JNIEnv *, jobject)
jclass cls = (*env)->GetObjectClass(env, obj);
jMethodID mid = (*env)->GetMethodID(env, cls, "getName", "()Ljava/lang/String");
if (mid == 0)
return;
} /* end if */
}I have 2 questions:
(1)At some point, I need to actually call the java method using
(*env)->Call<TYPE>Method(env, obj, mid);
What type should I use here (CallWhatMethod)?
(2)Also, I need to create genuine C wrappers for these methods. How do I hand off the jstring returned by this JNI C code to the ANSI C method that calls it? I know that there is a conversion along the lines of:
const char str = (env)->GetStringUTFChars(env, <<JSTRING HERE>>, 0);
Can I just put the call to the JNI method where the jstring variable name goes?
Any help would be appreciated. I have already read the Java tutorial on JNI, so please don't respond just to tell me to go there.
Thanks!If that is the case, then your starting point is not javah, but to investigate the invocation API, after which you will call java methods from C.
Well, the Invocation API is mostly orthogonal to whether you are calling Java from C or vice versa. The Invocation API is mostly about creating/destroying VMs. You can call Java methods from a flat C application or you can call Java methods from C from within Java native methods.
If you want to call Java from C, you need to use the methods you're using like GetMethodID, CallXXXMethod, etc...
In your particular example, if you wanted to call ExportName.getName(), you would use CallObjectMethod. You would cast the result to a jstring, and then use GetStringUTFChars, ReleaseStringUTFChars, etc...
God bless,
-Toby Reyelts
For a solution to all your JNI woes, check out Jace - http://jace.reyelts.com/jace -
Battery Solutions for iPhone 5 - From 4 to 12 hours Usage
Battery Solutions for iPhone 5 - From 4 to 12 hours Usage
First:
iCloud sync is a great battery consumer
1** iCloud: turn off mail, safari and reminders. Only keep contacts, notes, photo stream and documents data
2** Use cellular data for iCloud documents and reading list only.
3** Notes to save on iPhone, not on iCloud.
4* Avoid downloading new Apps or updates if not on power. It's better to download all updates on a computer and synchronise to update them.
5* Avoid looking at videos on line if not on power.
6* Games consume a lot
Second: if not enough
7* Brightness to bring on top of the letter "t" of Brightness. Sometimes the brightness goes automatically to 75%, too high. Put it back.
8* In mail, fetch new data, advanced, check that all accounts are fetch manual
Third: Additional Optional tips
9* Wifi ask to join networks off
10* Bluetooth off when no need, turn off WiFi if in an area with no WiFi, avoid Personal Hotspot: great battery consumer.
11* Turn off iPhone manually. Don't wait for iPhone to turn it off.
12* Let the battery exhaust totally until it turns off before to recharge it.
13 Kill The Apps unused from time to time, in case one application uses too much in back ground
14 The Reset All Settings solves nothing. It just creates problems to rekey in everything.Just a followup:
To summarize: I upgraded to an iPhone 5 a few days ago and the first thing I did was restore from my iPhone 4 iCloud backup. After that I was experiencing the things some people here complain of: running hot and battery draining quickly.
But I then reset as a new iPhone and synced in all my apps, music, photos, etc. from iTunes and now it is running cool - even after using it continually for 90 minutes or 2 hours and the battery drain is acceptably within specs.
This screen shows
Usage: 4 Hours, 0 Minutes
Standby: 19 Hours, 28 Minutes
Battery at 44%.
That would "multiply out" to
Usage: 7 Hours, 14 Minutes
Standby: over 34 hours
when the battery is fully used up.
I believe that is pretty reasonable and within specs.
I will try an experiment after my next full charge of turning off cellular data though (except when absolutely needed) for comparison.
I'm not saying some people aren't having some power-draining issue due to their carrier. But even without 5 bars standing the issue for me seemed to have been the attempt to restore from my iPhone 4's iCloud backup instead of installing as a new iPhone and syncing.
Screenshot:https://www.dropbox.com/s/xnfkaw6525b4a02/Photo%20Oct%2029%2C%207%2038%2008%20AM .png
doug -
Advantages and Disadvantages of calling java from PL/SQL
Hi,
I have one doubt. What are all the advantages and disadvantages of the calling java from PL/SQL?
In actual scenario the java program will be in the Application server side. It will do the operation and it will store the result in Data base. But in this case (calling java from PL/SQL), we are loading the java program in the Data base and it is doing the operations.
I have seen many posts are coming regarding loading jar files into the database. Actually the jar will deploy in to Application server. Is there any difference instead of keeping in the Application server side?
Then I have read,
advantages:
-> java having lot API's. so PL/SQL can use that API's.
-> if we can not do anything in PL/SQL. we can do it using this mtd(calling java from PL/SQL).
My questions:
-> could you explain what are all the things we can not do but we can do using "calling java from PL/SQL" method?
-> is there any other advantages?
Disadvantages:
-> the performance is very slow in calling java from PL/SQL.
My questions:
-> Then why others are loading java files and jar files into database?
-> is there any other disadvantages?
Could you explain about this one? It will be more helpful to others also…
Regards,
kkHi,
You can read the free first chapter of my book @ http://www.amazon.com/gp/product/1555583296/ (see details then Excerpt)
Kuassi http://db360.blogspot.com -
Problem calling java from vb via activex bridge
I am trying to call java from vb via ActiveX Bridge and I am running into problems. I would appreciate any help.
I am using Visual Basic 2010 express, and Java JDK 1.6.0_16. I have used the http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/index.html page as a guideline. To try to make it work I took the following steps:
1. Wrote a very simple java class (below):
package xxx;
import java.io.Serializable;
public class axb implements Serializable {
public int get_axb_Handle() {
int Address = 12345678;
return Address;
2. After I compiled, and created the jar file. I built the dll using the following command:
"C:\Program Files\Java\jdk1.6.0_16\bin\packager" -out "C:\Program Files\Java\jdk1.6.0_16\jre\axbridge\bin" E:\axb\dist\axb.jar xxx.axb
3. I then registered using: regsvr32 axb.dll
4. In Visual Basic Express IDE I use Project -> Add Reference to add Iterop.axb (dump below), and axb namespace
5. In my basic code I use the following lines
Dim axb1 As axb.axb
axb1 = New axb.axb <== Crash here with AccessViolationException ( full exception below)
What am I missing? Any help would be greatly appreciated
Thanks
Iterop.axb partial dump
___[MOD] C:\Documents and Settings\Elie A. Cohen.USINC022\My Documents\Visual Studio 2010\Projects\Repo API Example\Repo API Example\obj\x86\Release\Interop.axb.dll
| M A N I F E S T
|___[NSP] axb
| |___[INT] axb.axb
| | | .class interface public abstract auto ansi import /*02000006*/
| | | implements axb.axbDispatch/*02000003*/
| | | implements axb.axbSource_Event/*02000005*/
| | | .custom /*0C000018:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 34 45 36 44 30 44 41 38 2D 36 41 45 44 // ..$4E6D0DA8-6AED ...
| | | .custom /*0C000019:0A000007*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.CoClassAttribute/*01000009*/::.ctor(class [mscorlib/*23000001*/]System.Type/*01000007*/) /* 0A000007 */ = ( 01 00 0C 61 78 62 2E 61 78 62 43 6C 61 73 73 00 // ...axb.axbClass. ...
| |
| |___[CLS] axb.axbClass
| | | .class public auto ansi import /*02000004*/
| | | implements axb.axbDispatch/*02000003*/
| | | implements axb.axb/*02000006*/
| | | implements axb.axbSource_Event/*02000005*/
| | | .custom /*0C00000F:0A000008*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ClassInterfaceAttribute/*0100000A*/::.ctor(int16) /* 0A000008 */ = ( 01 00 00 00 00 00 ) ...
| | | .custom /*0C000010:0A000009*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ComSourceInterfacesAttribute/*0100000B*/::.ctor(string) /* 0A000009 */ = ( 01 00 0F 61 78 62 2E 61 78 62 53 6F 75 72 63 65 // ...axb.axbSource ...
| | | .custom /*0C000011:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 43 44 42 46 36 42 33 33 2D 45 32 33 46 // ..$CDBF6B33-E23F ...
| | | .custom /*0C000012:0A000002*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.TypeLibTypeAttribute/*01000003*/::.ctor(int16) /* 0A000002 */ = ( 01 00 02 00 00 00 ) ...
| | |___[MET] method .ctor : void()
| | |___[MET] method equals : bool(object)
| | |___[MET] method getClass : object()
| | |___[MET] method get_axb_Handle : int32()
| | |___[MET] method hashCode : int32()
| | |___[MET] method notify : void()
| | |___[MET] method notifyAll : void()
| | |___[MET] method toString : string()
| | |___[MET] method wait : object(object,object)
AccessViolationException exception
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at WindowsApplication1.Form1.getPatientHandle_Click(Object sender, EventArgs e) in C:\Documents and Settings\Elie A. Cohen.USINC022\my documents\visual studio 2010\Projects\Repo API Example\Repo API Example\Repo API Example.vb:line 13
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:In case you haven't figured it out already... Or if anyone else is curious... Or for myself when I get old and forgetful...
h2. Object Creation
For starters, when you create an ActiveX object from within VB, use:
Set myObject = CreateObject("JavaObject.Bean")When I refer to JavaObject.Bean, I'm meaning the full object name + ".Bean". So, in your case, you should use:
Set myObject = CreateObject("xxx.axb.Bean")h2. Location
The .dll file must be located in the JRE that is used at the time of calling. Meaning, the .dll file must be placed under <jre_home>\axbridge\bin and registered there.
In your case:
DLL:
C:\Program Files\Java\jre6\axbridge\bin
Jar:
C:\Program Files\Java\jre6\axbridge\libh4. A Note:
The only supported JRE is a 32bit version as far as I know with regards to the ActiveX bridge. Just like the packager.exe can only be found in the 32bit JDK.
h2. Methods
h3. Object Types
ActiveX Bridge does not support passing literals or arrays. However, it does support passing java's primitive data types as Objects.
Simply meaning:
h4. Invalid:
public int get_axb_Handle() {
int Address = 12345678;
return Address;
}h4. Valid:
public Integer get_axb_Handle() {
int Address = 12345678;
return Address;
}On a normal circumstance, there's little difference between the two methods. However, in the second example, the JVM does a typecast from a literal data type to a object data type, resulting in a valid object to pass through to Visual Basic. Now, obviously there are multiple ways to do a proper change, new Integer(int) for example. It doesn't matter to me. At the end of the day, you have to pass an object.
As a side note, the same idea applies when receiving data from Visual Basic.
h4. Invalid:
public void set_axb_Handle(int newHandle) {
int Address = newHandle;
}h4. Valid:
public void set_axb_Handle(Integer newHandle) {
int Address =newHandle; -
ResourceBundle throws MissingResourceException when calling Java from C
All,
Our code calls Java from C application.
The C code create JVM using JNI_CreateJavaVM. Due to internal design issues we don't
create the JVM with a "-classpath" option.
After creating the JVM, we create a ClassLoader (URLClassLoader), with a URL list as it's classpath.
The last step in the C code is to load a Java class using the C reference to URLClassLoader.loadClass
(I will refer to this class as classA), and than call one of it's static methods.
Please notice that classA is not instantiated, we call a static method.
At this point we are moving to the Java code...
In the Java static method we call ResourceBundle.getBundle("resources.messages"),
the result is ResourceBundle throws MissingResourceException.
- The JAR hosting "resources/messeges.properties" (refer as jarA) is include in the
ClassLoader URL paths we used for loading the Java class.
- Using a debugger we can see that ClassLoader.getSystemClassLoader() don't contain
jarA in it's URL list.
- Using the debugger we see that classA.class.getClassLoader() does contain
jarA in it's URL list.
After some investigation we see that ResourceBundle.getBundle calles to ResourceBundle.getLoader:
private static ClassLoader getLoader() {
Class[] stack = getClassContext();
/* Magic number 2 identifies our caller's caller */
Class c = stack[2];
ClassLoader cl = (c == null) ? null : c.getClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
return cl;
} getClassContext() - native method, this can explain the why the above work fine for Windows.
I suspect the problem raised in the above code. Since I couldn't get a debug
version of rt.jar for Solaris, I need some help.
Our environment is Solaris 8, Java 1.5.
Please note that the same code works fine on WindowsXP with the same Java version!
Thanks,
AviI was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
char* str1;
char* str2;
char* classpath;
str1 = "-Djava.class.path=";
str2 = std::getenv("CLASSPATH");
classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
strcpy(classpath, str1);
strcat(classpath, str2);
if (str2 == NULL) {
printf("CLASSPATH environment variable is not defined.");
exit(1);
m_VmArgs.version = JNI_VERSION_1_4;
m_options[0].optionString= classpath;
m_VmArgs.options = m_options;
m_VmArgs.nOptions = 1;
m_VmArgs.ignoreUnrecognized = JNI_TRUE;
JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
/* Create the Java VM */
m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
if (m_Res < 0) {
printf("Can't create JVM\n");
exit(1);
thanks,
chancellor -
JCo connectivity is used to call RFCs from Java. can i call Java from abap?
thanks in advance.....
regards,
SundararamaprasadHi Sundar ,
This link will surely give u an idea about calling java fro ABAP using Jco.
http://www.thespot4sap.com/Articles/SAP_Netweaver_Java_Connector.asp
regards,
aravindh. -
Is iwork the solution for uploading spreadsheets from a PC to view on a ipad?
Is iwork the solution for uploading spreadsheets from a PC to view on a ipad?
So do you think any one at apple can answer this question, instead of having to check out there in the world to see if someone has accidentally figured it out?
-
Can anyone give me step by step for calling FM from one SAP to another SAP
can anyone give me step by step for calling FM from one SAP to another SAP
points will be rewarded,
thank you,
Regards,
Jagrut BharatKumar Shukla*& Report RFC_FOR_CUSTOMER_LIST
*& RFC to a Fn. module from another system which implements BAPI
REPORT rfc_for_customer_list.
DATA:
fl_status TYPE i.
DATA:
fs_message TYPE bapiret2.
DATA:
BEGIN OF fs_customers,
id TYPE s_customer,
name TYPE s_custname,
END OF fs_customers.
DATA:
t_customers LIKE
STANDARD TABLE
OF fs_customers.
CALL FUNCTION 'Z_BAPI_GET_CUSTOMER_LIST' DESTINATION 'R3N'
IMPORTING
return = fs_message
TABLES
customerlist = t_customers.
IF sy-subrc EQ 0.
fl_status = 1.
LOOP AT t_customers INTO fs_customers.
WRITE:
/10 fs_customers-id,
30 fs_customers-name.
AT LAST.
WRITE:
/,/5 'No of customers in R3N = ', sy-tabix.
ENDAT.
ENDLOOP.
ELSE.
MESSAGE 'RFC failed' TYPE 'S'.
EXIT.
ENDIF.
TOP-OF-PAGE EVENT *
TOP-OF-PAGE.
IF fl_status NE 0.
WRITE:
/12 'ID' COLOR 6,
32 'NAME' COLOR 6.
SKIP.
ENDIF.
This is one small example...
Regards,
Pavan -
Any good workflow tutorials out there for those moving from iPhoto Aperture
Any good workflow tutorials out there for those moving from iPhoto to Aperture 3?
Especially those that deal with using a laptop and off-line storage of photos.
Cheers, Andrew.There is no reason to not port a number from another provider (unless leaving a contract early and being charged the ETF) for if one does decide to switch back to their previous provider within the first 30 days after making the switch, the previous provider will take one back with welcome arms and the same phone number can be used this way.
Your way required getting a new phone number which can't be changed or potted after the fact for single line account. -
An advanced solution for sending email from Solution Manager (or CRM)
Hi all,
did anyone use blog "An advanced solution for sending email from Solution Manager (or CRM)"
<a href="/people/emmanuele.prudenzano/blog/2006/08/03/an-advanced-solution-for-sending-email-from-solution-manager-or-crm:///people/emmanuele.prudenzano/blog/2006/08/03/an-advanced-solution-for-sending-email-from-solution-manager-or-crm
I´ve got some problems:
I tried to implement your solution in our SAP system. I´m new to ABAP and so it´s a little bit try and error for me.
I´ve got some errors:
In method EXEC_SMART_FORM_WITH_TEXT (from note 935670) :
- method string_to_soli does not exist. There is a method xstring_to_solix.
When I change to method xstring_to_solix
- "L_STRING" is not type-compatibly to "IP_XSTRING".
In method ZSM_ATTACH_PHIO_DOCU:
- field DOCUMENT is unknown
Regadrs
AndyHi all,
did anyone use blog "An advanced solution for sending email from Solution Manager (or CRM)"
<a href="/people/emmanuele.prudenzano/blog/2006/08/03/an-advanced-solution-for-sending-email-from-solution-manager-or-crm:///people/emmanuele.prudenzano/blog/2006/08/03/an-advanced-solution-for-sending-email-from-solution-manager-or-crm
I´ve got some problems:
I tried to implement your solution in our SAP system. I´m new to ABAP and so it´s a little bit try and error for me.
I´ve got some errors:
In method EXEC_SMART_FORM_WITH_TEXT (from note 935670) :
- method string_to_soli does not exist. There is a method xstring_to_solix.
When I change to method xstring_to_solix
- "L_STRING" is not type-compatibly to "IP_XSTRING".
In method ZSM_ATTACH_PHIO_DOCU:
- field DOCUMENT is unknown
Regadrs
Andy
Maybe you are looking for
-
I moved my entire Iphoto Library from my Macbook Pro to an external hard drive. (Prior to this, I also copied the entire library to a different ehd, plus I have 2 other ehdrives with backups). I was trying to get more space on my hd. It has a capacit
-
Computer Restart itself during intalling Adobe CS3
Hi I trying to install Adobe Dreamweaver CS3 but my computer is restart itself. Its happen after setup initialization and during setup booting process. Its same also happen when i installing Adobe Photoshop CS3. FYI, i am using P41.7, 512MB RAM, 80GB
-
Hello! Please tell me why the panel "work certificates" is not active? Adobe Reader XI 11.0.06 - Russian
-
Intercompany Price condition on Billing
Hi All, i have this situation about intercompany flow: Condition ZPIC (Intercompany price) is statistical on sales order and direct billing invoice and then relevant only on intercompany billing. The setting on pricing procedure: ZPIC GGP IC Price
-
Corrupt iphoto library recovery
Recently my iMac went to the Genius bar for repair. I purchased a hard drive in store and we made a backup of what I needed to subsequently recover and all seemed to backup OK. With the Mac back from repair I started to rebuild my iMac to pre-failu