Package problem when compiling

Hi,
I'm new to java. I'm using Win2000 and JDK1.3.1. I set the "c:\jdk1.3.1\bin" in the System's path. There are three java programs with their own package in the directory as follows:
"pack.java" - under "c:\jdk1.3.1\bin\test", it will call pack1 & pack2.
"pack1.java" - under "c:\jdk1.3.1\bin\test\sub1"
"pack2.java" - under "c:\jdk1.3.1\bin\test\sub2"
It's ok to compile "pack1.java" and "pack2.java" under their directory. But there is the compiling error for the "pack.java" under "c:\jdk1.3.1\bin\test", even though I've put the "import test.sub1.pack1;" and "import test.sub2.pack2;" in the code. The error were as follows:
- cannot resolve symbol
- symbol : class pack1
- location: package sub1
- import test.sub1.pack1;
- cannot resolve symbol
- symbol : class pack2
- location: package sub2
- import test.sub2.pack2;
I'm not sure what the problem is with the package and/or the import statement. Can any experts help me?
Thanks in advance.
Hanna

Hi all gurus,
Thank you very much for the help!
After adding the classpath "c:\jdk1.3.1\bin" to the System's setting, I can compile the "pack.java" under the "test" directory with the command "javac -classpath c:\jdk1.3.1\bin c:\jdk1.3.1\bin\test\pack.java". However, when I run "pack" with the command "java -classpath c:\jdk1.3.1\bin c:\jdk1.3.1\bin\test\pack", there is another error appears as follows, although the "pack.class" has been already there:
- "Exception in thread "main" java.lang.NoClassDefFoundError: c:\jdk1/3/1\bin\test\pack"
My "pack.java" code is below:
package test;
import test.sub1.pack1;
import test.sub2.pack2;
class pack{
public static void main(String[] args){
System.out.println("Starting pack");
System.out.println("Instantiate obj of public classes in different packages");
//Instantiate objects of pack1 and pack2 in different packages.
new pack1();
new pack2();
System.out.println("Ending pack");
What's wrong with them? Could you please help me on that?
Thanks again!
Hanna

Similar Messages

  • Silly problem when compiling main class

    hi there,
    i have a problem when compiling the main class.
    the classes used by the main class are not recognized. the compiler can't locate the children classes.
    i've already set the path and classpath environment variables, but there's still something missing.
    how should i organize my folders in order to be able to compile the main class successfully, please?
    thanks.

    It would be good to have a precise problem description: the actual command used, folder structure and environment variable settings. Even if you have to construct a simple test case with a couple of classes that illustrates the problem.
    In the absence of that some generic remarks:
    The PATH variable typically points at all the folders that contain executable files that you use often. You can always access other executable files by specifying there full names.
    The CLASSPATH variable is typically left unset.
    When you use the java tools (like the javac compiler or the java runtime) you can specify the classpath that you want to use with -cp. This will override any CLASSPATH value. So in the simple case of two classes (Main and MyClass), you can put them in anywhere you like (for example C:\MyJavaStuff) and compile and run with:
    {noformat}
    C:\MyJavaStuff> javac -cp . *.java
    C:\MyJavaStuff> java -cp . Main
    {noformat}(Mind the dot after -cp))
    By a "main" class I guess you mean a class with a static void main(String args[]) method, but I am suspicious of your "child" classes. Perhaps packages are involved. A precise description of the problem would help.

  • Create problem when compiling the servlet

    hi,
    i got a problem when i compile a servlet
    when i try to compile the servlet, it shows that it could
    not found the classes like httpservlet, etc.
    means the classes of the servlet
    i am using the j2sdk1.4.1 edition,
    i had include the javax.servlet.*; in the program
    please tell me what can be the problem & especially any solution for that

    the javax.servlet package and it's sub packages (javax.servlet.http, javax.servlet.jsp, javax.servlet.jsp.tagext) are not included with the Standard Edition. These packages are part of the Enterprise Edition. Check out this link for download:
    http://java.sun.com/j2ee/sdk_1.3/

  • Codepage problem when compiling with fastjavac

    Hi,
    I'm getting the following warnings when compiling with fastjavac:
    fastjavac: warning: Can't find codepage for "Cp1250" encoding.
    fastjavac: warning: Use default ANSI codepage.
    2 warnings
    How could I suppress these warnings?
    Thanks in advance

    I think you are posting it on the wrong Forum. This is for Forte 4GL not Forte for Java.

  • Problem when compiling TWIN

