How to define package

hi ...i m new to java.........
i want my class should work as a package........and can be imorted in another class........so how to define my class as a package....and how to import it???

thanks for ur help .........i tried that .but,i didnt get it...........here is my code: ----->>>
//this a class Account i want it work as package
package MyPackage;
public class Account
     int ActBalance;
     public Account()
               ActBalance=0;
     public void deposite(int dAmt)
          ActBalance+=dAmt;
     public void withdraw(int wAmt)
          if(ActBalance>=wAmt)
               ActBalance-=wAmt;
          else
               System.out.println("NOT SUFFICIANT BALANCE");
     public int getBalance()
          System.out.println(ActBalance);
          return ActBalance;
//this is the class containing main method,where i want to import that package..............
import MyPackage.*;
public class Test
     public static void main(String args[])
          Account a=new Account();
               a.getBalance();
               a.deposite(10000);
               a.getBalance();
               a.withdraw(2000);
               a.getBalance();
// And these are errors i m getting
Test.java:1: package MyPackage does not exist
import MyPackage.java;
^
Test.java:6: cannot resolve symbol
symbol : class Account
location: class Test
Account a=new Account();
^
Test.java:6: cannot resolve symbol
symbol : class Account
location: class Test
Account a=new Account();
^
3 errors

Similar Messages

  • How to use user-defined packages in JAX-RPC web service

    I am trying to use Object of my class located in my package in jax-rpc webservice,the code is
    package supercomputer;
    import Hello.*;
    public class SuperImpl implements SuperIF
    public String sendParam(String data)
    Temp ob=new Temp();
    int i=ob.get1(10000);
    return data+"returned by supercomputer";
    Temp is located in Hello package,I have jar the Hello package as Hello.jar and has set its classpath in targets.xml of Ant tool.
    The code compiles well and service is deployed successfully,but when i try to call the service from the client its gives me following error.
    [echo] Running the supercomputer.SuperClient program....
    [java] java.rmi.ServerException: Missing port information
    [java] at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
    [java] at supercomputer.SuperIF_Stub.sendParam(SuperIF_Stub.java:60)
    [java] at supercomputer.SuperClient.main(Unknown Source)
    I dont know if it deploys why it gives error on client side.
    Please tell how to use user-defined packages and class in jax-rpc service code ,i am not talking about passing user-defined parameters i am just talking about making objects of user defined classes in jax-rpc service.I think there is some problem in classpath.
    Please guide me in doing that.
    Thanks,
    Farrukh

    Farrukh,
    I don't know if your error is about a missing class from your custom package, ... what track did you followed to say that?
    To use your package in the implementation of you web service, you should only follow the rules of making a web application: put your package jar in your \lib directory inside WEB-INF/ or your package classes unjared in classes (also in WEB-INF/).
    As I already said, I have doubts that your error should be originated from a missing class from your package, but:
    -try to see the logs (errors?) when you deploy your web service that could give a hint about the problem.
    -try to see if you can access your endpoint through your browser to see if there is a online status
    -display your config/WSDL file, and the steps you did to build your web service.
    regards,
    Pedro Salazar.

  • How to make an applet load user-defined package?

    How to have an applet load user-defined package?
    I have packages in their own directories, and the applet compiles and links with them, by use of CLASSPATH env variable. But when it comes time to run, it ignores that and does not know where the classes (in the packages) are.
    If I don't use packages and put all code in one directory, runs fine. If I use an application, I can link with and load my packages.
    I know applets can't use things like CLASSPATH for security reasons, but still, they should be able to be compiled out of several packages, why do I have to put all code together??

    OK, for reference for future newbies, here's the answer:
    use CODEBASE attribute in your html file (if on Windows server, don't use drive letter but relative path to .html file, Unix style, and put all your .class files beneath that, for example, in your .html file
    <applet
    CODEBASE="..\class
    and then have package bar Bar.class file, in ..\class\bar

  • How to view defination of already defined packages ?

    Hi,
    how can i view defination of a already defined package? Its spec and its body?

    Hi,
    user12222356 wrote:
    My package name is 'PackageTest1' , since at the time of creation i had given that name.
    But while writing this query
    select text from user_source where name='PacklageTest1'no row is selected, and when i give this command
    select text from user_source where name='PACKAGETEST1'defination is shown .But why only capital letter package name is identified ?One reason is that the names are different; there's an 'l' (5th character) in 'PacklageTest1', but not in 'PACKAGETEST1'.
    A more subtle reason is that identifiers in Oracle are case-sensitive. You can have one package called
    "PackageTest1", another called
    "Packagetest1" (with a small 't'), another called
    "PACKAGETEST1" (all capitals), another called
    "pAckAgEtEst1" (vowels capitalized),
    all in the same schema.
    Normally, the parser capitalizes all unquoted text, so if you say
    EXEC  packagetest1.foo ('Hello, world!');what actually gets compiled is
    EXEC  PACKAGETEST1.FOO ('Hello, world!');If you actually have an identifier with lower-case letters, then you have to use quotes around it; double-quotes, in places where you don't want it mistaken for a string literal:
    EXEC  "PackageTest1"."Foo" ('Hello, world!');or single-quotes when it really is a string literal:
    select       text                     -- Column name is actually TEXT, but lower-case will work here
    from      user_source                -- View name is actually USER_SOURCE, but lower-case will work here
    where     name     = 'PackageTest1'     -- String literal is already quoted
    and       type     = 'PACKAGE BODY'     -- If you don't want source code from package spec mixed in
    order by  line                    -- Only way to make sure output is in order
    ;

  • How to define RFC parameters

    Hi Experts,
    i am using a RFC FM to from SRM system to ERP system. in ERP system the RFC FM parameters refer to some structures or tables which are not in SRM system.
    but i should transfer these parameters in SRM system to call this RFC.
    can anyone tell me how to define the parameters in SRM system?

    Hello,
    I also had to work with RFC to call SRM function module from an ECC system. I recommend you very strongly to create your own RFC function module in SRM and your own DDIC structures in both systems with just the fields you need. This custom SRM RFC function module, map the parameters to the standard 100+ field DDIC structure and call the SRM function module (not using RFC at this time of course).
    Why did I say "very strongly" : DO NOT duplicate the 100+ field DDIC structure from SRM to your RFC client system (by transport or manual copy), because some support packages add fields to some include structures of the complex structure, and they are inserted somewhere in the middle, and so it probably makes obsolete your duplicated DDIC structure.
    Hope it's clear
    sandra

  • How to specify PACKAGE SIZE for to RFC_READ_TABLE from PyRFC?

    I'm trying to use PyRFC to extract large tables via RFC_READ_TABLE (due to an uncooperative/unsupportive basis team).
    I know that RFC_READ_TABLE supports calling it with PACKAGE SIZE since ERPConnect does it by default.
    In Python for Basis (Part 1), I learned how to specify an Open SQL where clause using the OPTIONS:
    result = connector.call('RFC_READ_TABLE',
                           QUERY_TABLE=tablename,
                           DELIMITER=delimiter,
                           OPTIONS = [{'TEXT':where_clause}])
    Is there a way, and how to specify PACKAGE SIZE in this case?
    Thanks

    Hi,
    the package size works, but you need to call the function module multiple times in a loop. Here's an excerpt of the attached script:
    recordcounter = 1          #needs to be >0 to get the while loop going
    iteration = 0              #the number of times the function module got called
    while recordcounter > 0:  #as long as the function module calll returns rows...
        tempresult = self.call('RFC_READ_TABLE',             
                                ROWSKIPS=iteration*fetchsize,  #defines the number of rows to skip
                                **parameters)
        iteration=iteration+1  #increase the iteration
        data = tempresult['DATA']    #assign the returned rows to a variable
        if len(data) > 0:      #have there been any rows?
            for row in data:      #Do something with them
        else:
            recordcounter=0    #set recordcounter to 0 to end the while loop.
    The script is far away from being perfect. It doesn't deal with RAW fields and the data types it returns are all strings. It does what I needed it to do but it may not be sufficient for what you may be trying to achieve.
    Best regards
    Lars

  • How to define a queue in SPAM?

    how to define a queue in SPAM?
    And also tell me the steps or procedure to apply support packs .

    Hello kumar,
    - Download the support packs from service.sap.com (provided you have a login ID) to the usr\sap\trans directory.
    - Open a command prompt and change the directory to
    NT: :\usr\sap\trans
    UNIX: /usr/sap/trans
    - Unpack the support packs using the following command:
    NT: CAR -xvf :
    .CAR
    UNIX: CAR -xvf ///.CAR
    This command unpacks the files that need to be imported into your SAP instance into the usr\sap\trans\eps\in directory.
    - Log into client 000 as user DDIC
    - Call transaction SPAM
    - Once in transaction SPAM, go to menu option Support Package->Load Packages->From Application Server. It will ask you if you want to upload the files - click the green check mark on the box that appears to upload the files.
    - Another screen will appear listing the files that you uploaded successfully - just click on the Back arrow to get back to the SPAM screen.
    - On the SPAM screen, click on the Display/Define button.
    - A box will appear with the Support Package categories (Basis, ABA, etc.)
    - Click on the category for the support packages that you uploaded and it will list them in order.
    - You can apply them individually or the whole list at one time.
    - To apply individually, select the first one in the list and then hit the green check mark at the bottom left of the box. Then on the SPAM screen, go to menu Support Package->Import Queue.
    - Confirm that you want to import the support package.
    - Once it is done importing, you have to confirm the queue by clicking on the
    Confirm Queue button - this will turn the yellow light in the Status area to green.
    *Always check your logs after applying support packages by clicking on the Logs button in the SPAM screen.
    Regards,
    Raju.

  • How to define shift

    how to define shift?

    Do the following setting in spro for Shift:
    Define Shift sequence in SPRO(Production>>> basic Data>>>work center>>>capacity planning>>>Availabale Capacity>>>define shift sequence)
    In this step you define the following:
    Grouping
    Using the grouping you can create shift sequences and shift definitions for special areas (for example, different plants or different areas of a plant) and when maintaining the available capacity choose from between work centers.
    Work break schedule
    Here you define parameters that describe the individual work break schedules in more detail, as for example:
    Start
    Finish
    Break times
    Shift definition
    Here you define the parameters common to several work centers that describe the individual shifts in more detail, for example:
    Start
    Finish
    Break times
    Validity period of a shift
    In Logistics (LO) you can reference daily work schedules from the personnel system (HR). If you reference a daily work schedule in LO from HR and this is changed in HR then this change has a direct effect on changes in LO.
    Shift sequences
    You can assign the shift sequence of a capacity category as the available capacity at the work center.
    You define a sequence of shifts per weekday. The shift sequence represents a collection of shift definitions.
    In capacity planning the system uses the predefined values from the shift definition to determine the available capacity of a work center.
    The system calculates the following values:
    the capacity
    the actual operating time for the capacity
    Standard settings
    The SAP standard package contains settings for various shift sequences.
    Activities
    You should define the following:
    1. groupings
    2. shift sequences
    3. shift definitions
    4. work break schedules
    Assign this in work center capacity tap, under intervals and shifts.
    Regards
    PP

  • How to define our own selection screen for logical database  in abap-hr?

    Hi Friends,
    Can u please help me
    How to define your own selection screens for  logical database.
    we use to do like(goto->attributes-HRReportcatagerious ).but How to desin using  customer table like t599c, t599f and how to add to my logical database?
    Thanks in advance
    charan

    check out this online help
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba65c35c111d1829f0000e829fbfe/frameset.htm
    Regards
    Raja

  • How to define namespace with one XSD using in two different DB-Locations ?

    I'm not clear,How to define namespace, targetnamespace, schemaLocation or NoNamespaceSchemaLocation
    when using one common schema.xsd-definition
    in two different database-locations for exchange xml-documents?
    when insert xml-document I've got an error ORA-30937
    do you have an good exsample ?
    thanks
    Norbert
    schema :
    <xs:schema
    xmlns="http://sourcehost.com/namespace"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:oraxdb="http://xmlns.oracle.com/xdb"
    targetNamespace="http://sourcehost.com/namespace"
    xml-document :
    xmlns="http://Sourcehost.com/namespace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:SchemaLocation="http://sourcehost.com/namespace http://desthost:8080/sys/schemas/PUBLIC/ADRESSEN.XSD">
    SQL> insert into ADRESSEN values
    (XMLType
    (bfilename ( 'XMLIMPORT_DIR', 'adressen.xml')
    , 0 )
    --> error :
    ORA-30937: No Schemadefinition for "SchemaLocation" (Namespace "http://www.w3.org/2001/XMLSchema-instance") in übergeordnetem Knoten "/ADRESSEN"

    Norbert
    The schema location used to register the XML schema with XML DB does not need to be a valid URL for accessing the XML Schema
    I can use the same URL , for instance
    http://xmlns.example.scom/xsd/myXMLSchema.xsd
    on machines dbserver1, and dbserver2. The only reason some people choose to use the hostname / portnumber convention is that this makes it possible to validate the XML Instance documents against the copy of the XML schema stored in the XML DB repository using an external tool like XMLSpy without have to add entries to XMLSpy's OASIS catalog files.
    I am concerned about the message you are getting. That's not correct AFAICT but I'd need to see the complete XML Schema and Instance to be sure.

  • How to define BPC architecture?

    Hi All,
    Iu2019m a BI and BPS consultant and Iu2019m doing a prototype for evaluating BPC for Sales Planning and I need some help.
    Process flow as:
    a.     Extract sales from COPA (amount and quantities);
    b.     Copy Actual to Budget version;
    c.     Create new customers;
    d.     Delete old customers;
    e.     Calculate the seasonality of sales & and adjust budget;
    f.     Load & adjust prices
    g.     Load & adjust sales costs
    h.     Calculate Net Revenue
    i.     Calculate costs
    My file format is as given below:
    Account|Category|Time|RptCurrency|Entity|Customer|Product|Amount|Quantity
    Questions:
    1- There is a specific KF to load quantity or I should use another account? If so how do I load the unit measures?
    2- I tried to load my file in u201CEuru201D but I received an error. The upload only finished OK when I changed the currency to u201CLCu201D. There is any trick?
    3- In customer dimension, I add the sales org. attribute but it didnu2019t work out because a customer can have more than one sales org. There is any way to define a compound key for a dimension?
    4- Where can I find relevant documentation about BPC?
    Thanks for reading my post.
    Regards, Fred

    Hi Shyam!
    Thanks for your answer.
    1. I followed your suggestion and load the data twice (one for amount and another for quantity) but I still have de unit measure problem (KG, TON, etc.). Any suggestion about how to handle this situation?
    2. Yes is easy for me to convert LC in any other currency after the data load. But the problem is that I must load data in multiple currencies (EUR, USD)u2026
    3. No it didnu2019t work out. Let me give you an example:
    Customer       Sales Org            Distribution Channel
    100001      AX01          1
    100001      AX02          2
    When I tried to process dimension I received the following message u201CMember ID must be   uniqueu201D. Any other idea about how to define the compound key Customer and Sales Org?
    Regards,
    Frederico

  • How to define Composite primary key for a Table

    Hi ,
    I am basically more into Java Programming , with little bit knowledge on Oracle as DataBase .so please excuse for my silly doubts .
    Can anybody please tell me how to define a Composite Primary Key on a Table .
    Thanks in advance .
    Edited by: user672373773 on Sep 25, 2009 8:54 AM

    Here is an example right out of the Oracle documentation and the syntax for adding PK since you mention adding a composite PK.
    Example creating composite index
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_indexing.htm#sthref594
    Syntax for adding a PK (composite or not)
    alter table oooooooo.tttttttt
    add constraint tttttttt_PK
    primary key (sample_column2,
    sample_column1)
    using index
    tablespace IDXSPC
    pctfree 05
    initrans 04
    maxtrans 08
    storage (initial 16k
    next 16k
    maxextents 32
    pctincrease 0);
    -- dictionary management with restricted storage, change as desired.
    HTH -- Mark D Powell --

  • How to define default element in SAP-Script?

    Hi Guys,
    How to define default element in SAP-Script?
    Can you tell me to do this...is it possible in all the windows or only in main window?
    Regards,
    GURU

    Hi,
    Welcome to SDN
    You can't post ur questions in other's threads .Open a new thread.
    click on post new thread and open new thread.
    Regards

  • How to define a Custom Action in VC 6.0 ?

    Hi all
    I want to know how to define a custom action like for a check box UI Element, I want particular action to be performed when it is checked ? How can I achieve this in VC 6.0
    Please feel free to ask me if my question is unclear ?
    Regards
    Kapil

    Hi,
    Try adding an expression element on your form.
    Go to the Expression control properties and in the Expression attribute enter
    IF(@Selected==true,"X"," ")
    @Selected is the checkbox. For your function call input use the expression element and not the checkbox.
    Hope this helps. Let me know if it works.
    Thanks.

  • How to define ABC class field in the Customer Master Sales tab

    HI All,
    can any one let me know how to define the new  ABC class in the Customer Master Sales tab like below.
    u2013 A (> 6,000,000 )
    u2013 B (> 1,000,000u20136,000,000 )
    u2013 C (> 100,000u20132,000,000 )
    u2013 D (< 100,000 )
    can any one let me know how to define and path in IMG.
    Thanks in advance.
    kumar reddy.

    In my opinion, you don't have any such std table/view to update ABC Classification field. You might need to update relevant infostructure based on your requirement, such as sales, invoiced, etc..
    Try with following, based on your requirement:
    MC(A
    SIS: Customer,Inc.Orders - Selection
    MC+A
    SIS: Customer Returns, Selection
    MC+E
    SIS: Customer, Sales - Selection
    MC+I
    SIS: Customer Credit Memos - Selec.
    Regards
    JP

Maybe you are looking for

  • No graphics in vista using media live AM2

    I have just built my second media live, based on AMD Athlon 64 X2 4850e 2.5GHz Socket AM2 and 4gb of 667mhz crucial memory - see see http://www.ebuyer.com/product/142387 and 1TB Samsung Green HDD. My first Live, would not play any videos at all, just

  • 4.0 EA2 - Autofit not working properly in Query Result grid

    Hi, in 4.0 EA2 the Autofit isn't working properly in Query Result grid. Rather than shrinking columns to the narrowest size that accommodates headings and contents (as per 3.2), it auto-expands to fit the whole data query grid. It looks worse, and ma

  • Adding Items to the Same Album

    After Uploading a fair few MP3's from my friend's external hard-drive, I found that they weren't correctly named, and decided to rename them. I tried to find the CD track names, but some of the album names were not correct. After renaming them, I fou

  • BT email times out far too fast

    (Please answer by email, not by phone.) When I am logged in to BT Email, the email page shuts down in a minute or two and I must re-open it. Why is this? Earlier today the BT Email kept on dropping while I was typing a message. Please allow the BT Em

  • Editable App World Reviews

    When reviewing a (PlayBook) App in the App World the comment and rating refers to the current version of the App. Would be nice if it was possible to update/edit a review after an update has been released because often the problems from the first rev