Package declare

Hello
I have to create an add-in application. The requirement is the main class must not declare package. For example with MyTest is main class:
//no package here
public class MyTest {
As my application is large, I want to a folder called mypackage. In side this folder, I create another class called MyOtherTest.java. In this class, I declare:
package mypackage;
public class MyOtherTest{
Now I try to have a reference of MyTest class inside MyOtherTest:
package mypackage;
public class MyOtherTest{
MyTest myTest;
However, compile complains
mypackage/MyOtherTest.java:4: cannot resolve symbol
symbol : class MyTest
location: class mypackage.MyOtherTest
MyTest myTest; when i run:
javac MyTest.java mypackage/MyOtherTest.java
Please tell me how I can fix this.
Many thanks
shush

Move the class MyTest to some package. It can be any package, not necesarily "mypackage."
There is no other fix; according to the Java grammar classes in the default package cannot be referenced from classes in named packages.

Similar Messages

  • New Columns Used in a Package Declaration

    I added the following new columns to a table:
    alter table J48PLTEQUIP add
    LOCBYUSER Char ( 1) Default 'N', UPF85 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    COFFSETDV VarChar2( 8) , UPF86 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    COFFSETEV VarChar2( 8) , UPF87 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    COFFSETEU VarChar2( 8) , UPF88 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    ROFFSETDV VarChar2( 8) , UPF89 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    ROFFSETEV VarChar2( 8) , UPF90 VarChar2(6) Default To_Char(SysDate,'MMDDRR'),
    ROFFSETEU VarChar2(15) , UPF91 VarChar2(6) Default To_Char(SysDate,'MMDDRR')
    Then I tried adding the new columns to a package declaration (see code below) and for some reason I am getting some errors when I compile it:
    TYPE tab_coloffsetdv IS TABLE OF J48PLTEQUIP.COLOFFSETDV%TYPE index by binary_integer;
    TYPE tab_coloffsetev IS TABLE OF J48PLTEQUIP.COLOFFSETEV%TYPE index by binary_integer;
    TYPE tab_coloffseteu IS TABLE OF J48PLTEQUIP.COLOFFSETEU%TYPE index by binary_integer;
    TYPE tab_coloffsetdir IS TABLE OF J48PLTEQUIP.COLOFFSETDIR%TYPE index by binary_integer;
    TYPE tab_rowoffsetdv IS TABLE OF J48PLTEQUIP.ROWOFFSETDV%TYPE index by binary_integer;
    TYPE tab_rowoffsetev IS TABLE OF J48PLTEQUIP.ROWOFFSETEV%TYPE index by binary_integer;
    TYPE tab_rowoffseteu IS TABLE OF J48PLTEQUIP.ROWOFFSETEU%TYPE index by binary_integer;
    TYPE tab_rowoffsetdir IS TABLE OF J48PLTEQUIP.ROWOFFSETDIR%TYPE index by binary_integer;
    SQL> show error
    Errors for PACKAGE PWRADMIN.PLAKCOMP:
    LINE/COL ERROR
    78/4 PL/SQL: Declaration ignored
    78/47 PLS-00302: component 'COFFSETDV' must be declared
    79/4 PL/SQL: Declaration ignored
    79/47 PLS-00302: component 'COFFSETEV' must be declared
    80/4 PL/SQL: Declaration ignored
    80/47 PLS-00302: component 'COFFSETEU' must be declared
    81/4 PL/SQL: Declaration ignored
    81/48 PLS-00302: component 'COFFSETDIR' must be declared
    82/4 PL/SQL: Declaration ignored
    82/47 PLS-00302: component 'ROFFSETDV' must be declared
    83/4 PL/SQL: Declaration ignored
    LINE/COL ERROR
    83/47 PLS-00302: component 'ROFFSETEV' must be declared
    84/4 PL/SQL: Declaration ignored
    84/47 PLS-00302: component 'ROFFSETEU' must be declared
    85/4 PL/SQL: Declaration ignored
    85/48 PLS-00302: component 'ROFFSETDIR' must be declared
    359/4 PL/SQL: Declaration ignored
    362/52 PLS-00302: component 'COFFSETDV' must be declared
    Do you have any clues why I am getting this error?
    Your help is really appreciated.
    Alex

    Todd, thanks for your prompt answer.
    I apologize, I pasted the wrong segment of the code. The TYPE statements should have been the following:
    TYPE tab_coffsetdv IS TABLE OF J48PLTEQUIP.COFFSETDV%TYPE index by binary_integer;
    TYPE tab_coffsetev IS TABLE OF J48PLTEQUIP.COFFSETEV%TYPE index by binary_integer;
    TYPE tab_coffseteu IS TABLE OF J48PLTEQUIP.COFFSETEU%TYPE index by binary_integer;
    TYPE tab_coffsetdir IS TABLE OF J48PLTEQUIP.COFFSETDIR%TYPE index by binary_integer;
    TYPE tab_roffsetdv IS TABLE OF J48PLTEQUIP.ROFFSETDV%TYPE index by binary_integer;
    TYPE tab_roffsetev IS TABLE OF J48PLTEQUIP.ROFFSETEV%TYPE index by binary_integer;
    TYPE tab_roffseteu IS TABLE OF J48PLTEQUIP.ROFFSETEU%TYPE index by binary_integer;
    TYPE tab_roffsetdir IS TABLE OF J48PLTEQUIP.ROFFSETDIR%TYPE index by binary_integer;
    Hopefully, this will clear things out. I am still out of luck with this issue. Thanks in advance again to all the gurus for your help...

