Compilation using package

I have a problem using package :
I have files in a directory called 'utils' which contains java files with the 'header' 'package utils;'
In that directory the 2 files I have problem with are ClassMaker.java and Traduction.java
ClassMaker use Traduction but when I compile it I get the following error :
ClassMaker.java:85: Class utils.Traduction not found.
Traduction tr = null;
^
ClassMaker.java:87: Class utils.Traduction not found.
tr = new Traduction(createURL(base+"dico.txt"));
^
2 errors
it's looking for a 'subpackage' (when I create a subdir called 'utils' and put Traduction.class in that dir there's no problem), but why??????
thanks

Your classpath must point (probably among others) to the root directory of your packages. Supose your utils directory is C:\MyJavaFiles\Utils, then you should:
SET CLASSPATH=C:\MyJavaFiles;%CLASSPATH%

Similar Messages

  • [b]java compilation using packages[/b]

    Hai
    i created one class named Sample.java using 2 packages
    import dk.belle.servlet.Call;
    import javax.servlet.ServletRequest;
    stored into one folder c:\temp. how can i compile this Sample.java class.
    i had two jar file dk.belle.jar, javax.servlet.jar. where i have to put these jars & how to i set the class path;

    set jar file in Environment Varibles (WIN NT)
    right click on My Computer->select Advanced Tab-> Click on Environment Varibles Button->Click on New (System Varibles ) ->
    set Varibles=CLASSPATHVaribles Value=D:/other_jar_file;C:/dk.belle.jar;.

  • How to compile all package body using sqlplus ?

    hi all,
    How to compile all package body using sqlplus ?
    Please help.
    Amy

    dbms_utility.compile_schema will compile all the invalid objects in a schema, including the invalid package bodies. If you only want to compile the invalid package bodies, you could write your own dynamic SQL stored procedure to do that using the user_source view, but that's a lot more effort for a very minimal benefit.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How can I compile program which uses packages?

    Hi,
    I'm building a program using JBuilder9. I can successfully run using that IDE, but after I try to run it manually (run class file which compiled from JBuilder) by typing "javac myMainClass" it cannot find serveral packages which I put those packages' folder on the same root directory of myMainClass. Thank you.

    Man, you should probably read the following:
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
    Anyways, the first thing to do is to determine the current value of CLASSPATH (that is a system variable and it depends on your OS how you change/get its value).
    Next thing is to determine WHAT you need to add:
    For each used package check if its (root directory/jar) is in your CLASSPATH. If not add it, e.g.
    - you have a package my.test.package in C:\temp\myJar.jar then add C:\temp\myJar.jar
    - you have a package my.test.package in C:\temp, i.e. your fs structure is C:\temp\my\test\package, then add C:\temp
    For beginners, it's usually a good idea to have your CLASSPATH contain a dot (".") ...

  • Compilation probelm  while using package.

    Hi Friends,
    I have one package Alert.java which stored and compiled class file is kept in MyPack directory.
    I am in Projec directory . The MyPack directory is subdirectory of Projec directory.
    My main java program has import statement like this
    import MyPack.*;
    While compiling the main program, it thows error as follows in Windows XP.
    C:\project>javac -d bin -sourcepath src src\sagent_reg.java
    src\sagent_reg.java:29: cannot find symbol
    symbol : constructor Alert(java.lang.String,sagent_reg)
    location: class MyPack.Alert
    alert = new Alert("Unable to Connect Database",this);
    ^
    src\sagent_reg.java:40: cannot find symbol
    symbol : constructor Alert(java.lang.String,sagent_reg)
    location: class MyPack.Alert
    alert = new Alert("Database Error....!!"+e.toString(),this);
    ^
    Note: src\sagent_reg.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors
    Can anybody please help in this regard.
    I tried many mothods to compile.
    javac -d , javac -sourepath etc. Still this error comes.

    I tried by compiling *.java option. The above mentioned eror is again displayed.
    My directory structure is
    C;\project
    c:\project\src (source java files)
    c:\project\bin (all class files)
    c:\project\bin\MyPack (class files of package)
    my source file is c:\project\src\sagent-reg.java
    my_package files are at c:\project\src\MyPack\Alert.java
    my_package files are at c:\project\src\MyPack\db_connect.java
    I am now in the directory c:\project.
    I compiled the package files as
    c:\project:> javac -d bin -sourcepath src src\MyPack\*.java
    It has copiled the two packages successfully and class files are generated in
    C:\projec\bin\MyPack\Alert.class
    C:\project\bin\MyPack\db_connect.class
    Now I tried to compile the main program as like this
    c:\project> javac -d bin -sourcepath src src\sagent_reg.java
    I get the same errorsC:\project>javac -d bin -sourcepath src src\sagent_reg.java
    src\sagent_reg.java:29: cannot find symbol
    symbol : constructor Alert(java.lang.String,sagent_reg)
    location: class MyPack.Alert
    alert = new Alert("Unable to Connect Database",this);
    ^
    src\sagent_reg.java:40: cannot find symbol
    symbol : constructor Alert(java.lang.String,sagent_reg)
    location: class MyPack.Alert
    alert = new Alert("Database Error....!!"+e.toString(),this);
    ^
    Note: src\sagent_reg.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors
    my class path defined in System environment variable is
    C:\>set classpath
    CLASSPATH=.;c:\Program files\QuickTime\QTJava.zip;d:\oracle\ora92\jdbc\lib\class
    es12.zip;d:\oracle\ora92\jdbc\lib\classes12.jar;d:\oracle\ora92\jdbc\lib\classes
    111.zip;d:\oracle\ora92\jdbc\lib\classes111.jar;d:\oracle\ora92\jdbc\lib\ojdbc14
    .jar;;.;c:\project;c:\Program files\QuickTime\QTJava.zip;d:\oracle\ora92\jdbc\li
    b\classes12.zip;d:\oracle\ora92\jdbc\lib\classes12.jar;d:\oracle\ora92\jdbc\lib\
    classes111.zip;d:\oracle\ora92\jdbc\lib\classes111.jar;d:\oracle\ora92\jdbc\lib\
    ojdbc14.jar;
    Kindly tell me where I have gone wrong. Should I include calsspath while compiling.

  • Error when using packages

    hi!
    I am new to java .... learning how to use packages. I have created dir on my harddrive c:\learning\java ... in which i have created com\tests.... added c:\learning\java to path env variable .... And have written two java programs.
    1. jmain.java
    adds two integers and puts in another integer
    public int sum()
    2. jtest.java
    main method ... and creates an object of jmain class ... and uses
    jmain jm = jmain();
    jm.sum();
    Both these classes are in the same package com.tests and both jmain.java uses package com.tests;
    and jtest.java uses package com.tests; import com.tests.*;
    3. jmain compiles alright
    but when compiling jtest.java compiler gives an error saying can't resolve symbol
    symbol : jmain.class
    path : com.tests.jtest
    What to do now ???????? when i went to check my directory structure ... i am doing everything right.... using case okay, path is okay, etc
    still running errors .... please suggest a solution.
    thanks.

    I tried this ... it's giving me same error.
    Please help.
    I am on winXp so i added at the end of my path env var .... c:\learning\com\tests
    //jmain.java
    package com.tests;
    public class jmain
    public int x=4;
    public int y=66;
    public int sum = x+ y;
    public printsum ()
    System.out.println(sum);
    //jtest.java
    package com.tests;
    import com.tests.*;
    public class jtest
    public static void main(String [] args)
    jmain jm = jmain();
    jm.printsum();
    Above is my program. Both java files are in C:\learning\com\tests
    And, is there a difference between CLASSPATH and setting environment variable or system variable ???? What is SOURCEPATH too ???
    Please help
    Thanks in advance.

  • Compiling a package without disturbing the load process

    Hi,
    I need to compile a package, with the changes, in the database without stopping the load process that is using this package. Please let me know if any one has any ideas.
    Thanks

    sdk11 wrote:
    Hi,
    I need to compile a package, with the changes, in the database without stopping the load process that is using this package. Please let me know if any one has any ideas.
    ThanksIf you mean: "I need to create or replace a package", while some session is still running code of that package.
    Then sorry: nocando.
    Unless you are on 11.2, in which case you could (with the necessary preparation/configuration done first) create a new version of the package in another edition than the session is using. But the session will have to finish its work using the package as-is currently.

  • Using package constants in package SQL - acts as bind variable or literal?

    I'm looking for confirmation on the performance impact of using package constants in package SQL.
    Let's say I have a number of queries in package code that refer to various literals that are prone to typos e.g. "CANCELLED" instead of "CANCELED". To reduce the chances of this happening, I have an APP_GLOBALS package where I declare constants for each literal:
    C_CANCELED CONSTANT VARCHAR2(12) := 'CANCELED';And in queries that refer to literal 'CANCELED' I use APP_GLOBALS.C_CANCELED instead. This way the typo is caught during compilation. For example:
    BEGIN
    --Do something with all 'Canceled' orders
      FOR r IN (SELECT order_id
                  FROM orders
                 WHERE status = APP_GLOBALS.C_CANCELED)
      LOOP
      END LOOP;
    END;Assume that:
    - the STATUS column is indexed
    - the possible values are PENDING, APPROVED, CANCELED
    - a small percentage of orders are CANCELED
    From the optimizer's perspective is the query equivalent to
    SELECT order_id
      FROM orders
    WHERE status = :varor
    SELECT order_id
      FROM orders
    WHERE status = 'CANCELED'?
    According to what I see in v$sqltext_with_newlines, it's the first one. Can anyone suggest an alternative way of replacing literals in package SQL to prevent typos? Worst case, I suppose I can start with constants so that it compiles successfully then do a global replace of the constants with the literals.

    Can anyone suggest an alternative way of replacing literals in package SQL to prevent typos?I cannot think of any. But, here is the thing. If the typos are there, then, it technically is a bug even though both the codes would compile. The bug will be hunted down when the program doesn't work as intended. Wouldn't most typos be caught in unit testing of the code?
    Also, if you replace a string literal with a variable, then, maybe (just maybe, depending on your version of the dbms), it may end up picking a different execution plan. That might be an unintended consequence.

  • Re-compiling a package in a stored procedure

    Hi All,
    We are using Oracle 10g. I have coded a stored procedure that does many things one of which is re-creating a Materialized View using Dynamic SQL. However, when this Materialized View is created, a package that this stored procedure needs, becomes invalid. What is the syntax for recompiling the package using Dynamic SQL? I tried something like script listed below, but I am getting "*ORA-24344: success with compilation error*" error message. I like to re-compile the package before it's use in this stored procedure.
    DECLARE
          v_sql         VARCHAR2 (1000);
          object_name   VARCHAR2 (50) := 'TEST.PS2_FNS366';
    BEGIN
           dbms_output.put_line('This is a test.');
           v_sql := 'Alter package ' || object_name || ' compile  package';
           dbms_output.put_line (v_sql);
           EXECUTE IMMEDIATE v_sql;
           v_sql := 'Alter package ' || object_name || ' compile  body';
           dbms_output.put_line (v_sql);
           EXECUTE IMMEDIATE v_sql;     
    END;Thanks,
    Seyed

    Hi Justin,
    I agree with you. Initially, I didn't want to use materialized view in the stored procedure to load a table, but I a kind of was forced into it. I first tried using an Oracle View, but then the Oracle package using it was not finding the view. Then I tried to grant select to it, that failed too. That is when I decided to use a materialized view because, at least I could issue the needed grants.
    After seeing your e-mail and Frank's, I went back to my original plan. I re-created the old view and then tried to give it the right grants. Here is what I tried and the resulting error message:
    GRANT SELECT ON STUDENT.v_ben_reg_case_number TO SCOTT A grant similar to above results in ORA-01720: grant option does not exit for one of the underlying tables. Our DBA tried granting a developer role a system privilege called under_any_role, but that didn't solve it either.
    Thank you for your assistance,
    Seyed

  • Using packages breaks batch file

    Hi there, I wonder if anyone can help me here.
    I've been continuing work on somebody else's previous project, and everything is fine except for the batch file used to run the program from non development. I decided to use Eclipse to develop as opposed to the previous JCreator, and Eclipse gave an error unless I used packages, however this breaks the batch file
    Here's the orginal text from the batch file -
    java.exe -Xmx256m -classpath C:\InsTra\JARS\ant.jar;C:\InsTra\JARS\jaxen-core.jar;C:\InsTra\JARS\jaxen-jdom.jar;C:\InsTra\JARS\jdom.jar;C:\InsTra\JARS\saxpath.jar;C:\InsTra\JARS\xalan.jar;C:\InsTra\JARS\xerces.jar;C:\InsTra\JARS\xml-apis.jar;c:\InsTra\code_files InsTra
    The batch file is located in C:\InsTra, the external JARS are in a JARS subfolder, and the java and class files are in Code_files. The main class is InsTra. I get the error NoClassDefFoundError
    I've tried making the last bit Code_files.InsTra in case it needed to reference the package, but I'm new to this I'm afraid so have little experience of this sort of thing.
    Any help is welcome
    Thanks
    Daniel

    Then either your compiled class is not on the classpath, or you have not used the correct class name. Or both.
    The classpath must point to the root of the package hierarchy.
    The class name must include the package name (which is dictated by the package line at the top of your source file).
    The compiled class file must be in the correct directory.
    Given the information that you have provided, your class file should have the following path:
    c:\InsTra\code_files\Code_files\It should also have the following line at the top of the .java file:
    pacakge Code_files;Class names are case sensitive. Remember that the class path points to the root of the package hierarchy, NOT each of the directories containing class files. For example, if your classpath is thus:
    c:\fooYour class file is in:
    c:\foo\foo\Spong.classWith a package of:
    package foo;And you execute it with:
    java -classpath c:\foo foo.SpongThen it will work. The following will not:
    java -classpath c:\ foo.Spong
    java -classpath c:\foo\foo Spong
    java -classpath c:\foo\foo foo.Spong
    java -classpath c:\foo\foo Spong.class
    etc.

  • Error when re-compiling a package

    I get the following error when I re-compile my package.
    Yesterday someone has compiled this package and changes are reflected.
    How to get this package unlocked???.
    ERROR at line 1:
    ORA-04021: timeout occurred while waiting to lock object
    SCH_LOAD.DNS_LOAD_BASE_TABLES_CRDM
    ORA-04021: timeout occurred while waiting to lock object stringstringstringstringstring
    Cause: While waiting to lock a library object, a timeout is occurred.
    Action: Retry the operation later.

    Thanks Rob,
    Usually this package takes few minutes to re-compile and we have already crossed 2 to 3 hours.
    Could you please let me know what might be the probable reasons for this abnormal behaviour.
    we are able to find required changes using user_source view.
    Could you please let me know on how to kill the process and unlock the package.
    thanks in advance.

  • Unable to compile using rmic

    Hello all
    I have successfully compiled files using javac. The path is set, so I just need to open a command prompt and simply type javac AddServerImpl.java and it compiles with out errors. I do not have to specify any path at all.
    But when I try to compile using rmic, that is where I have the problem. It simply says "error: Class AddServerImpl$.java not found. 1 error."
    I simply don't understand what the problem is. If the path can work with javac <name>, why can't it work with rmic.
    I have even tried copying the java files, to where the rmic file is present and then tried running rmic AddServerImpl. But it still does not work. I have even included the following line under the environment variables "setclass path = %classpath%c:\rmiproject\"
    A bit desparate of ideas.
    Thankyou

    If the path can work with javac <name>, why can't it work with rmic.Because javac takes a path to a filename. rmic takes a package-qualified classname. Different strokes.

  • Compiling Procedures/Packages/Functions

    I'm fairly new to the arena of compiling Procedures/Packages/Funcitons but I was given the task of updating a development DB with a lot of newly created/updated Objects. I have created a shell script to go through all the new files and create or replace all the new objects in sqlplus. My question is how to compile all the newly created objects and their dependencies correctly? I have been using SQL Developer to verify that everything has compiled but I see that some are marked invalid which I assume is because a dependency was compiled after it. What would be my best way to making sure everything is valid? I hope this makes sense but any help would be appreciated.

    You can use a script like this to build your own sql statement to compile the invalid objects. You can add your own statement for other object types at the end with a union, ie TYPE body.
    You will probably need to run it repeated until all objects are VALID. You can put it in a PL/SQL block with a loop and execute immediate so reduce the manual work.
    --PACKAGE
    select 'alter package ' || object_name || ' compile;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'PACKAGE'
    union
    -- PACKAGE BODY
    select 'alter package ' || object_name || ' compile body;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'PACKAGE BODY'
    union
    --PROCEDURE
    select 'alter procedure ' || object_name || ' compile;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'PROCEDURE'
    union
    --FUNCTION
    select 'alter function ' || object_name || ' compile;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'FUNCTION'
    union
    --TRIGGER
    select 'alter trigger ' || object_name || ' compile;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'TRIGGER'
    union
    --VIEW
    select 'alter view ' || object_name || ' compile;' from user_objects
    WHERE Status = 'INVALID'
    and object_type= 'VIEW'

  • How to compile and package my EJB application

    Hi,
    I just ran the sample programs from the Sun J2EE tutorial. Seems to work fine. I used the ant utility to compile all the programs and the J2EE Deployment Wizard to package and deploy everything. Now how do I compile and deploy a sample EJB program that I have written ?
    I am using the following platforms:
    1: JBuilder 3.0 : IDE (for writing the source code)
    2: JDK 1.4.0_01
    3: J2SDK EE 1.3.1 (EJB/Appln server)
    How do I make ant recognize my program and compile it... i guess the deployment procedure would still be the same.
    Can somebody please help me out on this ??
    Thanks
    prasanna

    Hi,
    Thanks for your prompt reply. I tried that out.. I have a directory called "customer" under which I have my interfaces,bean implementation class and the J2EE application client.
    ANT_HOME is set to : the directory where ant is installed
    JAVA_HOME is set to : the directory where JDK is installed
    J2EE_HOME is set to : the directory where J2EE server is installed
    and PATH : includes the bin directories of JDK, ant and J2SDK EE
    These are the paths I had to set when I ran the J2EE tutorial programs. It worked fine.
    Now when I say : ant myprogram I get an error saying:
    BUILD FAILED
    Target "myprogram" does not exist in this project
    How do I add my program also to the project so that ant can recognize it ?
    Also if there is any other way you can suggest to compile and package my application it would be great...
    Thanks
    prasanna

  • While Compile the Package it shows "alter session set plsql_trace=false"

    Hi,
    My package was working fine and suddenly the status is invalid
    so i tried compiling the package that time sql developer got hanged, package also not getting compiled.
    i asked DBA to find out the status, they said the following query is running from your machine.
    "Alter session set plsql_trace=false". once they kill the session, sql developer got released.
    What could be the reason for this?? please help me to resolve this.......
    Thanks,
    G

    Most "set events" are workarounds or needed for Oracle support to do some debugging. Using them is at your own risk, and probably not supported by Oracle if you get into trouble.

