How can I run C++ code through JNI?
in the Java tutorial "Lesson: Writing a Java Program with Native Methods ", (see "http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html") every thing works fine if I follow all the instruction. but if I change the Native Method Implementation file from:
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
printf("Hello world!\n");
return;
to:
#include <jni.h>
#include "HelloWorld.h"
#include <iostream.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
cout <<"Hello world!\n";
return;
Although ia have a right LD_LIBRARY_PATH setting, I get a error msg after running:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in java.library.path
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.<init>(Throwable.java:94)
at java.lang.Error.<init>(Error.java:50)
at java.lang.LinkageError.<init>(LinkageError.java:43)
at java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:42)
at java.lang.ClassLoader.loadLibrary(Compiled Code)
at java.lang.Runtime.loadLibrary0(Runtime.java:470)
at java.lang.System.loadLibrary(System.java:778)
at <Unloaded Method>
Any help will be appreciated.
From the exception message you submitted here i guess that you might try to load dll of name hello then problem is unable to find the dll refered by you.
Workaround:
Place the dll under same directory from where your program is excuted. Otherwise include the dll path to classpath this i'm not sure i have to test it.
Hope it might help you some extent.
regards
jayp
Similar Messages
-
How can i run this code correctly?
hello, everybody:
when i run the code, i found that it dons't work,so ,i hope somebody can help me!
the Ball class is this :
package {
import flash.display.Sprite;
[SWF(width = "550", height = "400")]
public class Ball extends Sprite {
private var radius:Number;
private var color:uint;
private var vx:Number;
private var vy:Number;
public function Ball(radius:Number=40, color:uint=0xff9900,
vx:Number =0, vy:Number =0) {
this.radius= radius;
this.color = color;
this.vx = vx;
this.vy = vy;
init();
private function init():void {
graphics.beginFill(color);
graphics.drawCircle(0,0,radius);
graphics.endFill();
and the Chain class code is :
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width = "550", height = "400")]
public class Chain extends Sprite {
private var ball0:Ball;
private var ball1:Ball;
private var ball2:Ball;
private var spring:Number = 0.1;
private var friction:Number = 0.8;
private var gravity:Number = 5;
//private var vx:Number =0;
//private var vy:Number = 0;
public function Chain() {
init();
public function init():void {
ball0 = new Ball(20);
addChild(ball0);
ball1 = new Ball(20);
addChild(ball1);
ball2 = new Ball(20);
addChild(ball2);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void {
moveBall(ball0, mouseX, mouseY);
moveBall(ball1, ball0.x, ball0.y);
moveBall(ball2, ball1.x, ball1.y);
graphics.clear();
graphics.lineStyle(1);
graphics.moveTo(mouseX, mouseY);
graphics.lineTo(ball0.x, ball0.y);
graphics.lineTo(ball1.x, ball1.y);
graphics.lineTo(ball2.x, ball2.y);
private function moveBall(ball:Ball,
targetX:Number,
targetY:Number):void {
ball.vx += (targetX - ball.x) * spring;
ball.vy += (targetY - ball.y) * spring;
ball.vy += gravity;
ball.vx *= friction;
ball.vy *= friction;
ball.x += vx;
ball.y += vy;
thanks every body's help!ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
and i changed the ball.pv property as public in the Ball class, and the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
2010-04-21
Fang
发件人: Ned Murphy <[email protected]>
发送时间: 2010-04-20 23:01
主 题: how can i run this code correctly?
收件人: fang alvin <[email protected]>
I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class. All of the properties in your Ball class are declared as private, so you probably cannot access them directly. They would need to be public. Also, I still don't see where you import Ball in the chain class such that it can use it. -
How can I run RT code in development mode on ni 9068?
This is my first time using NI 9068.
I set Disable RT Startup App in MAX and restart the RT, then click the RUN button on the vi. I saw the User FPGA 1 LED is flashing orange. I don't read any data the modules. I guess FPGA code not running.
Do I need re-deploy FPGA code when run in development mode?
Thanks for you help.I'm glad things are working for you now.
I wanted to add in something for anyone that may find this thread via Google at a later date.
The orange STATUS LED blinks in specific patterns to provide information about your cRIO. This is the LED you can go to your manual to read about the behavior.
The USER FPGA 1 LED is something you can set in your FPGA code. The behavior of this is not something that you can look in the manual to understand. The behavior is determined by the programmer, not the hardware. While it was a heartbeat in this case, it could be something as simple as turning the LED on when the program starts and turning it off when the program stops for another program. The programmer could opt to leave it off entirely. These are all appropriate uses of the FPGA 1 LED. These could all also be programmed to represent an error. That would also be an appropriate use. Use this LED as you see fit to tell you what is taking place on your cRIO. But, do not look into the manual for guidance as to what the LED is telling you. For that information, you'll need to take a look at the code.
Jeff B.
Applications Engineer
National Instruments -
How can I run JNI in websphere
Dear all,
I can run my JNI program with dll file called process.dll in ms dos platform. How can I run it in websphere? Please help me. Thank you!
Regards,
kzyoBy placing & making sure your dynamic link libary exists under the scope of ur classpath.typically @ /WEB-INF/classes folder.
tht is how it has to work with any typical webserver / appln server and i'm sure WAS is no exception. -
How can i run word through windows on my mac
how can i run word through windows on my mac
It is difficult to understand your question. Do you want to run Word in Windows on your Mac, or do you want to run Word on your Mac?
You can install Office for Mac.
http://www.microsoft.com/mac/products
Or you can install Windows and then install Office for Windows in your Windows installation. -
How can I run 2 keynote presentations on 2 different macs with only one keyboard?
How can I have 2 different keynote presentations that I want to run simultaneously through 2 different projectors, but I'd like to try and avoid using 2 keyboards - and use a hardware solution, rather than relying on my 2 fingers!! (it's a long conference!!!) thanks for any help.
Open the CSS in DW, and use F10 to open the Code Inspector.
Place the
latter as needed.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"Random_Yggdrasil" <[email protected]> wrote
in message
news:gi2htb$j4j$[email protected]..
> How can I run 2 Dreamweaver windows at the same time on
my PC?
> basically I have 2 monitors and I want to edit CSS on
one monitor and have
> the
> html page open on the other so I can quickly look from
one to another with
> in a
> split second instead of taking that extra time to switch
back and forth
> using
> the tabs at the top, I know I should probably invest
into a mac so i can
> work
> out side of the Dreamweaver application window and I
will in the future
> but is
> there any way i can do this on my windows XP pro PC?
>
> Thank you
> Maurice
>
>
> -
URGENT PLEASE:How can I run a a class file on the Apache server?
Hi Guys and Gurus,
I am seeking some favor all of experienced gurus, i.e.
How can I run a a class file on the Apache server? Can I run through an Applet?
How can I set Environment variables in Windows2000 Professional Environment?
Actually, I want to extract some records from a MySQL Database running on Apache Server. I wrote a program just to select the columns and show them. It is now a Class file, Now how can I run this class file from the Server???
The code is here
import java.sql.*;
public class RecordShow {
public static void main(String args[]) {
String url = "jdbc:mysql://localhost/myhost";
Connection con;
String query = "select mytable.column," +
"from mytable " +
"where mytable.column = 1";
Statement stmt;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection(url,
"myuser", "mypassword");
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
int rowCount = 1;
while (rs.next()) {
System.out.println("Row " + rowCount + ": ");
for (int i = 1; i <= numberOfColumns; i++) {
System.out.print(" Column " + i + ": ");
System.out.println(rs.getString(i));
System.out.println("");
rowCount++;
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
Please advise... THANKS
VJEhm, I wasn't referring to you at all... read up,
there's a comment by jschell saying that CGI might be
easier/better for his purposes.
Yep.
I know PHP/Perl/whatever might be easier for some
purposes, but only if you happen to know them and want
to/are able to use them. Ok. But you aren't the one asking the question are you. And the person who asked the question seems to have absolutely no familiarity with Apache or applets.
So whatever they do they are going to have to learn a lot.
And that does indeed suggest that in all likelyhood they have not investigated the alternatives.
And for the vast majority of internet applications, especially with smaller projects (obvious this person is not working with a large team), using perl, or something besides java, is going to be the best business solution. It is simpler, and more secure (probably due to the fact that it is simpler.)
Since this is a Java forum, I
answer under the assumption that people have made a
choice one way or another to use a Java solution to
their problem, so I try to solve it in Java first, and
only when that fails (very seldom) do I turn to other
solutions.You approach problems by arbritrarily deciding to try to solve it in java first and only if you fail do you then look to other solutions?
My first step is to try to figure out which of the various avenues is going to cost less. (And a secondary, but non-trivial concern, is then to convince the customer that just because they have heard of a buzz word like 'enterprise bean' that it doesn't mean that is a cost effective solution.) We must come from different worlds. -
How can I run Google Analytics on my site being hosted in Business Catalyst?
Hi,
I already have an existing website which is hosted, and of course I am the domain owner.
I have created a new modified site in Adobe Muse CC and will wish to upload this new site to my domain once completed.
I will need to run Google Webmaster tools etc before I replace the old site.
I do not wish to replace the old site as yet prior to completing the new site in Muse CC
At present I am "subscribed" to Google Analytics/Webmaster tools as a webmaster under my webmaster site (different) and have placed the "google verification code" metatag in my new site's "page properties <head></head tags only", and have uploaded to Business Catalyst.
Business Catalyst are not my hosts for this site once it becomes "live". They are my "Trial Hosts"
? how can I run google analytics and tools for this new site prior to lauch (ie replacing my old site) ?
Many thanks, await your response.
(PS... Latest Muse CC is ACE!... Love it!)I finally figured out what I was doing wrong. First the information has to be entered on the home page. So the path is Home page> Page properties> Metadata> HTML for <head>. Secondly I was entering the information from the downloaded html file rather than the code they provide under the alternate methods tab during the verification process . Google has a fine set of video tutorials to walk you through. https://support.google.com/webmasters/answer/35179?hl=en&ref_topic=3162387
Thanks for all your help!
Paula -
How can I send purchase order through SAP mail ?
How can I send purchase order through SAP mail ? Can any one explain whts the NACE settings?
just do it as <b>Anji reddy</b> said to you ...or else ... in the purchase order trascation ...print it ... so that it will generate the spool request for that purchase order ....
so the the belwo program is for sending <b>the Spool Request data as Email to any Email id ...</b>
The code below demonstrates how to retrieve a spool request and email it as a PDF document. Please note for the below program to process a spool request the program must be executed in background otherwise no spool request will be created. Once you have had a look at this there is an modified version of the program which works in both background and foreground. Also see transaction SCOT for SAPConnect administration.
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Girish -
Help:How can I run the J2EE Client Application? Thanks
Help:How can I run the J2EE Client Application that will access the remote J2EE1.4 application server which runs on another host computer?
I have developped a stateles senterprise java bean name converter and deloyed it in the j2ee1.4 application server on the host machine A. The converterbean provides the remote home interface and remote interface. At the same time I have developped the j2ee application client named convertappclient. When I access the conveter bean at host computer A through the script 'appclient.bat' as 'appclient -client convertappclient.jar', the client can access the bean sucessfully. Now I want to access the bean through the script 'appclient.bat' at host computer B,what files should I copy from host computer A to host computer B;and what the command line should be like? Thanks!
The following are the code of the enterprise java bean and it's home interface .
The client code is also provided.
The enterprise java bean:
package converter;
import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.math.*;
public class ConverterBean implements SessionBean {
BigDecimal yenRate = new BigDecimal("121.6000");
BigDecimal euroRate = new BigDecimal("0.0077");
public ConverterBean() {
public BigDecimal dollarToYen(BigDecimal dollars) {
BigDecimal result = dollars.multiply(yenRate);
return result.setScale(2, BigDecimal.ROUND_UP);
public BigDecimal yenToEuro(BigDecimal yen) {
BigDecimal result = yen.multiply(euroRate);
return result.setScale(2, BigDecimal.ROUND_UP);
public void ejbCreate() {
public void ejbRemove() {
public void ejbActivate() {
public void ejbPassivate() {
public void setSessionContext(SessionContext sc) {
The bean's remote home interface :
package converter;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ConverterHome extends EJBHome {
Converter create() throws RemoteException, CreateException;
The bean's remote interface:
package converter;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.math.*;
public interface Converter extends EJBObject {
public BigDecimal dollarToYen(BigDecimal dollars) throws RemoteException;
public BigDecimal yenToEuro(BigDecimal yen) throws RemoteException;
The j2ee application client:
import converter.Converter;
import converter.ConverterHome;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
System.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url","jnp://10.144.97.250:3700");
Context myEnv = (Context) initial.lookup("java:comp/env");
Object objref = myEnv.lookup("ejb/SimpleConverter");
ConverterHome home =
(ConverterHome) PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}Surprisingly I find an upsurge in the number of posts with this same problem. I recently found a post which gave a nice link for this. Follow the steps and it should help:
http://docs.sun.com/source/819-0079/dgacc.html#wp1022105 -
How can i run .app executable file
Hi,
While i was searching for my topic on google code, i found one project and i download that.
But its "MyProject.app" with yellow cplored xcode sumbol and i can not run this file.
Does any one know that how can i run this type of file. i want to run this project.
And another question. I want to create executable file from my project like exe on windows. Is there any way to create this type of file????
Thanks.vavdiyaharesh wrote:
Hey,
When i double click on .app file it quit and show me message like "The application project140 quit unexpectedly"........."
So is there any problem in .app file?
On your machine sure sounds like it.
How can i create exe file and how can i pass -0 to compiler ..iu don;t see any option in xcode for that.....
giove me solution...
I think you'd be better off taking some training, or at least working through some of Apple's tutorials.
http://developer.apple.com/documentation/developertools/conceptual/XcodeQuickTou r/qtintro/chapter_1_section1.html
Thanks.
You're welcome. -
How can retrieve my redemption code?
How can retreive my redemption code?
Also, what makes you think you need a redemption code? If you purchased your subscription online through Adobe.com there may not be a redemption code.
In the US, when I purchased the PS+LR bundle last year, once my payment was accepted, all I had to do was download, install, and log into the CC Desktop app from https://creative.adobe.com/products using the Adobe ID I used to purchase the products, and then I was offered PS and LR for download.
And whenever I want to run either one of those products I just need to be logged into the CC Desktop app. -
How can I run the report for different input values at the same time?
Reports version: Report Builder 6.0.8.13.1
Oracle version: Oracle8i Enterprise Edition Release 8.1.7.0.0
I want to run the same report for different input parameter values and spool each o/p to different file and ftp to a server. For this, as a first step, I am spooling different input values in to a file, reading those values through a loop and calling the report for that input values. Each report run/execution is taking 15 minutes. Total report execution is taking approximately 4 hours (assuming 16 different input values) to complete. So I have to wait 4 hours to see ALL outputs.
I would like to run the report parallel for ALL the input values and I should be able to see the ALL outputs with in 15 or 16 minutes.
In my shell script, I added & symbol at the end of the report call to start/run the job in the background. Due to this the control passed to the next step after the report call. At this place I have an ftp command to send the output file to a different server and it is giving error some thing like o/p file is not available/created yet". This is due to the fact that report writer is NOT yet completely started/initiated or it is NOT completed the spooling.
How can I run the report at the same time for all the input values and save the time?
Thanks in advance.
Kishore.Increase the number of server engines running right now it seems there is only one engine running ,increase it to 4 or 6
and then atleast 4 or 6 reports will run simultaneously.
For FTPing the output add to your sript to check whether it is locked and if not then only try to ftp .
Also for more better functionality read the document (chapter 15 ) for 10g reports for its new fuinctionality.
http://download.oracle.com/docs/cd/B14099_17/bi.1012/b14048/toc.htm
Thanks
Subodh -
How can i run a special name method of class?
i dynamic created a obj
and i don't know the method of class,
so i use a String parameter as the method's name
but how can i run the method?
please give me a copy of code, thanks!import java.lang.reflect.Method;
public class unknown{
public static void main(String[] args){
unknown thisObj = new unknown();
Class thisClass = thisObj.getClass();
// calling the method()
try{
Class[] allParamatersType = {};
Method mth = thisClass.getDeclaredMethod("method", allParamatersType);
String returnCallingAdd = (String)mth.invoke(thisObj, null);
System.out.println("calling add() : " + returnCallingAdd);
catch(Exception ex){
ex.printStackTrace();
// calling the method(int , string)
try{
String firstValue = "Testing";
Class[] allParamatersType = { firstValue.getClass() };
Object[] values = { firstValue };
Method mth = thisClass.getDeclaredMethod("method", allParamatersType);
String returnCallingAdd = (String)mth.invoke(thisObj,values );
System.out.println("calling add() : " + returnCallingAdd);
catch(Exception ex){
ex.printStackTrace();
public String method(){
return "method() called";
public String method(String two){
return "method(String) called"; -
How can I run a vi developed with 7 Express?
How can I run a vi developed with LabView 7 Express on another machine ? Do runtime versions exist ?
Apparently, you want to run it on a machine that does not have LabVIEW installed.
To make a standalone executable of your LabVIEW program, you need to have the Application builder (included in LabVIEW professional and higher, avaliable as an add-on for base and full).
To run the application, the target system need to have the LabVIEW 7.0 runtime installed (available as a free download).
There is also the LabVIEW Player. In this case you need to digitally sign your VIs and there are a few limitations. It is meant for for sharing code ideas and is not a viable substitute for the appl
ication builder.
Of course you could also get a second copy of LabVIEW.
Some other options that would work in a very narrow set of situations: Read your LabVIEW license agreement. Under certain conditions you are allowed to install a second copy of LabVIEW on your home computer. If this is for personal educational use only and you qualify, you could also buy the LabVIEW student edition.
LabVIEW Champion . Do more with less code and in less time .
Maybe you are looking for
-
Hyperlinks in MobileMe Gallery?
Is it possible to include hyperlinks anywhere in the descriptions of photos in MobileMe Gallery (or in iPhoto photo descriptions), that will get uploaded to MobileMe Gallery? Or is iWeb my only choice to achieve this? Thanks! Kenneth
-
What happened to my subscription order?
HI, I have purchased 10$ subscription in my account but the status shows it's pending. Moreover it also shows two pending orders of 10$ while I purchased only one. Please explain me what is going to happen next. Is skype going to charge me twice? I
-
Hyperion hal essbase adapter error
hi all, when using HAL, palnning componnent is working fine. When tring to use essbase adapter, I recieve an error: exception #1 error code 1000 could not create session i'm so Desperate. please Help! Thanks, Wendy :) Edited by: 956623 on 07:25 03/09
-
Store UTILMD Message type and EDIT
Hi , I need to create some Ztables to store the message type details in INBOUND and OUTBOUND IDOCS send from XI to SAP r/3 and R/3 to XI.(UTILMD,MSCONS,CNTL,APERAK).Is it ok to create tables with the same structure of EDIDC and EDID4 or i need to cho
-
Looking for Recovery disk for my Satellite A355D-S6921
Hey there, I can't start win7 anymore on my Satellite A355D-S6921, it reboots automatically before login screen. I tried to press the "0"(zero) Key, but no recovery options, nothing happens. I also tried to restore the drive to an earlier point using