Importing User defined package problem.

Hi All,
I have made to package, "forum" and "utility". DBhandler java file is in "utility" package and Forumhandler is in "forum" package.
I want to import DBhandler classes from "utility" package into "forum" package for this i write
"import utility.*" in forum package's Forumhandler java file. But it is giving error.
The error is -
forum/ForumHandler.java:13: cannot resolve symbol
symbol : class DBHandler
location: class forum.ForumHandler
DBHandler dbhand = new DBHandler();

forum/ForumHandler.java:13: cannot resolve symbol
symbol : class DBHandler
location: class forum.ForumHandler
DBHandler dbhand = new DBHandler();
Do you have your visibility right?
The class DBHandler should be declared public.
P.s. it's a bad practice to use wildcards for imports if you just want to import a few classes, use
import my.company.product.utility.DBHandler;instead (or something similar).

Similar Messages

  • Java User-defined packages problem!

    Hi everyone,
    I am new to java programming.I am trying to do a small program to see how the user-defined pckages work.I wrote 2 small programs one is Balance.java and TestBalance.java.
    The code for Balance.java is as follows..
    package MyPack;
    public class Balance{
            String name;
            double bal;
            public Balance(String n, double b){
                    name = n;
                    bal = b;
            public void show(){
                    if(bal < 0)
                         System.out.print("--->");
                      System.out.println(name + ": $" + bal);
          }The code for TestBalance.java is as follows..
    import MyPack.*;
    class TestBalance{
            public static void main(String args[]){
                    Balance test = new Balance("Leela",99.88);
                    test.show();
      }These r both in the same directory....I am able to compile Balance.java...but when I try to compile TestBalance.java I am getting the following errors
    TestBalance.java:1: package MyPack does not exist
    import MyPack.Balance;
                  ^
    TestBalance.java:5: cannot resolve symbol
    symbol  : class Balance
    location: class TestBalance
                    Balance test = new Balance("Leela",99.88);
                    ^
    TestBalance.java:5: cannot resolve symbol
    symbol  : class Balance
    location: class TestBalance
                    Balance test = new Balance("Leela",99.88);
                                       ^
    3 errorsI am using j2se1.4 version ....my path is set to bin folder..
    Could someone plz tell me what is the mistake...it would be very helpful for me if someone could plz tell me what the problem is...
    Thanx in advance.

    99% going to work
    i have noticed some of the few thing
    trying to help
    u told that ur both the classes r in same directory right
    ok
    now ur first class has this as first line
    package mypack;//till here its ok only "mypack" should be small case
    now put this same line also in the other class as firat line
    and remove that import statement since both r in same package so no
    need to import it ok
    here's the code
    package mypack;class TestBalance{        public static void main(String args[]){                Balance test = new Balance("Leela",99.88);                test.show();           } }
    now compile it this way
    create a folder call mypack and put this both the classes in that folder
    say its c:\mypack\ur classes
    now in dos prompt
    type this
    set classpath=%classpath%;C:\mypack \
    now u compile ur first class and then second
    Surely this going to work if not tell me the errors u r getting

  • Importing user defined package in JDEV

    Hi,
    new to the JDEV9i tool. i have a project arranged in packages and am tryin to import this to the jdev9i. i successfully created the workspace and project and added all the packages. I can also view the package tree and package list but when i run my project the files in one directory import the files from the package structure.
    do i have to change Project properties?
    C:\jdev9i\jdev\mywork\Workspace1\Project1\websphinx\workbench\WebGraph.java
    Error(26,14): cannot access class graph.Graph; file graph\Graph.class not found

    It sounds like the Class path is not set up properly. You can configure this manually from the Project Settings dialog (Project > Project Settings). Alternatively, if you import all the packages from the top level, the path should be set for you automatically. For example, if you have your work in a directory structure like this:
    d:\mywork
    d:\mywork\toppackage
    Class1.java
    d:\mywork\toppackage\subpackage1
    Class2.java
    Class3.java
    d:\mywork\toppackage\subpackage2
    Class4.java
    Class5.java
    You can create a new project from existing source by creating a Workspace, then selecting File > New. In the Projects category there is an item called Project from Existing Source. Launch this wizard, and select the top level package from the directory listing (d:\mywork\toppackage in the example above). You then get the option to recurse through subdirectories, picking up all the classes along the way, and the paths will be set automatically. Note that you can use the Categories View button in the Navigator to view the files by package name.
    I hope this helps!
    -- Brian (JDev Team)
    Hi,
    new to the JDEV9i tool. i have a project arranged in packages and am tryin to import this to the jdev9i. i successfully created the workspace and project and added all the packages. I can also view the package tree and package list but when i run my project the files in one directory import the files from the package structure.
    do i have to change Project properties?
    C:\jdev9i\jdev\mywork\Workspace1\Project1\websphinx\workbench\WebGraph.java
    Error(26,14): cannot access class graph.Graph; file graph\Graph.class not found

  • 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 import user defined class in UIX page?

    Does anyone know how to import user defined class in UIX page so that the class can be called in the javascript in the UIX ?
    Thks & Rgds,
    Benny

    what you are referring to is not javascript.
    it is JSP scriptlets. These are very different.
    In order to keep a strict separation between View and Controller, it is not possible to run arbitrary java code from within your UIX code.
    However, you can run java code from within a UIX event handler; see:
    http://otn.oracle.com/jdeveloper/help/topic?inOHW=true&linkHelp=false&file=jar%3Afile%3A/u01/app/oracle/product/IAS904/j2ee/OC4J_ohw/applications/jdeveloper904/jdeveloper/helpsets/jdeveloper/uixhelp.jar!/uixdevguide/introducingbaja.html
    event handler code is run before the page is rendered.

  • 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

  • IMPORT USER DEFINED FIELD USING DTW

    Hi
    I want to IMPORT USER DEFINED FIELD OF SALE ORDER THAT ARE PRESENT IN ROW LEVEL AND DOCUMENT LEVEL
    USING DTW.
    SO PLZ GIVE ME SOLUTION FOR THAT.
    THANK YOU

    Hi,
    What is your B1 version and PL? Please do not use all CAPS. It is not polite.
    Thanks,
    Gordon

  • Creating User Defined Package Groups

    Hi everyone!
    I'm currently exploring/experimenting with strategies to stabilize parts of the Arch system on machines which I plan do update less frequently (I am aware of the risks and the potential difficulties associated with infrequent updates; that's why this is an experiment). It seems to me that Package Groups would be an asset which could be leveraged for a few different strategies. However, I cannot find any documentation on creating user defined package groups. Is there a way to do this? Any documentation anyone could point me to would be awesome. Thanks!

    You can compile the package yourself or change just the metadata. I think xyne had a tool for that, if only I could remember the name ...
    Edit: It's repkg https://bbs.archlinux.org/viewtopic.php?id=158970
    Edit 2: What do you need package groups for anyway? You should update the whole system rather than individual packages / groups of packages.
    Last edited by karol (2014-01-30 20:25:04)

  • How to import User-Defined Libraries to ODI?

    Hi All,
    I am trying to execute Java programs using ODI. There are many User-Defined classes imported in the programs.
    I have these User-Defined classes in JAR form.
    My ODI is setup on a linux system.
    So, where should these JAR files be uploaded in the system so that it can be imported in the Java programs?
    Please help me in resolving this issue.
    Thanks

    Hi Sutirtha,
    My ODI is installed on a linux system and I am using it on my desktop through a remote desktop connection.
    I connect to it using Tarantella account. Here I have to create a session and a view to use the ODI.
    So, when I am looking in the linux system for the <ODI_HOME>/oracledi/drivers folder, I am finding a lot of them.
    So, Please help me in locating the exact one where I need to put the JAR files.
    Thanks

  • LMS 3.2 Common Services User Defined Groups problem

    CiscoWorks LMS 3.2 is installed on Windows 2008 64-bit server.
    All devices are added into appropriate User defined group in Groups/Common Services.
    All groups are fine except that Members of group named Switch-HO-access have been copied also to group named Router-Branch by system for unknown reasons.
    At few files we have noticed errors :
    " FATAL  com.cisco.nm.xms.ogs.server.OGSServer main  Exception while OGS Server start up: CTMRegistry::startRegistryServer() : Can't find/start registry server "  and
    " com.cisco.nm.xms.ogs.util.OGSException: CTMRegistry::startRegistryServer() : Can't find/start registry server ".
    What is the reason for copying this devices and is there some other underlying problem?

    it seems that the errors you see correlate with regular stopping/starting of the LMS processes (dmgtd) so this would be a normal behaviour.
    Can you provide a screenshot of the problem you describe and also the rule for the group Switch-HO-access and Router-Branch

  • 2.1 EA1 User Defined Report problem

    Hi, I copiied Search Code item to User Defined Report and edited SQL (added union):
    select
    owner "Owner",
    name "PL/SQL Object Name",
    type "Type",
    line "Line",
    text "Text",
    owner sdev_link_owner,
    name sdev_link_name,
    type sdev_link_type,
    line sdev_link_line
    from (select owner,
    name,
    type,
    line,
    text
    from sys.all_source
    where
    (:OBJECT_NAME is null or
    instr(upper(name),upper(:OBJECT_NAME)) > 0)
    and (:TEXT_STRING is null or
    instr(upper(text),upper(:TEXT_STRING)) > 0)
    and name not like 'BIN$%'
    --order by owner, name, type, line
    union
    select owner,
    name,
    type,
    line,
    text
    from dba_source
    where
    (:OBJECT_NAME is null or
    instr(upper(name),upper(:OBJECT_NAME)) > 0)
    and (:TEXT_STRING is null or
    instr(upper(text),upper(:TEXT_STRING)) > 0)
    and name not like 'BIN$%')
    order by owner, name, type, line
    But I have problem - in result window, popup menu Go To <i.e.> MY_PACKAGE... doesn't work - no errors, simply nothing action. Original item works fine.
    Where is the problem?
    Petr

    Your union code seems fine but there is already a go to bug report logged.
    Already logged:
    Bug 9196402 - GO TO TYPE NAME NOT WORK IN PLSQL REPORT
    -Turloch

  • User defined activity problem in process flow

    Hi ,
    any one can help me out
    I have added a user defined activity in process flow , and given command values as \\windows\system32\cmd.exe
    and parameter list : ${input.value}
    and in script : kpi.bat
    where i written
    cd \kpi_sap
    for /f "tokens=1-5 delims=/ " %%d in ("%date%") do copy "c:\kpi_sap\kpi_sap.csv" %%e-%%f-%%g.dat
    but its not working ...
    can any one give me direction to get success in this activity
    best regards,
    mahi

    Hi Mahi,
    I see that your post is a few days old and you might have resolved this issue, but if you haven't you might want to change the command value to c:\windows\system32\cmd.exe instead. Its been a while since I worked with commands, but I remember that I had a lot of problems when I defined paths with '\\'. What I found out was that OWB jobs was run under the windows system account and the system account don't have access to networkshares (even if its really not on the network).
    I can't say whether the script in the kpi.bat is wrong, but as long as you can run it manually using cmd.exe you should be ok.
    If this doesn't help it might be helpful with some more specific error messages.
    regards Ragnar

  • User Defined Mapping Problem

    Dear SDNs,
    I write a user defined mapping program under a namespace, and I want to use it in other namespaces by drag and drop instead of importing, is that possible?

    Hi,
    <i>>>>Prakash, I'm a little confused, I think mapping program like java and XSLT can only imported in user defined function in Mapping, isn't it?</i>
    No, you will be importing it under Imported Archive. You will find User Defined Function inside the Graphical Mapping.
    Refer this link for UDF
    http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
    <i>>>>What do you mean by the "F4"? Can you explain it to me ?</i>
    F4 is Value request. In the Interface mapping when you are assigning the mapping program you will click on the "?" button which is nothing but F4. You can also press F4 which is equal to pressing "?"
    Thanks,
    Prakash

  • Prime Infrastructure 2.0 Importing user-defined group rules

    Dears,
    I'm looking for a way to import rules to put devices in a user defined group.
    I can see how I can create groups and rules manually, but not how I could export or import those rules.
    Is this possible, or on the roadmap?
    Cheers,
    Michel

    In the Cisco Prime Infrastructure 2.0 Deployment Guide under LMS 4.2 Data Migration there is a way to import settings from a "special" backup made from LMS.
    This should allow for importing userdefined groups.
    Does anyone have tried this yet?
    Cheers,
    Michel

  • Importing user defined triggers

    Hi,
    I need to import multiple user-defined triggers from one DB schema to another DB. Is this possible in 11G? Can someone help me out.
    Thanks,
    Sunita

    If you need to only export and import the triggers, then you have to generate the script for all the triggers(manually or using the DBMS_METADATA.GET_DDL.
    dbms_metadata.get_ddl(object_type => 'TRIGGER', name => 'TEST_TRIGGER');
    to get the script of all the triggers associated with a table
    SELECT dbms_metadata.get_ddl(object_type => 'TRIGGER', name => trigger_name) FROM user_triggers WHERE table_name = 'EMP';
    may be this can help you.

Maybe you are looking for