Maybe you are looking for

  • Error in getting the report from web

    HI, HERE I AM TRYING TO CREATE A REPORT FROM FORMS WHICH I WANT TO WEBENABLED. I COULD GO TILL I CAN SEE MY FORM WHERE I GIVE AS THE PARAMETERS AS 'HS' OR 'SC' OR 'YS' THROUGH THE LIST OF VALUES OR THE USER CAN JUST ENTER IF THEY KNOW THE VALUE WHICH

  • Error message from HRPTIM03 and return to PT60 initial screen.

    Hi Experts, I have to show an error message during execution of PT60 (time evaluation) from the user exit HRPTIM03. Now when ever the error message come the program exiting but i want to come to the PT60 initial screeen. Even i tried with message typ

  • What are the Blue triangles on my book thumbnail?

    I just purchased the 7 individual Chronicles of Narnia books from Harper Collins and was careful to make sure they were related in the series (each one was $0.99. However, I noticed in my library, the 7 books show as downloaded and I can open each on

  • Recommeneded Auto Update Feature in 11.1 Grid Control

    Hi All, I would like inform you about New Auto Update feature in the 11.1 Grid Control Installer. This feature allows the latest recommended patches to be automatically deployed while installing a fresh 11.1 Grid control or while upgrading an existin

  • Include LMEDRUCKF1G - Print PO

    Hi All The Include LMEDRUCKF1G has the following code bundle. select single * from t006a where spras eq ekko-spras                              and   msehi eq ekpo-meins. move t006a to *t006a. My problem is that a certain UOM = 'CT' (Carton) is being