  • Multiple top level package declarations

    The "Programming Adobe ActionScript 3.0" states in chapter 4 "ActionScript Language and Syntax", "Packages and Namespaces", "Creating Packages" that you can declare at the top level of a package multiple variables, functions, and namespaces in addition to a single class as long as only one is declared "public".
    However, in Flash when I declare a public class and any other variable or function either with the "internal" attribute or no attribute, I get this error:
    5006: An ActionScript file can not have more than one externally visible definition: test.function1, test.Test
    The package code is as follows:
    package test
        internal function function1():String
            return "Function1()";
        public class Test
    The same thing happens if I replace the function with an internal variable declaration. According to the manual, any declaration with the "internal" attribute should not be externally visible outside the package. Only the "public" class declaration should be externally visible.
    Can anyone clue me in as to why I get this error?

    That is not the situation described by the quoted manual section that I am trying to recreate.
    It clearly says:
    "In ActionScript 3.0, you use the package statement to declare a package, which means that you can also declare variables, functions, and namespaces at the top level of a package. You can even include executable statements at the top level of a package. If you do declare variables, functions, or namespaces at the top level of a package, the only attributes available at that level are public and internal, and only one package-level declaration per file can use the public attribute, whether that declaration is a class, variable, function, or namespace."
    The data properties and class you have decleared are outside the package within the ActionScript file, and not at the top level of a package. The "public" attribute is not available outside the package at all.
    What I wish to know is why the quoted internal declarations at the top level of the package generate the quoted error.
    However, I am beginning to believe that the documentation is in error and that what it is actually describing IS the situation you just described. When the manual says "top level of the package", it really means "top level of the ActionScript file outside the package", and when it says "the only attributes available at that level are public and internal", it really mans "the only attribute available outside the package declaration is internal. At the top level of the package, only one declaration may be made, it must have the same identifier as the ActionScript file name, and it can have either the public or internal attribute. Code within the same file but outside the package declaration can not access an internal declaration in the package declaration."
    Actually, the whole paragraph would need to be re-written to clarify the issue and to unambiguously distinguish between "top level of a package" and "top level of an ActionScript file outside the package declaration".
    As a concrete example - two ActionScript files:
    MCTest.as is saved in the same directory as MCTest.fla, and the document class of MCTest.fla is set to "MCTest".
    package
        trace("MCTest package code.");
        import flash.display.MovieClip;
        import test.Test;
        public class MCTest
        extends MovieClip
            trace("MCTest class code.");
            function MCTest()
                trace("Created Class MCTest: " + Test.StaticMessage);
    trace("MCTest outside package code");
    Test.as is saved in a sub-directory called "test".
    package test
        trace("test.Test package code");
        public class Test
            public static const StaticMessage:String = "Test: Hello World!";
            trace("test.Test class code");
    var myField:String = "myField";
    function myFunction():String
        return "myFunction";
    trace("test.Test outside package: " + myField + ", " + myFunction() + ", " + test.Test.StaticMessage);
    The resultant trace output is:
    MCTest class code.
    MCTest package code.
    MCTest outside package code
    test.Test class code
    test.Test package code
    test.Test outside package: myField, myFunction, Test: Hello World!
    Created Class MCTest: Test: Hello World!
    It is interesting to note that the package and outside package code are executed AFTER the class code.
    That seems to make more sense. You can only declare one class, variable, function, or namespace at the top level of a package with the same identifier as the file name, public or internal, and you can include executable code. At the top level of the ActionScript file outside the package declaration, you can only declare internal classes, variables, functions, and namespaces, and you can include executable code, none of which are within the package nor have access to any package internal declarations.
    The problem, therefore, would seem to be an incorrect manual. Does anyone actually know if this is accurate and the intended behavior?

  • Access Modifiers, Package declaration

    I created the following two classes in the same folder as two source files:
    A.java
    package abc;
    class A{
    B.java
    package abc;
    class B extends A{
    When I tried to compile, A compiled successfully. But when compiling B, it gives an error Cannot find symbol for class A.... I think it should be visible as both class access modifiers are (default). Why do I get this error????
    By the way if package declarations are removed from both classes then they compile successfully........

    i tried a lot..... does classpath affects compilation??? can u correct dis???If we're going to make the effort to help you, you could show willing and make the effort to spell out all your words and generally make your sentences as easy to understand as possible.
    Yes, the classpath affects compilation as the link provided shows. YOU can correct this.
    >
    e:\one\>javac -classpath e:\one\cert B.java
    >
    The classpath points at directories (or JAR files) not Java source files. Read the link.

  • Invalid package declaration:

