Order of call in java
In the following code fragment, what is the order of call, can any of u help me?
class JSC201 {
static byte m1() {
final char c = '\u0001';
return c; // 1
static byte m3(final char c) {return c;} // 2
public static void main(String[] args) {
char c = '\u0003';
System.out.print(""+m1()+m3(c));
Thanks in advance
aah
main(), m1(), m3(c)
But it doesn't matter, as the 'c' inside m1() has nothing to do with the 'c' in main().
Similar Messages
-
Creating sales order using web dynpro JAVA
Hello everyone,
i am new to web dynpro. Can any one tell me how to creating sales order by web dynpro JAVA using BAPI.
Thanks.
Vinita SharmaHi...
you can use Adaptive RFC methodology in web dynpro java to work with BAPIs..... these are standard bapi's provided
Here are required Bapis... select which one you want....
BAPISDORDER_GETDETAILEDLIST Sales Order: List of All Order Data
BAPI_ORDER_CHANGE_STATUS_GET Change status for order
BAPI_SALESDOCU_CREATEFROMDATA Creating a Sales Document
BAPI_SALESORDER_CHANGE Sales Order: Change Sales Order
BAPI_SALESORDER_CREATEFROMDAT1 Sales Order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDAT2 Sales Order: Create Sales Order
BAPI_SALESORDER_CREATEFROMDATA Create sales order, no more maintenance
BAPI_SALESORDER_GETLIST Sales order: List of all orders for customer
BAPI_SALESORDER_GETSTATUS Sales order: Display status
BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
check this thread SALES ORDER creation using BAPI
sample java program which will call SAP bapi function sales order create
PradeeP -
Cant Call Stored Java Method Oracle 8I
I have some java code which I have compiled under the package schedsrv which I have loaded in the server with the loadjava facility
I created the procedure link using
create procedure as java using
schedsrv.ClassName.Procedure(java.lang.String, etc
I call the function and the server says no method name exists
for schedsrv/Classname where is the problem
I loaded the java from a .JAR and the classes were in a subdirectory called schedsrv and are in the .jarThis is the wrapper
create or replace procedure CreateScheduleEmp(EMP IN NUMBER, DID IN DATE, ENDD IN DATE) authid definer as language java name 'CreateScheds.processEmployee(java.lang.String,java.SQL.Date,java.SQL.Date)';
Called by
Execute CreateScjeduleEmp(1547,'00-JAN-00','07-JAN-00');
this is the class.
public class CreateScheds {
public CreateScheds() {}
public static void processEmployee(String emp, Date did, Date end) {
try {
CreateSchedules shed = new CreateSchedules();
shed.processEmployee( emp, did, end );
catch ( SQLException e ) {
System.err.println(e.getMessage());
it the class it creates and calls has an abstract base and is extended and completed in CreateSchedule which was written using
SQLJ.
The error I am getting says it can't find the
processEmployee method.
I tried it in a package which failed as well.
This is the class it calls
import java.lang.*;
import java.util.*;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.sql.Date;
// Note that java.SQL.Date (and not java.UTIL.Date) is being used.
#sql iterator DaySchedItr( String day_off, String start_time, String end_time, String int_type );
public class CreateSchedules extends EmployeeProcessor {
public CreateSchedules() {}
/** Get an agreement for the employee id.
@param emp is an employee_id code
@return the agreement id or null if not found.
@exception SQLException
protected String getAgreement( String emp ) throws SQLException {
String agree;
#sql { SELECT AGREEMENT_ID INTO :agree FROM SCHED.EMPLAGREE WHERE EMPLOYEE_ID=:emp ORDER BY FROM_DATE DESC };
return agree;
/** Get a collection of empldaysched records
@exception SQLException
protected DaySchedItr getDaySched( String agree ) throws SQLException {
DaySchedItr itr;
#sql itr = { SELECT DAY_OFF, START_TIME, END_TIME, INT_TYPE FROM SCHED.DAYSCHED WHERE AGREEMENT_ID=:agree ORDER BY DAY_OFF };
return itr;
/** Insert a single EmplDaysched record
@exception SQLException
protected void insertEmplDaySched( String emp, Date did, DaySchedItr itr ) throws SQLException {
String start_time, end_time, int_type;
start_time = itr.start_time();
end_time = itr.end_time();
int_type = itr.int_type();
int off = Integer.parseInt(itr.day_off(),10);
off--;
#sql { INSERT INTO SCHED.EMPLDAYSCHED(EMPLOYEE_ID, DATE_ID, START_TIME,
END_TIME, INT_TYPE, STATUS)
VALUES( :emp, :did+:off, :start_time, :end_time, :int_type, 1 )
/**public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
@param String empl. The employee number employee_id
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
If the employee is not assigned an agreement nothing happens.
public void processEmployee( String emp, Date did, Date end ) throws SQLException {
String agree;
DaySchedItr itr;
agree = getAgreement(emp);
if ( agree == null )
return;
itr = getDaySched( agree );
while ( itr.next() )
insertEmplDaySched( emp, did, itr );
itr.close();
#sql { COMMIT };
class TheTester3 extends Object {
public static void main(String args[]) throws SQLException {
String emp;
Date did, end;
Oracle.connect(CreateSchedules.class, "connect.properties");
CreateSchedules shed = new CreateSchedules();
emp = "2547";
did = new Date(100,0,1);
end = new Date(100,0,7);
shed.processEmployee( emp, did, end );
//shed.processEmployees( "999987654321", did, end );
//shed.processAllEmployees( "test", did, end );
This is the base class
import java.lang.*;
import java.util.*;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.sql.Date;
// Note that java.SQL.Date (and not java.UTIL.Date) is being used.
#sql iterator EmplItr ( String employee_id );
#sql iterator GrpItr ( String walloc_string );
/** A base class to process employees
Supports three methodologies for selecting employees
1. Process a single employee for a date range
2. Process all employees having a common walloc string selection
3. Process all employees in an authority group. An authority group
may handle multiple walloc string selections.
public abstract class EmployeeProcessor {
/** Single method that each derived class must implement
public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
@param String empl. The employee number employee_id
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
/** Method to extract all employees with a given Group Authority ID
public void processEmployees( String walloc, Date did, Date end ) throws SQLException {
@param String Walloc. The first part of a walloc string only the length of this string is significant
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public void processEmployees( String walloc, Date did, Date end ) throws SQLException {
int len = walloc.length();
EmplItr itre;
#sql itre = { SELECT EMPLOYEE_ID FROM SCHED.EMPLPROF WHERE SUBSTR(WALLOC_STR,1,:len)=:walloc };
while ( itre.next() ) {
processEmployee( itre.employee_id(), did, end );
itre.close();
/** Method to extract all employees with a given Group Authority code
public void processAllEmployees( String grp, Date did, Date end ) throws SQLException {
@param String Group. The Group Authority code
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public void processAllEmployees( String grp, Date did, Date end ) throws SQLException {
GrpItr itrg;
String walloc;
#sql itrg = { select WALLOC_STRING from sched.USER_GROUPS where authority=:grp };
while ( itrg.next() ) {
walloc = itrg.walloc_string();
walloc = walloc.trim();
processEmployees( walloc, did, end );
itrg.close();
null -
I made an example which works fine in the JAVA main
Thread, but crash in a new Thread, Why?
Is it possible to do something like that?
if no, how?
Main example:
same code but without thread
Thread example:
public class UserThread extends Threads{
private MyJNIObject myJNIObject;
public UserThread(){
try{
System.loadLibrary("myDLL.dll");
}catch(UnsatisfiedLinkError e){}
this.myJNIObject = new MyJNIObject();
public void run(){
this.myJNIObject.run();I guess that you load myDLL.dll to implement Java native methods. To realize the problem you should know the mechanizm of this process.
1. Java native methods are implemented by java.lang.ClassLoader while this class is being loaded,
2. At this moment System.loadLibrary("myDLL.dll"); should be called, because java.lang.ClassLoader looks for export functions in DLLs already loaded to implement Java native methods,
3. You call System.loadLibrary("myDLL.dll"); in non-static block but in some method when native methods should be already implemented.
4. java.lang.ClassLoader cannot find DLL with proper export functions and thows an exception (it happens before the method with System.loadLibrary("myDLL.dll"); is called).
My recomendations:
- call System.loadLibrary("myDLL.dll"); in a static block of the class with native method implemented (or in some place you sure that JVM will know where to get functions while loading a class with native methods),
- put the same block in other classes which native methods will be implemented, because you do not know the order in which these classes will be loaded. -
Strange problem with procedure calling from Java!!!
I am using Oracle 8.1.7 Database, Oracle 8i Application server and WInNT platform.
I am facing a strange problem while inserting a String from Java to Oracle database through Procedure. When i am passing the String containing single quotes(e.g "test' and ' and ' end") and without including any escape charactes for the single quotes I am passing the String by the setString() method then the procedure is inserting the single quotes without any problem.
Of course when I am independently executing the procedure thru backend and passing the same String containing single quotes then the error message comes as " quoted string not properly terminated" which is justified,
I have even printed the String in a file through sql on the runtime of the procedure when it is called by Java and then also the String contatins single quotes that is passed through java without any escape characters. This means that procedure is inserting the String into the column without any hassles!!!!!
Can anyone tell me what may be the reason for the peculiar behaviour of Database?
ThanksSri Ram wrote:
No actually in the documentation of oracle database 10g plsql user guide, oracle explains the concept of declaring nested plsql subprograms he gave the example but in the main block he gave NULL, without calling any procedure.Can you provide a link to where in the Oracle documentation you saw this example?
in order to know which procedure is getting first i added a dbms statement in both the functions and called the function from the main block.
the original example was
DECLARE
PROCEDURE proc1(number1 NUMBER); -- forward declaration
PROCEDURE proc2(number2 NUMBER) IS
BEGIN
proc1(number2); -- calls proc1
END;
PROCEDURE proc1(number1 NUMBER) IS
BEGIN
proc2 (number1); -- calls proc2
END;
BEGIN
NULL;
END;
---------------------------------------------------------------------------------------------------------The original example is equivalent to:
BEGIN
NULL;
END;That is, the main block never calls anything. Either you are misinterpreting the Oracle documentation, or if the example came from a non-Oracle source as I suspect, the author of that example has a deeply flawed understanding of how programming works.
John -
Hi,
I'm having a problem in calling the Java Applet's Function from Visual Basic. First, I'm getting the handle of the Java Applet and components of it using "Document.Applets(n)" which is a HTML function. I'm calling this function from Visual Basic. My code is something like this...
' // Web1 is IE Browser in my Form.
Dim Ap,Comp
Dim Bol as Boolean
Bol = true
Ap = Web1.Document.Applets(0).getWindow() ' \\ Gets the Parent Window.
Ap.setTitle("My Java Applet") ' \\ Sets the Title of the window.
msgbox Ap.getVisibility() ' \\ This will return a Java boolean ( true or false )
Ap.setVisibility(Bol) ' \\ Function Syntax is : void setVisibility(boolean b)
Here in my code , i'm able to call any function that which accepts Integer or String but not boolean. So, i m facing problem with Ap.setVisibility() function. It gives me a "Type mismatch error" while executing it. Can you please tell me a way to do this from Visual Basic !
I'm using Visual Basic 6.0, Windows 2000 , J2SDK 1.4.2_05.
Please help me Friends.
Thanks and Regards,
Srinivas Annam.Hi
I am not sure about this solution. try this
Declare a variable as variant and store the boolean value in that variable and then use in ur method.
Post ur reply in this forum.
bye for now
sat -
How to call a C function calling a Java Method from another C function ?
Hi everyone,
I'm just starting to learn JNI and my problem is that I don't know if it is possible to call a C function calling a Java Method (or doing anything else with JNI) from another C function.
In fact, after receiving datas in a socket made by a C function, I would like to create a class instance (and I don't know how to do it too ; ) ) and init this instance with the strings I received in the socket.
Is all that possible ?
Thank you very much for your help !Hard to understand the question, but by most interpretations the answer is going to be yes.
You do of course understand that JNI is the "API" that sits between Java and C and that every call between the two must go through that. You can't call it directly. -
How can I call a java class from within my program?
I was wondering if there's a platform independent way to call a java class from my program.
Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.
-
How can I call a java object from Web dynpro ABAP application?
I made Web dynpro ABAP application and posted it to SAP EP.
For certain business purpose, we need to call external 3rd party java object using 3rd party's java api in Web dynpro application.
Is there anybody who experienced this kind of java interface issue?
I know Web dynpro Java environment can fully support this kind of requirement. but regarding Web dynpro ABAP, I couldn't find any clue for this.
Any comment or suggestion would be greatly appreciated.
Thanks,
Raymond, ABAP Consultantif you have jco configured, then you can make calls to java api from ABAP .
check out this weblog.
/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
Raja -
How to call a Java class from another java class ??
Hi ..... can somebody plz tell me
How to call a Java Class from another Java Class assuming both in the same Package??
I want to call the entire Java Class (not any specific method only........I want all the functionalities of that class)
Please provide me some slotuions!!
Waiting for some fast replies!!
Regards
Smita MohantyHi Smita,
you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
e.g.
you have developed A.java and B.java, both are in same package.
in implementaion of B.java
class B
A obj = new A();
//to access A's methods
A.method();
// to access A's variable
//either
A.variable= value.
//or
A.setvariable() or A.getvariable() -
How to call a java script in while eventprocessing?
hi friends,
How to call a java script from an event.
when i click a button, i want to display a message in IE.
For ex: BTN_CAN,
When i click on this in IE i want show a message like "clicked on cancelled".
how can i do this.....
in javascript WINDOW.ALERT i am trying....
Regards,
Shankar.you can do some thing like this...
< % @ pa g e la ng uag e="a b ap" %>
< % @ e xte n sion name="htmlb" prefix="h tm l b" % >
< h t m l b:co nt e nt d es ign="design2 00 3" >
< ht m lb:page title=" " >
< h tm lb :for m >
< h t mlb:textVi ew text = "Hello World!"
des ign = "EMPHASIZED" />
< ht m lb :bu tton text = "Press Me"
on Clie ntC lick = "al ert(' H ell w or l d')" / >
< / h t mlb :for m >
< / ht mlb :pa g e >
< / htm lb:co nt e nt >
Edited by: Vijay Babu Dudla on Oct 6, 2008 7:20 AM -
How to call a java script?
Hi,
I m new to Indesign and also to MAC OS...
I ve tried the sdk samples of InDesign CS3 on MAC OS. It works well.
I m making changes to one of the samples (BasicPanel). I ve added few check boxes and buttons in it. I donno where to give the code for button(in the panel) event/action?
I also need to know "how to call a java script from InDesign CS3 SDK ?"...
I have the Scripts ready... Can someone provide the code used to call JS...
Someone pls help me.....
Thank You...Here s the code to call a Javascript:
IDFile scriptFile;
FileUtils::GetAppInstallationFolder(&scriptFile); //application folder path
FileUtils::AppendPath(&scriptFile, PMString("Scripts", -1, PMString::kNoTranslate));
FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel", -1, PMString::kNoTranslate));
//inside the scripts panel, append path of the folder in which ur script is present.
//Suppose, ScriptsPanel->NewFolder->Link.jsx
FileUtils::AppendPath(&scriptFile, PMString("NewFolder", -1, PMString::kNoTranslate));
FileUtils::AppendPath(&scriptFile, PMString("Link.jsx", -1, PMString::kNoTranslate));
InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
bool filestatus=scriptRunner->CanHandleFile(scriptFile);
if(filestatus==1)
scriptRunner->RunFile(scriptFile,kTrue,kFalse);
Regards,
tnhems -
How to call a java class in a bat file
Hi
I need to call a Test.java class in a bat files .It refer .DOM.jar
in C:/url; How do i call the java class i need the syntax
Thanks lotassuming lanch.bat, Test.class and DOM.jar are in c:\url
assuming %JAVA_HOME% is defined (else substitue it with your java installation directory)
here is the content of launch.bat:
cd C:/url (or cd c:\url ) (or cd c: followed by cd url)
%JAVA_HOME%\bin java -classpath .;DOM.jar Test
hop that'd help,
marvinrouge -
How to call the java method in java script function in a portal application
Hi Friends,
I am developing one application where i need to fetch the data from KM content and displaying it on the screen in regular interval. I wrote one method in JSPdynpage for fetching data from KM content now I need to call that java method in java script function.
java method(IComponentRequest request)
//Coode for fetching the KM content
function()
<b>//Need to call the java method</b>
setTimeout(function, 5000);//setting the time interval for this function
<<htmlb display code>>
If anybody can help me in calling the java method in java script function that will be very helpful for me.
Thanks in advance,
Sandeep BonamHi,
Pls see if the following links could help.
http://www.rgagnon.com/javadetails/java-0170.html
http://www-128.ibm.com/developerworks/library/wa-resc/?dwzone=web
Regards -
How to call a java method in a Stored procedure
Hi.,
I was trying to call a method in a stored procedure
This was my procedure
CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
AS LANGUAGE JAVA
NAME 'FileCopy.copyfile(String,String)'; // calling a java method
/ this was my java method
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
import java.io.File;
import java.io.IOException;
import java.io.FileReader;
import java.io.FileWriter;
import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.FileImageOutputStream;
import java.security.AccessControlException;
public class FileCopy {
// Define variable(s).
private static int c;
private static File file1,file2;
private static FileReader inTextFile;
private static FileWriter outTextFile;
private static FileImageInputStream inImageFile;
private static FileImageOutputStream outImageFile;
// Define copyText() method.
public static void copyfile(String fromFile,String toFile) throws AccessControlException
// Create files from canonical file names.
file1 = new File(fromFile);
file2 = new File(toFile);
// Copy file(s).
try
// Define and initialize FileReader(s).
inTextFile = new FileReader(file1);
outTextFile = new FileWriter(file2);
// Read character-by-character.
while ((c = inTextFile.read()) != -1) {
outTextFile.write(c); }
// Close Stream(s).
inTextFile.close();
outTextFile.close(); }
catch (IOException e) {
System.out.println ("-------"); }
// return 1;
public static void main(String[] args){
switch(args.length){
case 0: System.out.println("File has not mentioned.");
System.exit(0);
case 1: System.out.println("Destination file has not mentioned.");
System.exit(0);
case 2: copyfile(args[0],args[1]);
System.exit(0);
default : System.out.println("Multiple files are not allow.");
System.exit(0);
};while i am executing this method i m getting error as
ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help meLooks like it is a matter of not quite the same namespace for String object.
I can get it to work by the java source containing:
public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
Addendum:
You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM
Maybe you are looking for
-
Hi, Our reports run very slow in SharePoint Integrated mode. I look at the logs and I see that for one report request there are bunch of "Forced due to logging gap" rows. Is it some kind of a configuration issue or is it working as it should. Below i
-
What am I supposed to do with ".do" files?
My HSA (health savings account) gives me all its statements in files ending in ".do". What is this? I can't get any application to read files like that. What should I do with them? What does ".do" mean?
-
Core Duo compared to development kits
Do you think that the Core Duo's are faster than the development kits? I know there are a lot of other differences but are two processors running at 2.0 Ghz faster than one running at 3.6? I am all for having a dual processor iMac, just wondering if
-
Problems with the license N4S Linux NW 7.0 Testdrive MaxDB
Dear all, I have a curious behaivor with my testdrive. On every OS start, the system has a different HW-Key!? Now I've requested and installed after the installation the license key for the first HW-Key. Successfully installed the license key via tra
-
DHCP loadsharing with redundant Guest Anchor Controllers
Hi I have 2 x Redundant Guest Anchor Controllers (5508) located in 2 separate Data Centres with all the management and guest user VLAN spanned between two. Everything is working fine with the Guest WiFi access except the DHCP functionality as the Con