    When compiling TWIN from AUR (here), I got stuck at "make" phase. I download the tarball from AUR and makepkg from my home directory. The point at where I got stuck is this:
    libTw.c: In function 'Tw_Close':
    libTw.c:1224: error: invalid storage class for function 'DeleteAllListeners'
    libTw.c:1253: warning: implicit declaration of function 'DeleteAllListeners'
    libTw.c: In function 'Tw_StrError':
    libTw.c:1634: error: static declaration of 'DeleteAllListeners' follows non-static declaration
    libTw.c:1253: error: previous implicit declaration of 'DeleteAllListeners' was here
    make[2]: *** [libTw.o] Error 1
    make[2]: Leaving directory `/home/prasetya/Build/twin/src/twin-0.4.6/libs/libTw'
    make[1]: *** [build-dir-libTw] Error 2
    make[1]: Leaving directory `/home/prasetya/Build/twin/src/twin-0.4.6/libs'
    make: *** [build-dir-libs] Error 2
    ==> ERROR: Build Failed.
    Aborting...
    I have read this thread and have installed termcap-compat and required deps as mentioned. It configures fine.
    Any help is appreciated..

    Duplicate post, please go here:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=204588
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Llvm-g++ problems when compiling alchemy

    Hello community,
    I wanted to have a look at alchemy, so I installed cygwin and configured alchemy. However, I'm a little bit stucked... I did the steps in the tutorial but when compiling I got errors (note, I use g++ instead of gcc):
    $ alc-on && g++ c__/blackcat.c -O3 -Wall -swc -o swc/blackcat.swc
          3 [main] llvm-g++ 4360 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 4360, Win32 error 6
          3 [main] llvm-g++ 4656 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 4656, Win32 error 6
          3 [main] llvm-g++ 4816 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 4816, Win32 error 6
          3 [main] llvm-g++ 2792 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 2792, Win32 error 6
          4 [main] llvm-g++ 2264 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 2264, Win32 error 6
          3 [main] llvm-g++ 3368 child_copy: cygheap read copy failed, 0x61224780..0
    x6122A4C4, done 0, windows pid 3368, Win32 error 6
    So I tried different things like removing the symbolic links, then relinked them, copied alchemy again, reinstalled cygwin, installed cygwin onto another drive, copied flexsdk to c/flexsdk, but nothing of this did the job.
    Did anyone else had same errors?
    I'm running a german Windows 7 x86_64 version here.
    My business partner got it to work on his machine, but he also doesn't know why it's not working on mine.
    Can someone help?
    Kind Regards,
    Daniel