    If you read my post a few messages down, I asked how to add a package in NetBeans. Solved (THANKS).
    But now I get this error when I mouseover the items in the package. Can I get an exact walkthrough on what to do to enable a package to work in NetBeans?
    l'll be more specific. I downloaded the jpb package from http://knking.com/books/java/ (Near the bottom)
    NetBeans saves my projects in C:\Documents and Settings\Administrator. So (In accordance with the instructions given in the book) I made the dir. C:\Documents and Settings\Administartor\jpb and inserted 3 .java files in it (SimpleIO.java Convert.java and DrawableFrame.java). From this point, what do I do so that (in netbeans) I can type import jpb.* and not get any errors?
    THANKS AGAIN FOR EVERYONE WHO HELPS

    You must compile these files, and I suggest you to
    create a jar library:
    New project -> General -> Java Class Library
    Copy your sources in it and build project. This will
    generate a .jar in the dist folder in mounted
    filesystem.
    Now add this builded jar in your project library as
    commented before.
    mariOHey there, I'm also a newb facing a similar error...
    I backed up a package by copy - pasting it and now i mounted it. However, when i mouseover any of its classes it says "Invalid package declaration" and i can't solve it....
    pls help
    THX!!!

  • Package declaration error

    I have an error calling a function from within my package.
    user_01 has a package called tautilities, that contains 2 functions.
    user_01 can use the functions no probs.
    user_01 then grants execute on tautilities to user_02
    user_02 executes the function getting the error
    PLS-00201: identifier 'TAUTILITIES.GET_DISTANCE' must be declared.
    What am I missing here? The functions are defined in the package definition?
    thanks
    null

    I think you should invoke it like user_01.tautilities.get_distance. Or create a public synonym for tautilities, so that you won't be needing the schema qualifier.

  • Error in Package Declaration

