Compiling with nested packages

Hello, I have a problem trying to compile packages. Let's assume the following:
- The classpath variable is set to include ..jdkxxx\lib\dt.jar;..jdkxxx\lib\tools.jar
- I have a directory called 'd:\com\mycompany\mainpackage'
- Inside dir mainpackage, are two more dir. called 'subpack1' and 'subpack2'
- Dir subpack1 contains some classes, and all classes contain the statement 'package com.mycompany.mainpackage.subpack1'
- subpack1 is independent of all packages, except the java.lang
- Dir subpack2 contains some classes, and all classes contain the statement 'package com.mycompany.mainpackage.subpack2'
- subpack2 is dependent on some classes of subpack1
How would I go about compiling the 'mainpackage'? I have managed to compile the subpack1 classes, but when I try to compile the subpack2 classes, I get 'cannot resolve symbol' error messages, pointing to classes in subpack1, which are already compiled, but not found.
My classpath variable (at compile time) includes 'd:\com\mycompany\mainpackage', 'd:\com\mycompany\mainpackage\subpack1', and 'd:\com\mycompany\mainpackage\subpack2'
Any reply will be greatly appreciated!

You need to have the directory that contains the com directory in your Classpath when you compile (d:\ according to your post).
Classes that are in com.mycompany.mainpackage.subpack2 will need to import any classes they need from com.mycompany.mainpackage.subpack1, unless you use the fully qualified class name each time.
Note that there is no such thing as "nested packages" in Java. For example, you can not use a line like "import com.mycompany.mainpackage.*;" to try to import all classes in subpack1 and subpack2.
http://java.sun.com/docs/books/tutorial/java/interpack/packages.html