    This is an "invalid handle" error.
    The first thing to do is run your cygwin session as administrator.  If that doesn't fix it, I would check the file permissions on the drive.
    If the setup doesn't work properly (i.e. the symlinks don't get created properly), I don't think you even get this far, but that's something to check as well.  If your colleague has it working, you can compare your installs.

  • Consistent annoying problem when compiling and installing Apache modules.

    Every time I build and install mod_jk for Apache (Since binaries are no longer available for Apache 1.3.x on Mac OS X, we have to build it ourselves.), everything goes smoothly until the final 'sudo make install,' and then it finishes with:
    Libraries have been installed in:
    /usr/libexec
    Which is nice, but they're supposed to be installed in /usr/libexec/httpd in Mac OS X. (I don't know if this is a problem for Mac OS X Server too, but I'm using regular old Mac OS X 10.4.10, so I'm posting this here.)
    I'm using this when I call configure:
    % ./configure --with-apxs=/usr/sbin/apxs
    and /usr/sbin/apxs says:
    my $CFG_LIBEXECDIR = q(/usr/libexec/httpd);
    but the resulting Makefile says:
    libexecdir=${APACHE_DIR}/libexec
    So it appears to be ignoring the definition from apxs. It also appears that the definition of libexecdir appears to be variable only up until libexec. It looks like you can't tell it to use a subdirectory.
    It's easy enough to just move the installed files into the httpd directory, with sudo mv /usr/libexec/mod_jk.* usr/libexec/httpd, but it's a little annoying to have to remember to do this every time I upgrade mod_jk.
    Has anybody else run into this with this or other modules? Is it a bug that should be reported to either Apple or Apache? Does anybody have a better solution than moving the files?

    MoonSwan wrote:I have a desktop system and a netbook that I would like to have hibernating when they aren't being used.  The wiki outlined roughly how to accomplish this with this page:  https://wiki.archlinux.org/index.php/Tuxonice
    I downloaded from the AUR the kernel26-ice 2.6.38-4 to compile and install.
    Hm... netbook.
    If you don't mind trying bfs and bfq too, then you could give the pf-kernel that is mentioned in the wiki too a try:
    http://aur.archlinux.org/packages.php?ID=50956
    It has a repository here:
    [pfkernel]
    Server = http://dl.dropbox.com/u/11734958/$arch
    and a thread: https://bbs.archlinux.org/viewtopic.php?id=103462
    I'm not quite sure how netbook performance is affected by BFS...
    It has the bonus to already be based on 3.0.
    Last edited by Cdh (2011-07-28 20:35:50)

  • Package problems when I migrate

    Hello!
    I'm new to Oracle. The migration program creates this package:
    CREATE OR REPLACE PACKAGE SUB_APPROVEPkg AS
    TYPE RCT1 IS REF CURSOR RETURN keyword%ROWTYPE;
    END;
    When I try to compile this package I get an error on keyword that says that the reference isn't declareted? I have a table called keyword that I have created before. Why can't I compile the package?
    /Marcus

    If the package and keyword table are resident under different users schemas, you will need to qualify the reference to the keyword table with the owners username i.e. If the package is owned by scott/tiger and the keyword table by migration/technologies, then the package will have to look like this :
    CREATE OR REPLACE PACKAGE SUB_APPROVEPkg AS
    TYPE RCT1 IS REF CURSOR RETURN migration.keyword%ROWTYPE;
    END;
    Additionally, make sure the keyword table built without error within the destination Oracle database.

  • Problem when compiling example from TechEd 2008

    Hi,
    I' am using sap sneak preview 7.01 and I'm trying to compile the ZMHO_EX3_*  webdynpro example.
    I get the error :
    "syntax error : long text".
    When I check the syntax I have allways the same error :
    Field ")" is unknown...
    each time the source code follow this structure :
    wd_this->mr_message_manager = wd_this->wd_get_api ( )->get_message_manager( ).
    All the attributes of the assistance class ZCL_MHO_WD_SERVICE are red highlight.
    I need to use FlashIsland to create mockups for a ramp up client, can you help me to solve this this problem ?
    Thanks,
    Regards

    Hi,
    thank you very much for answering me so quickly, I really appreciate this.
    I'have already try to fix the problem by splitting the line code, but it doesn't work.
    I paste bellow my piece of code, it is located in the method wdoinit of the component controller
    METHOD wdoinit .
    data l_api type ref to if_componentcontroller .
    l_api = wd_this->wd_get_api( ) .
    wd_this->mr_message_manager = l_api->get_message_manager( ) .
    wd_this->init_new_record( so_id = '00000000005000000010' ) .
    wd_this->read_products( ) .
    ENDMETHOD.
    I get the following error :
    The result type of the function method cannot be converted into the type of l_api type of l_api.
    Instead of if_componentcontroller I tried ig_componentcontroller too, but it doesn't work too.
    The long text error at the origin of my post as a lot of occurences in the syntax error window when I check this application: about 10 errors with the same origin.
    All attributes of the assistance class ZCL_MHO_WD_SERVICE are allways displayed in red, is it normal ?
    Have I to setup/upgrade something on my system in order it will work ?
    (There is a lot of errors, since is there a global solution to fix it in one shoot ?)
    Thank you,
    Regards.

  • Problem when compiling for IOS

    Hello to all guys, before today i compiled my little app for ios easely but from this morning i'm having this error using AIR 3.8:
    however i can install my app on my iphone5 with no problems but i'm scared for this message
    p.s. before using AIR 3.8(version 3.7) i had this problem and another like PIE error but with AIR 3.8 the PIE error disappeared

    up

  • Output Designer Executable Problem When Compiling

    I am currently experiencing a problem compiling some templates, where the Output Designer crashes with the following message 'Output Designer Executable has encountered a problem and needs to close. We are sorry for the inconvenience.'
    I have been working with a number of templates and most have compiled successfully without any problem. However occasionally they are crashing where they previously worked before. I also experience this problem using Test Presentment.
    This crash is happening intermittently, but often enough to be causing me problems.
    My feeling is it something to do with XP and memory allocation for compiles but I have not got to the bottom of this.
    Can anyone give me any advice over this problem. Have any of you experienced this problem, if so how did you resolve it ?
    Is there any settings that would solve this ?
    Thanks
    Stephen

    Stephen,
    I am having a similar problem. Have you been able to figure it out yet?
    Thanks,

  • Flash.filesystem problems when compiling a library

    I get an error when I am trying to create a library project; I get an error of type not found. I can use the same code in a Flex project and there are no problems.
    When I did a little digging it is telling me that the filesystem is only available in Air, this does not make any sense to me.
    Any suggestions would help.

    Hi Sammy
    Do you get any errors whilst the application builder is actually running?
    Also can you save the build script from a build where you experience these problems after wards and post it on the forum - it may give an insight in to why these problems occur.
    Are you able to build executables without having them as llb's? I'm not sure where the problem lies at the moment - it may be a problem with your application builder - but as you say you have uninstalled and reinstalled I would hope that any possible problem would have been eliminated.
    Do you still experience the same problem with an llb stored on your local machine?
    If you can let me know then I'll look into this further
    Thanks
    Hannah
    NIUK & Ireland

  • Problem when compiling

    Hey , well whenever i compile this code :-
    public class Enum2 {
        enum Dog {
            sled(120),
            yard(80),
            lap(25);
            int weight;
            Dog(int weight) {
                this.weight = weight;
            int getWeight() {
                return(weight);
        public static void main(String arg[]) {
            TextWindow tw = new TextWindow("Enum2");
            Dog rover = Dog.yard;
            tw.line("Rover is a " + rover +
                    " dog and weighs about " + rover.getWeight() + " pounds.");
    }I get this error:
    C:\Documents and Settings\S2s\Desktop\Java\Enum2.java:16: cannot find symbol
    symbol  : class TextWindow
    location: class Enum2
            TextWindow tw = new TextWindow("Enum2");
            ^
    C:\Documents and Settings\S2s\Desktop\Java\Enum2.java:16: cannot find symbol
    symbol  : class TextWindow
    location: class Enum2
            TextWindow tw = new TextWindow("Enum2");
                                ^
    2 errors
    Tool completed with exit code 1May someone tell me why Textpad keeps telling me that theres an error?
    Many thanks

    Provided you have written this class TextWindow, in some other package, then you are required to import it, and set the class path from command promt it is like:
    set classpath=.;f:
    where . is the current directory location and say f: drive is where you have the .class files.
    make sure to set the class path to location were you have directed your .class files.

  • Copied an existing Oracle 6i Form and made change and problems when compiling.

    I copied an existing Oracle 6i Form and made numerous changes to the form. The biggest change I made was taking on of the existing data blocks and I renamed it and also removed some of the items within the data block. After the additional changes to the form to make it look like I wanted it to, I tried to compile the form.
    When trying to compile the form I received an error that it could not resolve item reference. The item it is talking about was one within the data block that we renamed and hence after renaming the data block we removed this item.
    I have check via search for sql and plsql code to see if I could find this item it was referencing, no luck.
    Does anyone have and idea of where this item may exist so we can remove it.
    Please let me know.

    Could it be one of the properties on another item that is referencing the missing item? e.g. the Synchronize with Item property.
    Save your form to a text file and do a text search.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Problem when compiling C program from RFC SDK with Unicode on AIX 5.3

    hi friends.
    I try RFC with UNICODE.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90313271-2311-2a10-c495-c20199d1d821
    This simple code compiled.
    #include <saprfc.h>
    #include <sapuc.h>
    #include <sapucx.h>
    int mainU(int argc, SAP_UC* argv[] )
        const SAP_UC* s1 = cU("Hello");
        SAP_UC s2[100];
        strcpyU( s2, s1);
        printfU(cU("%s
    "),s2);
        return 0;
    The compiling command is
    cc -DSAPwithUNICODE -I ../rfcsdkU/include -L ../rfcsdkU/lib sample.c -o sample -lrfcu -lC
    to compile.
    Then the error information comed:
    "sample.c", line 7.24: 1506-045 (S) Undeclared identifier U16LIT_cU.
    "sample.c", line 7.27: 1506-275 (S) Unexpected text string literal encountered.
    "sample.c", line 10.16: 1506-276 (S) Syntax error: possible missing ')'?
    I hope someone can tell me how I can get it through.
    Edited by: sakamoto shouichi on Apr 16, 2008 11:02 AM
    Edited by: sakamoto shouichi on Apr 16, 2008 11:03 AM

    hi friends. I'm having same problem.
    i speak english just a little.sorry.
    see this command line.
    AIX5.3
    cc -I ../rfcsdk/include -L ../saprfc/rfcsdk/lib sapinfo.c -o sapinfo -lrfc -lC
    add -lC .
    i fnish this problem. thnx!
    Edited by: sakamoto shouichi on Apr 7, 2008 5:32 AM

Maybe you are looking for