    Hey all,when i am trying to create a package i am getting an error PLS-00410: duplicate fields in RECORD,TABLE or argument list are not permitted
    CREATE OR REPLACE PACKAGE plsql101_pack IS
       DATE_LOADED DATE;
    TYPE pkg_perform_type IS RECORD
         (person_code     plsql101_person.person_code%TYPE,
          person_name     CHAR(12),
          current_sales   NUMBER(8,2),
          perform_percent NUMBER(8,1),
          status          CHAR(30)
    CURSOR PKG_PER_CUR RETURN plsql101_person%ROWTYPE;
    FUNCTION pkg_comp_discounts (order_amt NUMBER) RETURN NUMBER;
    PROCEDURE pkg_compute_perform
        (a_perform plsql101_person%ROWTYPE,
         a_perform OUT pkg_perform_type);
    END plsql101_pack;
    SQL> @plsql101_pack
    Warning: Package created with compilation errors.
    SQL> SHO ERROR
    Errors for PACKAGE PLSQL101_PACK:
    LINE/COL ERROR
    18/1     PL/SQL: Declaration ignored
    18/1     PLS-00410: duplicate fields in RECORD,TABLE or argument list are
             not permittedcan i know why i am getting the error..
    Thanks in advance!!

    Hi,
    Both arguments of the procedure have the same name:
    sandy wrote:
    PROCEDURE pkg_compute_perform
    (a_perform plsql101_person%ROWTYPE,
    a_perform OUT pkg_perform_type);
    Argument names must be unique within an argument list.
    You can have several procedures and/or functions that all have an argument called a_perform, but for any given procedure or function, only one argument can be called a_perform. Think about it. If you could have two (or more)l arguments in the same procedure that were all called a_perform, then, when you referenced a_perform in the procedure, how would the compiler (or you, or anybody else) know which one you meant?

  • Package declaration problems.

    CREATE TYPE avg_rwnd_shift_t AS OBJECT
    (c2 NUMBER(10,0)
    ,rwnd NUMBER(10,0)
    CREATE TYPE avg_rwnd_shift_set_t IS TABLE OF avg_rwnd_shift_t;
    CREATE OR REPLACE PACKAGE intrabase
    IS
    FUNCTION rwnd_limit(in_cid IN NUMBER, in_direction IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER, in_offset IN NUMBER,
    in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER, in_rtt IN INTERVAL DAY TO SECOND, in_btid IN NUMBER)
    RETURN avg_rwnd_shift_set_t
    PIPELINED;
    CURSOR test_rwnd_query1 (in_cid IN NUMBER, in_r IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER, in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER, in_rtt IN NUMBER, in_btid IN NUMBER) IS
    SELECT round(avg(c2),2) AS score, sum(rwnd) as win -- This is line 365
    FROM TABLE(rwnd_limit(in_cid, in_r, in_window, in_diff, in_offset, in_limit, in_m_point, in_f, in_ts, in_rtt, in_btid));
    END;
    LINE/COL ERROR
    365/3 PL/SQL: SQL Statement ignored
    366/14 PL/SQL: ORA-00904: : invalid identifier
    366/14 PLS-00231: function 'RWND_LIMIT' may not be used in SQL
    I have omitted alot in the package. When comment out test_rwnd_query1 it compiles without errors so I assume that my mistake is linked to that some how. Can anyone se what I have done wrong, have been staring at it for too long without finding my mistake.

    Your function is returning a user-defined object
    instance and you can't use it in a SELECT statement.That's not exactly true. See the example below.
    SQL> CREATE TYPE avg_rwnd_shift_t AS OBJECT
      2  (c2 NUMBER(10,0)
      3  ,rwnd NUMBER(10,0)
      4  );
      5  /
    Type is aangemaakt.
    SQL> CREATE TYPE avg_rwnd_shift_set_t IS TABLE OF avg_rwnd_shift_t;
      2  /
    Type is aangemaakt.
    SQL> CREATE OR REPLACE PACKAGE intrabase
      2  IS
      3    FUNCTION rwnd_limit
      4    (in_cid IN NUMBER, in_direction IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
      5    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
      6    , in_rtt IN INTERVAL DAY TO SECOND, in_btid IN NUMBER)
      7    RETURN avg_rwnd_shift_set_t
      8    PIPELINED;
      9
    10    CURSOR test_rwnd_query1
    11    (in_cid IN NUMBER, in_r IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
    12    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
    13    , in_rtt IN NUMBER, in_btid IN NUMBER)
    14    IS
    15    SELECT round(avg(c2),2) AS score, sum(rwnd) as win -- This is line 365
    16    FROM TABLE(rwnd_limit(in_cid, in_r, in_window, in_diff, in_offset, in_limit, in_m_point, in_f, in_ts, in_rtt, in_btid));
    17
    18  END;
    19  /
    Waarschuwing: het package is aangemaakt met compilatiefouten.
    SQL> show err
    Fouten voor PACKAGE INTRABASE:
    LINE/COL ERROR
    15/3     PL/SQL: SQL Statement ignored
    16/14    PLS-00231: function 'RWND_LIMIT' may not be used in SQL
    16/14    PL/SQL: ORA-00904: : invalid identifierSo the same error message here.
    SQL> CREATE OR REPLACE PACKAGE intrabase
      2  IS
      3    FUNCTION rwnd_limit
      4    (in_cid IN NUMBER, in_direction IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
      5    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
      6    , in_rtt IN INTERVAL DAY TO SECOND, in_btid IN NUMBER)
      7    RETURN avg_rwnd_shift_set_t
      8    PIPELINED;
      9
    10    CURSOR test_rwnd_query1
    11    (in_cid IN NUMBER, in_r IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
    12    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
    13    , in_rtt IN NUMBER, in_btid IN NUMBER)
    14    IS
    15    SELECT round(avg(c2),2) AS score, sum(rwnd) as win -- This is line 365
    16    FROM TABLE(intrabase.rwnd_limit(in_cid, in_r, in_window, in_diff, in_offset, in_limit, in_m_point
    17    , in_f, in_ts, interval '1' day, in_btid));
    18
    19  END;
    20  /
    Package is aangemaakt.So the SQL statement doesn't know the function rwnd_limit without its package name. When specified the package specification is created ok. Also there is a datatype (number/interval day to second) problem which has been corrected.
    To show that the user defined object can be used in a select statement:
    SQL> CREATE OR REPLACE PACKAGE intrabase
      2  IS
      3    FUNCTION rwnd_limit
      4    (in_cid IN NUMBER, in_direction IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
      5    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
      6    , in_rtt IN INTERVAL DAY TO SECOND, in_btid IN NUMBER)
      7    RETURN avg_rwnd_shift_set_t
      8    PIPELINED;
      9  END;
    10  /
    Package is aangemaakt.
    SQL> CREATE OR REPLACE PACKAGE body intrabase
      2  IS
      3    FUNCTION rwnd_limit
      4    (in_cid IN NUMBER, in_direction IN NUMBER, in_window IN INTERVAL DAY TO SECOND, in_diff IN NUMBER
      5    , in_offset IN NUMBER, in_limit IN NUMBER, in_m_point IN NUMBER, in_f IN NUMBER, in_ts IN NUMBER
      6    , in_rtt IN INTERVAL DAY TO SECOND, in_btid IN NUMBER)
      7    RETURN avg_rwnd_shift_set_t PIPELINED
      8    as
      9    begin
    10      pipe row (avg_rwnd_shift_t(2,2));
    11      return;
    12    end;
    13  END;
    14  /
    Package-body is aangemaakt.
    SQL> SELECT round(avg(c2),2) AS score, sum(rwnd) as win -- This is line 365
      2  FROM TABLE(intrabase.rwnd_limit(1, 1, interval '1' day, 1, 1, 1, 1, 1, 1, interval '1' day, 1))
      3  /
                                     SCORE                                    WIN
                                         2                                      2
    1 rij is geselecteerd.Regards,
    Rob.

  • Import package declarations

    Hi All,
    Is there any difference in terms of efficiency, class loading etc. in a program when I use the following?:
    import java.util.ArrayList;
    as opposed to:
    import java.util.*;
    This is assuming that ArrayList will be the only class that I will be using.
    Thanks

    You might earn yourself a millisecond or so during compile-time.
    Other than that, no.
    There is however some subtle difficulties when you are doing name resolving that can be avoided implicitly.
    As example:
    import java.util.*;
    import java.awt.*;
    public class Gronsak
      public Gronsak()
        // Code below is ambigious - Compiler does not understand if
        // we want to use java.util.List or java.awt.List
        List l = new List();
    }Offcourse, if you need to use both ambigious classes in the same code, atleast one of them needed to be typed out fully.
    Regards,
    Peter Norell

  • Package is working but not passing parameter it is passing default value

    The problem now is that the argument (P_ATS_NO) is being pass as the default 0 instead of the number
    I am passing in. Did I do something wrong with the argument?
    I am using the following to call the package
    declare
    begin
    MYTEST.A411APPROVALEMAIL_PKG.A411APPROVALEMAIL_async(:P_test);
    end;
    :P_test is being set to 1204 but I am getting 0
    THE PACKAGE
    create or replace PACKAGE BODY A411APPROVALEMAIL_PKG
    AS
    PROCEDURE A411APPROVALEMAIL_async (P_ATS_NO NUMBER)
    AS
    BEGIN
    DBMS_SCHEDULER.define_program_argument (program_name => 'A411APPROVALEMAIL',
    argument_position => 1,
    argument_name          => 'P_ATS_NO',
    argument_type          => 'NUMBER'
    *,DEFAULT_VALUE => 0);*
    DBMS_SCHEDULER.ENABLE (NAME => 'A411APPROVALEMAIL');
    DBMS_SCHEDULER.create_job (job_name => 'EMAIL411'
    || P_ATS_NO,
    program_name => 'A411APPROVALEMAIL',
    enabled => TRUE,
    comments => 'Comments'
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
         null;
    END A411APPROVALEMAIL_async;
    PROCEDURE "A411APPROVALEMAIL" (P_ATS_NO NUMBER)
    as
    strSubject varchar2(200) := ' NOTIFICATION';
    strPtext varchar2(100) := ' ';
    strEmail varchar2(100) :=’[email protected]';
    strFromEmail varchar2(100) := 'MYTEST.AOL.COM'; --'' ; --
    strBody varchar2(4000) := P_ATS_NO;
    emailSentFlag varchar2(3) := 'NO';
    strDistrict varchar2(240);
    strAshManager varchar2(60);
    myDocTypeID number;
    lno varchar2(50);
    begin
    ash_email(strEmail,strFromEmail,'MY strSubject',' ',strBody,'170.208.17.13',25);
    end A411APPROVALEMAIL;
    end A411APPROVALEMAIL_PKG;
    Howard

    If I have define it using DBMS_SCHEDULER.define_program_argument
    why do I have to do DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE.
    Using this:
    DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
    job_name IN VARCHAR2,
    argument_name IN VARCHAR2,
    argument_value IN VARCHAR2);
    I am getting
    Error at line 13: PLS-00103: Encountered the symbol "VARCHAR2" when expecting one of the following:
    The symbol "(" was substituted for "VARCHAR2" to continue.
    1. create or replace PACKAGE BODY A411APPROVALEMAIL_PKG
    2. AS
    3. PROCEDURE A411APPROVALEMAIL_async (P_ATS_NO NUMBER)
    Also when I do the following isnt this setting the value
    declare
    begin
    MYTEST.A411APPROVALEMAIL_PKG.A411APPROVALEMAIL_async*(:P_test);*
    end
    Howard
    Edited by: csphard on Feb 26, 2010 2:50 PM
    Edited by: csphard on Feb 26, 2010 3:06 PM

  • Getting 'binary name' of the package of  a given class

    I needed this for a kind of dynamic class loader, where the binary name of the package of an object was required. What made it more complex is that the classpath of the object is not the local filesystem path, where the java executable was invoked (such as 'bin' in an eclipse project)
    I searched the forum, and didn't find a solution that addresses all of these problems. Finally I came up with my own solution, and I'll share it with you (also because there might be some bright minds who can tell me it can be done much simpler (which I hope))
    @SuppressWarnings("null")
    public static String getPathFromClass(Class< ? > rootClass) throws FileNotFoundException
         String rootPath;
              // These are all the possible directories where the package root
              // exists (relative to where the java executable might be invoked).
              String systemPaths[] = {"bin", "."};
              File root = null;
              for (String systemPath : systemPaths)
                   root = new File(systemPath);
                   if (root.exists())
                        break;
              if (!root.exists() || !root.isDirectory())
                   throw new FileNotFoundException("No package root found");
              rootPath = root.getAbsolutePath();
         String localPath;
         try
              localPath = new File(rootClass.getResource(".").toURI()).getPath();
         catch (URISyntaxException e)
              // Should never happen; Hack to prevent unjust error.
              localPath = "";
         if (!localPath.startsWith(rootPath))
              // What's going on ??
              throw new FileNotFoundException("Class' local path not inside package root");
         return localPath.substring(rootPath.length() + 1).replace(File.separatorChar, '.');
    }Example:
    main class is in c:\projects\test\bin\test\mj\foo\Main.class (package declaration sais "test.mj.foo".)
    java.exe is executed from c:\projects\test\
    calling this method with an instance of the Main class returns: "test.mj.foo".