Similar Messages

  • HUM with nested packaging

    Hello,
    I have one typical scenario to map in SAP with HUM, please help me in finding the way.
    Business Scenario:
    During production, lubricant is being filled in bottles, bottles packed into cartons and cartons again packed into pallet. When the bottle reaches to the end customer, business wanted to trace it by which order it got produced and to which customer those bottles sold.
    Business also would like to know which bottle packed into which carton and which carton packed into which pallet.
    I was checking two options in SAP.
    1, serial numerbing
    2. Hanlding units
    with serial numering option it is dificult to achieve businessre quirement as sequence number printed(ink prints by external software) on the bottle is not equilent to the serial number generated automatically in the system.
    With Handling unit, yes, we can achieve but i have following questions.
    1. how to create HU and assign label(HU label) to the bottle before production with reference to production order.
    2. how to assign bottle HU's to the carton with scanner in production line with packaging station?
    3. how to assign carton HU's to the pallet HU with scanner and at what stage in production(before production order confirmation?)
    please clarify the above points.
    Thanks
    Regards,
    Pavan Kumar

    Hello,
    Anyone has come across such sitution? please advise.
    Thanks
    Regards,
    Pavan Kumar

  • Compiling withing a package

    Hello !
    For the following I have defined a package pack1 folder/directory.
    The problem is that the Super class gets compiled but not the sub classes. All the files are located within the package pack1. Why do I get this problem ?
    God bless you for your help.
    package pack1 ;
    public class Protection {
    int n = 1 ;
    private int nPri = 2 ;
    protected int nPro = 3 ;
    public int nPub = 4 ;
    public Protection() {
    System.out.println("Base Constructor ");
    System.out.println("Private n :" + nPri);
    System.out.println("Protected n :" + nPro);
    System.out.println("Public n :" + nPub);
    package pack1 ;
    class Derived extends Protection {
    Derived() {
    System.out.println("Derived Constructor");
    System.out.println("n = " + n);
    // class only
    // System.out.println("Private n = " + nPri);
    System.out.println("Protected n = " + nPro);
    System.out.println("Public n = " + nPub);

    You will get better answers if you post the error messages and the command you entered.
    So, let's say you have Windows and c:\myjava\pack1\Protection.class. To compile Derived, you must have c:\myjava in your Classpath. For example, javac -classpath c:\myjava  Derived.javawith Derived.java in your current directory.
    http://java.sun.com/docs/books/tutorial/java/interpack/packages.html

  • How to compile class and package

    I am trying to compile the following 3 files.
    http://www.cs.umbc.edu/~stephens/crypto/CIPHERS/ElGamal.java
    http://www.cs.umbc.edu/~stephens/crypto/CIPHERS/BinaryHeap.java
    http://www.cs.umbc.edu/~stephens/crypto/CIPHERS/DLP.java
    I tried compiling them with a variety of ways but still cannot figure out the correct way of doing it.

    I finally figured out how to compile them. I had to change files so that I don't have to compile with a package.
    Message was edited by:
    webweaver

  • How to compile with packages created by me

    I have created two packages:
    one is called agui and one is called agui.event.
    agui is located at c:\agui\src\a\agui and
    agui.event is located at c:\agui\src\a\agui\event.
    My class file is called HelloWorld and it is located at
    c:\agui\example.
    What should be the command line to compile my class file?
    is it
    c:\agui\example>javac -classpath c:\agui\src\a\agui *.java?
    I tried it, but it doesn't work!
    Thanks.

    Hi,
    When you are compiling a java file with a package you must use the -d option.
    Just for simplicity, if you change directory to the source file e.g. c:\test and the files have package name pack1 and filename File1.java -
    If you run javac File1.java it will compile fine but leave the class file in the default directory i.e. c:\test
    If you run javac -d File1.java the package name will be noted and new sub-directory for pack1 will be created with the new File1.class in it.
    Check it out using the -d option and not using to see the difference.
    bet kev

  • Packages  compiled with debug info

    Hi,
    How do we check if a package has been compiled with DEBUG information or not?
    The package could have been compiled like this:
    ALTER PACKAGE pk1 COMPILE DEBUG
    Is there any table that I can check?
    Thanks in advance.
    Sanal Krishnan

    Is this a 10g feature?It seems only user_plsql_object_settings is new in 10g.
    all_plsql_object_settings is available in 9i:
    michaels>  select * from dict where table_name like '%PLSQL%'
    TABLE_NAME                     COMMENTS                               
    ALL_PLSQL_OBJECT_SETTINGS      Compiler settings of stored objects acce
                                   ssible to the user                   
    1 row selected.
    michaels>  select name, type,plsql_debug from sys.all_plsql_object_settings where owner = 'SYSTEM'
    NAME                           TYPE         P
    DEF$_PROPAGATOR_TRIG           TRIGGER      
    REPCATLOGTRIG                  TRIGGER      
    michaels>  select * from v$version
    BANNER                                                         
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production                          
    CORE     9.2.0.8.0     Production                                      
    TNS for HPUX: Version 9.2.0.8.0 - Production                   
    NLSRTL Version 9.2.0.8.0 - Production                          

  • Problems compiling with packages

    Hi,
    I wonder if anyone could help me.
    I have had problems compiling using a package. I have altered the classpath in autoexec.bat with:
    SET CLASSPATH=%classpath%;C:\jdk1.3.1_02\classes;.
    the package class files are stored in C:\jdk1.3.1_02\classes\helliker\id3
    and I have imported the class with:
    import helliker.id3.*;
    I am getting the following error:
    C:\My Documents\Uni work\mp3 project\test\Driver.java:1: package helliker.id3 does not exist
    import helliker.id3.*;
    ^
    Can anybody help?
    Thanks,
    Dave

    Perhaps the version of Windows you are using does not use autoexec.bat. For example, in NT and XP, you set Classpath using ControlPanel/System/Advanced/Environment Variables.
    Perhaps there is a typo in your Classpath, for example an extra space.
    On a command line, try this:
    javac -classpath C:\jdk1.3.1_02\classes C:\My Documents\Uni work\mp3 project\test\Driver.java
    If that works, then definitely Classpath is not set as you think it is.

  • PHP5 package compiled with LDAP support?

    When I check phpinfo() it appears the PHP5 package was compiled with LDAP support but for some reason when I try a ldap_connect function in php it errors with 'Fatal error: Call to undefined function ldap_connect() in ...'
    Anybody have any idea what the problem is?
    Thanks,
    Craig

    I'm not sure about the php.ini thing, I've combed through it looking for idea's as well, but the only ldap string in the whole file is this 'extension=php_ldap.dll' and that doesn't apply to Arch.
    Also at http://www.php.net/ldap it talks about requirements etc and I'm almost thinking that the php5 package is not compiled with ldap even though when I do a phpinfo() it does show '--with-ldap' in the compile settings.

  • Command Line Compilation of  a Project with different packages

    Hi,
    I am trying to compile a project through command line, which has different packages with many classes in it. Now If I try to compile package by package It's complaining about other referenced classes of different packages. So I created .bat file, which includes all the packages, but it's complaining input line is too long.
    D:\jdk1.3.1\bin>app.bat
    My bat file is
    javac -d d:\Application\build d:\Application\source\com\ibc\rules\login\*.java d:\Application\source\com\ibc\rules\lookup\*.java .................d:\Application\source\com\ibc\wid\events\*.java d:\Application\source\com\ibc\wid\frames\cust\*.java ...
    and so on............
    Is there any solution for this problem?
    Thanks in advance....

    I think the prefered and more elegant way to compile project including packages should be writing makefiles including their compilation, installation, deploying - rules ..
    Make is really powerful, the maybe only weak-point is that there are some distribution of them, gnu-make, microsoft nmake .. which are slightly different, that made porting among platforms difficult.
    The jakarta-ant was a new approach to this which uses xml parser to proof the dependencies, etc ..
    Because I'm not familiar yet with xml & ant and as a in-blooded unix user, "make" is still my prefered way to do roject.
    The easiest way to get unix environment required for using make in Windows platforms is to download the "unxutils". It includes make, bzip2, diff, ... and other unix-tools. Refer to this (found from search by google) :
    http://www.weihenstephan.de/~syring/win32/
    http://www.weihenstephan.de/~syring/win32/UnxUtils.zip
    http://sourceforge.net/projects/unxutils/
    For more documentation on how to write makefile, use make -tool, see
    http://www.gnu.org/manual/
    http://www.gnu.org/manual/make-3.79.1/html_mono/make.html

  • Compilation with packages is different in J2SE 1.4.1 ?

    Hi there !
    I've just installed J2SE 1.4.1_01 in my Win NT 4.0 computer.
    Some of the files that belong to packages compiled just fine with JDK 1.2.2 but don't compile with J2SE 1.4.1_01.
    The same is true when I try to compile Java2D in the demo\jfc directory.
    In project NumberFormatTest I have the following classes:
    =====================================================================
    d:\MyPrograms\Java\NumberFormatTest\NumberFormatTestFrame.java
    package NumberFormatTest;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import tools.*;
    public class NumberFormatTestFrame extends Frame
    implements ActionListener, KeyListener, WindowListener
    =====================================================================
    d:\MyPrograms\Java\Tools\JCTextField.java
    package tools;
    import java.awt.*;
    public class JCTextField extends TextField
    =====================================================================
    d:\MyPrograms\Java\Tools\JCDecimalTextField.java
    package tools;
    import java.text.*;
    import java.util.*;
    public class JCDecimalTextField extends JCTextField
    d:\MyPrograms\Java>javac Tools\JCTextField.java
    compiles OK
    d:\MyPrograms\Java>javac Tools\JCDecimalTextField.java
    does not compile successfully with the error,
    Tools\JCDecimalTextField.java:67: cannot resolve symbol
    symbol : class JCTextField
    location: class tools.JCDecimalTextField
    public class JCDecimalTextField extends JCTextField
    pointing to the J in JCTextField
    d:\MyPrograms\Java>javac NumberFormatTest\NumberFormatTestFrame.java
    also doesn't compile with with "cannot resolve symbol" errors, when it tries to use JCDecimalTextField.
    It seems to me that classes defined by me to extend another class defined by me (JCDecimalTextField) and inside a package (tools) aren't being found by javac.
    However JCTextField is defined by me, extends TextField (from java.awt.*), is inside package tools and compiles OK.
    This stuff didn't happen in JDK 1.2.2.
    What the hell has changed with J2SE 1.4.1 ???
    My PATH has C:\Program Files\jdk\bin (among other directories)
    My CLASSPATH is
    D:\MyPrograms\Java;C:\Program Files\jdk\lib\tools.jar;C:\Program Files\Java\j2re1.4.1_01\lib\rt.jar;.;
    I strongly suspect that something has changed after JDK 1.2.2 in the way packages are handled by javac. I've tried searching in forums and other sun java documentation but couldn't find an answer to my problem.
    Can anyone please help me ?
    Any hint, suggestion or Internet site with appropriate documentation, would be highly appreciated as a means to end this 2 day nightmare.
    Thanks in advance,
    MGoncalv

    This issue has already been solved.
    J2SE 1.4.1 is case sensitive with regard to package directories.
    My tools package files must in subdirectory tools (but not Tools).
    This problem didn't happened with JDK 1.2.2
    For more details please take a look at
    Cannot resolve symbol
    from Feb 10, 2003 11:46
    by MGoncalv

  • Critical Error while compiling with AIR16 (*.ipa export)

    Hey,
    my application crashed while compiling with AIR16. (Flex 4.13.0-AIR 16.0)
    With AIR15 it works well.
    First I thougt, the reason might be the included ANE, but it isnt. The ANE works fine with another project.
    In fact other projects also work with AIR16.
    Any ideas?
    Error message:
    Error occurred while packaging the application:
    Undefined symbols for architecture armv7:
      "_traits:AOTBuildOutput-0000000101_6:234::Span", referenced from:
          _AOTBuildOutput-0000000101_6:9729:Edge in AOTBuildOutput-0000000101_6.o
      "_traits:AOTBuildOutput-0000000101_6:234::Edge", referenced from:
          _AOTBuildOutput-0000000101_6:9706:flashx.textLayout.compose::Parcel/allocateEdge in AOTBuildOutput-0000000101_6.o
      "_traits:AOTBuildOutput-0000000100_5:18::LocaleID", referenced from:
          _AOTBuildOutput-0000000100_5:265:mx.resources::LocaleSorter$/sortLocalesByPreference in AOTBuildOutput-0000000100_5.o
    ld: symbol(s) not found for architecture armv7
    Compilation failed while executing : ld64
    EDIT:
    I tried it also with Flex 4.14.0-AIR 16.0. Got this message:
    Error occurred while packaging the application:
    Undefined symbols for architecture armv7:
      "_traits:AOTBuildOutput-0000000101_6:248::Span", referenced from:
          _AOTBuildOutput-0000000101_6:11261:Edge in AOTBuildOutput-0000000101_6_1.o
      "_traits:AOTBuildOutput-0000000101_6:248::Edge", referenced from:
          _AOTBuildOutput-0000000101_6:11238:flashx.textLayout.compose::Parcel/allocateEdge in AOTBuildOutput-0000000101_6_1.o
      "_traits:AOTBuildOutput-0000000101_6:207::CellCoords", referenced from:
          _AOTBuildOutput-0000000101_6:8073:flashx.textLayout.elements::TableElement/normalizeCells in AOTBuildOutput-0000000101_6.o
          _AOTBuildOutput-0000000101_6:8072:flashx.textLayout.elements::TableElement/getBlockedCoor ds in AOTBuildOutput-0000000101_6.o
      "_traits:AOTBuildOutput-0000000100_5:18::LocaleID", referenced from:
          _AOTBuildOutput-0000000100_5:340:mx.resources::LocaleSorter$/sortLocalesByPreference in AOTBuildOutput-0000000100_5.o
    ld: symbol(s) not found for architecture armv7
    Compilation failed while executing : ld64

    We've built a lot of test-apps including the same components and libraries as in this app, but we are not able to reproduce this crash in other projects.
    The project works fine in the Simulator without any crashes or compile errors!

  • PCC-S-02014 error while compiling with in Sun Solaris

    We are porting our application from HP-UX to Sun Solaris and as part of that I am trying the compile a Pro*C program in Sun Solaris using SUNWspro C++ compiler. Precompiling is failing with following error.
    PRECOMP set: /u01/app/oracle/product/10.2.0/bin/proc dbms=native code=cpp mode=ansi include=/u01/app/oracle/product/10.2.0/precomp
    ireclen=255 oreclen=255
    define=__sparc define=__SUNPRO_C include=/usr/include include=. include=/u01/app/SUNWspro/prod/include/CC/stlport4 include=/u01/app/oracle/product/10.2.0/rdbms/public/ include=/u01/app/oracle/product/10.2.0/network/public/ include=/u01/app/oracle/product/10.2.0/rdbms/demo/ errors=yes select_error=no
    sqlcheck=limited ltype=NONE
    release_cursor=no hold_cursor=no
    Pro*C/C++: Release 10.2.0.3.0 - Production on Thu Dec 18 03:09:59 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    System default option values taken from: /u01/app/oracle/product/10.2.0/precomp/admin/pcscfg.cfg
    Syntax error at line 44, column 30, file /u01/app/SUNWspro/prod/include/CC/stlport4/algorithm:
    Error at line 44, column 30 in file /u01/app/SUNWspro/prod/include/CC/stlport4/a
    lgorithm
    # include STLPNATIVE_HEADER(algorithm)
    .............................1
    PCC-S-02014, Encountered the symbol "(" when expecting one of the following:
    : [ ] + / . .. an identifier, a numeric constant, newline,
    define, elif, else, endif, error, if, ifdef, ifndef, include,
    line, pragma, undef, exec, sql, begin, end, var, type,
    oracle, an immediate preprocessor command, a C token, create,
    function, package, procedure, trigger, or, replace,
    Normal C++ files are getting compiled with out eny issues. This particular file is having functions written in C fashion. Any idea what is missing in the compiler option.
    regards
    Vinu

    Hi Vinu,
    I'm not sure if this is still an issue for you. When I have encountered issues like this with Pro*C I have ended up specifying parse=none to the proc command and then putting all declarations between "EXEC SQL BEGIN DECLARE SECTION" and "EXEC SQL END DECLARE SECTION" markers. I have also moved any "special" declarations into a specific header file and then placed the "#include <special header file>" inside the declare section as well.
    Perhaps that will help a bit,
    Regards,
    Mark

  • Java Class (Compiled with JDK6_u12) that works with UCCX 9.0.2, don´t work with UCCX 10.5

    I have a Java Class (Compiled with JDK6_u12) that works with UCCX 9.0.2, after upgrade it don´t work with UCCX 10.5
    I get the error message: "Failed to access the WSDL at: https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. It failed with: Got java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty while opening stream from https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL.; nested exception is: javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. It failed with: Got java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty while opening stream from https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. (line: 1, col: 47)
    Does anyone know about this ?

    Did you ever find a resolution to this issue? I have a similar issue after upgrading from 7 to 10.5. I have loaded all provided certificates to the tomcat-trust store, restarted Tomcat Services and still get the same error
    Thanks

  • PL/SQL will compile with warnings but will not run

    I have a pl/sql package that will compile with warnings but no errors but when i try to run it I get an ORA-6508 error telling me there is an error somewhere in the package but I can't find it.
    I have two user schemas that use 2 slightly different versions of the package. I had to make slight code changes to one of the versions and when I made those changes it stopped running. The second version compiles and runs correctly.
    After going through a line by line comparison the first copy was still not running. I copied the second version of the code into the broken schema and commented out the additional lines of code that are not needed in this version.
    When I tried to compile and run this version it still fails with the same error.
    I am using Oracle XE and the databases are small.
    I can send on the code if necessary.
    Can anyone point me in the right direction?
    Thanks
    Susan

    I tried doing what you suggested but there are no errors as it is compiling correctly.
    It is only when I run the package through the debugger that I get the error. I have posted it below
    Connecting to the database Hess S3.
    Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
    Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '127.0.0.1', '2086' )
    Debugger accepted connection from database on port 2086.
    Processing 59 classes that have already been prepared...
    Finished processing prepared classes.
    Exception breakpoint occurred at line 10 of BnmSkOTQ3jz5I52ZOxC4QNw.pls.
    $Oracle.EXCEPTION_ORA_6508:
    ORA-04063: package body "SHIPPING.LIFTINGSCHEDULE" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "SHIPPING.LIFTINGSCHEDULE"
    ORA-06512: at line 10
    Process exited.
    Disconnecting from the database Hess S3.
    Debugger disconnected from database.
    Regards
    susan

  • Just Starting out with java packages

    Hello,
    I'm a beginner and I'm starting out with java packages.
    I wrote two simple .java files, one test program and one containing a simple class.
    Both files are compiling without errors but When I run the program I get an error NoClassDeffoundError.
    I use the import <package> statement And I think I'm using the CLASSPATH variable correctly.
    SET CLASSPATH=d:\nopol
    path for the .java containing the test class is:
    d:\nopol\utilities \myapp.
    In the test file I use "import utilities.myapp.*.
    I would be very happy if anyone could help me
    Thanks beforehand
    Nopol.

    The test file should be in d:\nopol, if it's not a part of your package utilities.myapp. Everything should be compiled from d:\nopol, the test class with "javac ClassName.java" and the class in the package with "javac utilities/myapp/ClassName.java".
    Your classpath seems fine for now, though. But yes, do add the period there, otherwise you could run into problems later.

Maybe you are looking for

  • "Page cannot be found" error when submitting tabular form

    One of our developers has used a wizard to create a tabular form with the intent or providing an interface for updating one of our tables. The page runs correctly up until the point when the user clicks the Submit button. The user is then re-directed

  • Apache + tomcat + mod_webapp or mod_jk

    I am thinking for using apache with tomcat. i am reading information but i have one initial trouble: what i must to use for production: mod_webapp or mod_jk? why? which is better? and in the future which will be the useful? thaks

  • Function module to find charateristic values

    hi all, i need to find charateristic value and characteristic description for the given class type and batch number (CHARG) of a material.. is there any function module that gives these value because this value r not stored in the tables.. thanks in

  • Cannot edit pictures in "Develop" mode

    I´ve got about 133.000 pictures - all with keywords. In connection with backup of the cataloque -unfortunatly I lost the connection with my external HD - and thereafter the cataloque has corrupt in the way, that all pictures are to be find in the key

  • Smtp settings on iPad connected to iPhone hotspot ?

    I'm using mt 3GS as a hotspot to my ipad2, but am getting the smtp address being rejected by the server when sending an email. The sim card in the iPhone is a German prepay (vodafone.de) with data enabled and I can receive emails and surf the web via