    As far as I can tell it just returns the package root (such as "c:\projects\test\bin"), but because of that, it does greatly simplify the first part of my function. Thanks.
    String rootPath = new File(rootClass.getProtectionDomain().getCodeSource().getLocation().toURI()).getPath();
    String localPath;
    ...A binary name (as mentioned in the Java Language Specification) is a representation of a fully qualified java class, such as "java.lang.String". A "binary name of a package" as I mentioned is just my way of meaning anything like "java.lang".

  • Problem in compiling JDeveloper 11g R2 - package does not exist

    I did a clean all to my application and now me thousand mistakes of references appear during the compilation, which could have failed?
    Project: C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\CentauroWeb15.jpr
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ModificaProductosArchivoServlet.java
    Error(23,39): package com.bbog.centauro.negocio.comun does not exist
    Error(24,39): package com.bbog.centauro.negocio.comun does not exist
    Error(25,39): package com.bbog.centauro.negocio.comun does not exist
    Error(26,41): package com.bbog.centauro.persistencia.vo does not exist
    Error(27,41): package com.bbog.centauro.persistencia.vo does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ProcedimientoServlet.java
    Error(22,39): package com.bbog.centauro.negocio.comun does not exist
    Error(23,39): package com.bbog.centauro.negocio.comun does not exist
    Error(24,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ProcesaOpcionesServlet.java
    Error(17,39): package com.bbog.centauro.negocio.comun does not exist
    Error(18,39): package com.bbog.centauro.negocio.comun does not exist
    Error(19,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\interfaces\GeneracionArchivoVNoMonServlet.java
    Error(22,39): package com.bbog.centauro.negocio.comun does not exist
    Error(23,39): package com.bbog.centauro.negocio.comun does not exist
    Error(24,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ParametroValidacionServlet.java
    Error(22,39): package com.bbog.centauro.negocio.comun does not exist
    Error(23,39): package com.bbog.centauro.negocio.comun does not exist
    Error(24,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\timer\EnviarCronAutomaticoServlet.java
    Error(20,39): package com.bbog.centauro.negocio.comun does not exist
    Error(21,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ParametrosContingenciaServlet.java
    Error(3,39): package com.bbog.centauro.negocio.comun does not exist
    Error(6,48): package com.bbog.centauro.persistencia.exception does not exist
    Error(7,42): package com.bbog.centauro.persistencia.dao does not exist
    Error(9,34): package com.bbog.centauro.util.log does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\timer\EnviarPagosAutomaticoServlet.java
    Error(20,39): package com.bbog.centauro.negocio.comun does not exist
    Error(21,39): package com.bbog.centauro.negocio.comun does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\administracion\ConsultaParametroValidacionServlet.java
    Error(22,39): package com.bbog.centauro.negocio.comun does not exist
    Error(23,39): package com.bbog.centauro.negocio.comun does not exist
    Error(24,39): package com.bbog.centauro.negocio.comun does not exist
    Error(25,41): package com.bbog.centauro.persistencia.vo does not exist
    C:\JDeveloper\mywork\CentauroVirgen\CentauroWeb15\src\com\bbog\centauro\controlador\servlet\login\DatosLoginServlet.java

    Hi.
    Please always state the JDev version you use when you ask a question.
    What do you mean exactly by cleanup? From the look of it, either you changed the package declaration at the top of you Java files for something that doesn't exist or renamed the on-disk directories in the package structure to something that doesn't match the package declarations in your code.
    Do not forget there is a direct correlation between packages names and directories.
    So, if you have package
    com.oracle.blueberryYou will have the following on the disk:
    src\com\oracle\blueberryBest Regards,
    Frédéric.

  • Display invalid pattern name while calling the procedure inside the package

    Hi ,
    I'am trying to call a package which is having procedure ,from JDBC in which one of the return type is Varray from the procedure.When i'am calling the procedure inside the package
    from java showing invalid name pattern name.Just i'am placing the code snippet for package and calling java through package.
    Package body
    create or replace package body Rewards_Summary_Package as
    PROCEDURE Rewards_Summary_Procedure
    (v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
    v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2) AS
    v_ACCRUALED_VAL NUMBER := 0;
    v_USED_VAL NUMBER := 0;
    /*v_TOT_ACCRUALED_VAL NUMBER := 0;
    v_TOT_USED_VAL NUMBER := 0;
    V_PR_TIER_ID VARCHAR2(30);
    V_PR_CON_ID VARCHAR2(30);
    V_EXPIRY_DT DATE;
    v_month varchar2(30);
    v_date date;
    v_next_month_date date;
    v_TIER_NAME VARCHAR2(50);
    v_TOT_AVAILABLE NUMBER := 0;
    v_EARNED NUMBER := 0;
    v_TOT_EARNED NUMBER := 0;
    v_TOT_REDEEMED NUMBER := 0;
    v_TOT_EXPIRED NUMBER := 0;
    v_EARNED_TOTAL NUMBER := 0;
    v_TOT_EXPIRED_MONTH NUMBER := 0;
    v_TOT_PTS_EXP NUMBER := 0;
    v_TOT_RDMD_CANCELLED NUMBER :=0;
    v_TOT_EARNED_POINTS NUMBER :=0;*/
    v_FIRST_DT DATE;
    v_LAST_DT DATE;
    v_MEMBER_ID VARCHAR2(30);
    V_EXPIRED_VAL Number;
    v_TOT_PRDPTS_RDMD NUMBER := 0;
    v_TOT_PTS_RDMD NUMBER := 0;
    v_CAN_ACCRUAL_POINTS NUMBER := 0;
    BEGIN
    /*TotalRwdPoints and Tier Name*/
    SELECT TR.NAME,MEM.POINT_TYPE_A_VAL,MEM.ROW_ID INTO v_TIER_NAME,v_TOT_AVAILABLE,v_MEMBER_ID
    FROM SIEBEL.S_LOY_MEMBER MEM, SIEBEL.S_LOY_TIER TR WHERE MEM.PR_DOM_TIER_ID=TR.ROW_ID
    AND MEM.PR_CON_ID=V_PR_CON_ID;
    vTotPrdPtsRdmd
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PRDPTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Product'
    AND A.TXN_ID IS NOT NULL;
    vTotPtsRdmd
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND (A.TYPE_CD='Product' or A.TYPE_CD='Transfer')
    AND A.TXN_ID IS NOT NULL;
    vTotRewardPtExp
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_EXP FROM SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Expired'
    AND a.TXN_ID IS NULL;
    vCanAccrualPoints
    SELECT NVL(SUM(A.ACCRUALED_VALUE),0) INTO v_CAN_ACCRUAL_POINTS from SIEBEL.S_LOY_ACRL_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRIB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Cancellation';
    v_Tot_Earned_Points := v_TOT_AVAILABLE+v_TOT_PRDPTS_RDMD+v_TOT_PTS_EXP-v_CAN_ACCRUAL_POINTS;
    v_TOT_REDEEMED := v_TOT_PTS_RDMD-v_CAN_ACCRUAL_POINTS;
    DBMS_OUTPUT.PUT_LINE(' Total Earned: '|| v_Tot_Earned_Points || ' Total Redeemed: '|| v_TOT_REDEEMED || ' Total Expired: '|| v_TOT_PTS_EXP
    || ' Balance Points: '|| v_TOT_AVAILABLE || ' Tier Name: '|| v_TIER_NAME);
    select trunc(sysdate,'MONTH') INTO v_FIRST_DT from dual;
    va:= t_varray(Null,Null,Null,Null,Null,Null);
    FOR a in 1 .. 6 LOOP
    select trunc(last_day(v_FIRST_DT)) INTO v_LAST_DT from dual;
    SELECT SUM(AI.ACCRUALED_VALUE),SUM(AI.USED_VALUE) INTO v_ACCRUALED_VAL,v_USED_VAL from SIEBEL.S_LOY_ACRL_ITM AI,SIEBEL.S_LOY_ATTRDEFN A
    WHERE AI.MEMBER_ID = v_MEMBER_ID AND A.ROW_ID = AI.ATTRIB_DEFN_ID AND A.INTERNAL_NAME = 'Point 1 Value'
    AND trunc(AI.EXPIRATION_DT) >= v_FIRST_DT AND trunc(AI.EXPIRATION_DT) <= v_LAST_DT;
    V_EXPIRED_VAL := NVL(v_ACCRUALED_VAL-v_USED_VAL,0);
    va(a):=V_EXPIRED_VAL;
    v_FIRST_DT := add_months(v_FIRST_DT,1);
    End loop;
    END;
    end;
    Package declaration
    create or replace package Rewards_Summary_Package as
    TYPE t_varray IS VARRAY(6) OF NUMBER;
    PROCEDURE Rewards_Summary_Procedure
    (v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
    v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2);
    end;
    java code
    I had tried using java types and Oracle types
    conn=SiebelServiceDatasource.getConnection(SSBConstants.REWARDS_PROP_LOG_SUFIX);
    // ArrayDescriptor.TYPE_VARRAY
    ocstmt=(OracleCallableStatement)conn.prepareCall(" {call REWARDS_SUMMARY_PACKAGE.REWARDS_SUMMARY_PROCEDURE(?,?,?,?,?,?,?)}");
    //ocstmt=(OracleCallableStatement)conn.prepareCall(" call Test_Array(?,?)");
    ocstmt.registerOutParameter(1,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(2,OracleTypes.INTEGER);//1-616BH
    ocstmt.registerOutParameter(3,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(4,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(5,OracleTypes.VARCHAR);
    ocstmt.registerOutParameter(6,OracleTypes.ARRAY,"SIEBEL.T_VARRAY");
    ocstmt.setString(7,contactSiebelRowId);
    ocstmt.execute();
    Showing the following invalid name pattern SIEBEL.T_VARRAY
    Please help
    Thanks in advance
    Kiran

    create or replace package Rewards_Summary_Package as
        TYPE t_varray IS VARRAY(6) OF NUMBER;
    end;You've declared your type inside the package. You need to declare it as a SQL type, which is not part of a PL/SQL package.

  • How to set packages and classpath

    Hi,
    I want to know about packages and classpath. I have these questions
    1, If I put a class in a package(work.util) is it necessary to put the java file in the same directory/directory hierarchy as mentioned in the package declaration. I have to compile this class, run it from main method and must be able for other classes to import.
    2. If a package have subpackages(work.util.db) do I have to set the classpath to subdirectory also to run that class.
    3. If a class is in package is it possible to run the class without prefixing the package name. I need to do this in the text editor so that I can run any program by pressing a hot key.
    rgds
    Antony Paul

    1, If I put a class in a package(work.util) is it
    necessary to put the java file in the same
    directory/directory hierarchy as mentioned in the
    package declaration.Strictly speaking, this isn't covered by the spec - it depends on what compiler and ClassLoader you are using. If you're using Sun's JDK, then yes.
    2. If a package have subpackages(work.util.db) do I
    have to set the classpath to subdirectory also to run
    that class. No. You should add the directory above work/util/db to your classpath. You should not add work, or work/util or work/util/db.
    E.g., if your Java files are in C:/MyProject/JavaSrc/work/util/db, and the package name is work.util.db, then you should have C:/MyProject/JavaSrc on your classpath (or have "." (dot) on your classpath, and compile and run from that same directory).
    3. If a class is in package is it possible to run the
    class without prefixing the package name. I need to do
    this in the text editor so that I can run any program
    by pressing a hot key.If you mean "in order to run work.util.db.Main do I need to type java work.util.db.Main, or just java Main", then you do indeed need the fully qualified class name (otherwise, how would the runtime environment know which class you mean? - there could be any number of classes called Main in any class, and it would have to search every directory and subdirectory on your classpath to find them.

  • Question about servlet in a package

    hello
    i use tomcat4.0,and write a simple servlet "Hello.java",put it in "C:\jakarta-tomcat-4.0\webapps\ee\WEB-INF\classes",i input "http://127.0.0.1:8080/ee/servlet/Hello",the code works well,but after i add a package declaration "package hi;" in front of my servlet,and put it in "C:\jakarta-tomcat-4.0\webapps\ee\WEB-INF\classes\hi\",wheather i input "http://127.0.0.1:8080/ee/hi/servlet/Hello" or "http://127.0.0.1:8080/ee/servlet/hi/Hello",both of them don't work,why?and how can i call a servlet that is in a package from the browser? thanks!
    my code:
    package hi;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Hello extends HttpServlet{
         public void service(HttpServletRequest req,
              HttpServletResponse resp)
              throws IOException,
                   ServletException{
              resp.setContentType("text/html");
              PrintWriter out=new PrintWriter(resp.getOutputStream());
              out.print("<html>");
              out.print("<body>");
              out.print("hello world!");
              out.print("</body>");
              out.print("</html>");
              out.close();

    Hi,
    Open your ee/web-inf/web.xml file and add these lines.
    <servlet>
    <servlet-name>
    Hello
    </servlet-name>
    <servlet-class>
    hi.Hello
    </servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>
    Hello
    </servlet-name>
    <url-pattern>
    /Hello
    </url-pattern>
    </servlet-mapping>
    Start the tomcat and give the URL,
    http://127.0.0.1:8080/ee/servlet/Hello
    Hope this helps.
    If you don't have a web.xml file there, you can add these lines in your Tomcat\conf\web.xml file.
    Sudha

Maybe you are looking for

  • Problem with LIMIT in my query...

    I am sending this query with JSP to my Oracle database: SELECT pub, class, startdate, adtext FROM classifieds WHERE (pub='KWR') AND (startdate<='03-Jan-02') ORDER BY pub LIMIT 0, 25 I keep getting the error: "Exception=java.sql.SQLException: ORA-0093

  • Do I need to declare parameters before using them?

    Hello, Say I have a piece of code like below: FORM UPLOAD_PC_FILE USING P_PATH                            P_INTERNAL_TABLE.    P_PCPATH_TOSTRING = P_PATH.    CALL FUNCTION 'GUI_UPLOAD'      EXPORTING        FILENAME                      = P_PCPATH_TO

  • 11/12/2013 - Release - AIR 3.9 Runtime and SDK

    Today we're pleased to announce that the next version of AIR is available for immediate download.  This update includes the following new features and improvements: New Features: Mobile Workers (concurrency) BETA - Android Our hugely popular desktop

  • Announcing 3 new Data Loader resources

    There are three new Data Loader resources available to customers and partners. •     Command Line Basics for Oracle Data Loader On Demand (for Windows) - This two-page guide (PDF) shows command line functions specifc to Data Loader. •     Writing a P

  • How do I distribute apps to clients in house (more than a hundred)

    I'm currently wanting to distribute apps that plugin to software we have developed for our clients (more than a hundred). These apps are not for public and don't want them to be. 1. How can I distribute them? 2. Do I have to enroll in iOS Developer P