.java files located in different directories - trouble compiling

My attempts at getting my main .class file (../master/BicycleMaster.class) to automatically recognize that it's supporting .class file (../master/child/BicycleChild.class) located one directory below keep failing and the .java files won't compile.
If I move both .java files to the same location (in the ../master directory) then they compile and run just fine, but it's when I want to separate them into the two different directories that I have a problem compiling them. They won't compile because the references in BicycleMaster.jave to BicycleChild.java can't be resolved.
I was hoping - if you have time - that you might be able to show me by example in the code below? In the file ../master/BicycleMaster.java I added 'package master;' as the first line of the code. It was my impression that this would tell the compiler to look in the sub-directories for any additional .java files. This didn't work either.
HERE ARE THE DETAILS:
Directory of K:\COMMON\ITS\STEVEB\java\master
03/04/2008 04:25 PM <DIR> .
03/04/2008 04:25 PM <DIR> ..
03/04/2008 04:24 PM 612 BicycleMaster.java
03/04/2008 03:54 PM <DIR> child
1 File(s) 612 bytes
K:\COMMON\ITS\STEVEB\java\master>type BicycleMaster.java
package master;
class BicycleMaster {
    public static void main(String[] args) {
        //Create 2 different bicycle objects
        BicycleChild bike1 = new BicycleChild();
        BicycleChild bike2 = new BicycleChild();
        //Invoke methods on the objects
        bike1.changeCadence(50);
        bike1.speedUp(10);
        bike1.changeGear(2);
        bike1.printStates();
        bike2.changeCadence(50);
        bike2.speedUp(10);
        bike2.changeGear(2);
        bike2.changeCadence(40);
        bike2.speedUp(10);
        bike2.changeGear(3);
        bike2.printStates();
}Directory of K:\COMMON\ITS\STEVEB\java\master\child
03/04/2008 03:54 PM <DIR> .
03/04/2008 03:54 PM <DIR> ..
03/04/2008 03:54 PM 524 BicycleChild.java
1 File(s) 524 bytes
K:\COMMON\ITS\STEVEB\java\master\child>type BicycleChild.java
class BicycleChild {
    int cadence = 0;
    int speed = 0;
    int gear = 1;
    void changeCadence(int NewValue) {
        cadence = NewValue;
    void changeGear(int NewValue) {
        gear = NewValue;
    void speedUp(int increment) {
        speed = speed + increment;
    void applyBrakes(int decrement) {
        speed = speed - decrement;
    void printStates() {
        System.out.println("Your cadence: "+cadence+", Your speed: "+speed+", Your gear: "+gear);
}HERE ARE THE ERRORS:
First I compile the ../master/child/BicycleChild.java file and it compiles fine. This I attempt to compile ../master/BicycleMaster.java and I get the following errors:
K:\COMMON\ITS\STEVEB\java\master>javac BicycleMaster.java
BicycleMaster.java:5: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike1 = new BicycleChild();
^
BicycleMaster.java:5: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike1 = new BicycleChild();
^
BicycleMaster.java:6: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike2 = new BicycleChild();
^
BicycleMaster.java:6: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike2 = new BicycleChild();
^
4 errors

Thanks so much for responding. Progress was definetly made as the compiler now works longer before erroring out. Sadly it's still erroring out for a reason I'm not understanding. Please let me know if you can see where I'm going wrong.
Here's how it played out for me:
K:\COMMON\ITS\STEVEB\java>echo %classpath%
.;k:\common\its\steveb\java\;C:\Program Files\Java\jre1.6.0_04\lib\ext\QTJava.zip
K:\COMMON\ITS\STEVEB\java\master\child>javac BicycleChild.java
K:\COMMON\ITS\STEVEB\java\master\child>cd ..
K:\COMMON\ITS\STEVEB\java\master>javac BicycleMaster.java
BicycleMaster.java:5: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike1 = new BicycleChild();
^
BicycleMaster.java:5: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike1 = new BicycleChild();
^
BicycleMaster.java:6: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike2 = new BicycleChild();
^
BicycleMaster.java:6: cannot find symbol
symbol : class BicycleChild
location: class master.BicycleMaster
BicycleChild bike2 = new BicycleChild();
^
4 errors
Here are the two programs revised as you suggested:
K:\COMMON\ITS\STEVEB\java\master\child>type BicycleChild.java
package master.child;
class BicycleChild {
    int cadence = 0;
    int speed = 0;
    int gear = 1;
    void changeCadence(int NewValue) {
        cadence = NewValue;
    void changeGear(int NewValue) {
        gear = NewValue;
    void speedUp(int increment) {
        speed = speed + increment;
    void applyBrakes(int decrement) {
        speed = speed - decrement;
    void printStates() {
        System.out.println("Your cadence: "+cadence+", Your speed: "+speed+", Your gear: "+gear);
}K:\COMMON\ITS\STEVEB\java\master>type BicycleMaster.java
package master;
class BicycleMaster {
    public static void main(String[] args) {
        //Create 2 different bicycle objects
        BicycleChild bike1 = new BicycleChild();
        BicycleChild bike2 = new BicycleChild();
        //Invoke methods on the objects
        bike1.changeCadence(50);
        bike1.speedUp(10);
        bike1.changeGear(2);
        bike1.printStates();
        bike2.changeCadence(50);
        bike2.speedUp(10);
        bike2.changeGear(2);
        bike2.changeCadence(40);
        bike2.speedUp(10);
        bike2.changeGear(3);
        bike2.printStates();
}

Similar Messages

  • Compiling multiple java files present in different packages simultaneously

    Hi,
    I have multiple java files which are present in different folders.
    In some cases, files are importing classes from other packages i.e. some kind of inter-dependency
    How do I compile these java files simultaneously?
    Any help would be highly appreciated.

    Pawan_Anand wrote:
    Hi,
    I have multiple java files which are present in different folders.
    In some cases, files are importing classes from other packages i.e. some kind of inter-dependency
    How do I compile these java files simultaneously?
    Is it circular?
    Thus the dependency is A => B => C => A?

  • How to compare the *.so files of two different directories?

    Good morning,
    I am working in a software development company that works as follows:
    - we have a platform, that consists of a list of *.so files.
    - we deliver a product, based on that platform, that also consists of a list of *.so files.
    - all our sources are managed via Clearcase.
    Now I have the following situation:
    - we have created a new Clearcase view, where we (should have) all correct sources. These have been compiled, resulting in a list of *.so files.
    - we have a copy of the product that we have delivered at the client.
    I would like to verify whether the *.so files of the new Clearcase view are the same as the ones that have been delivered to the client.
    Why is this such a problem?
    - I could check the "cksum" result, but as the Solaris command "cksum" takes into account the compilation date, I have different "cksum" results for *.so files that are basically equal.
    - I could check the filesize, but a small change in a source might change the behaviour of the *.so file but not necessarily its filesize.
    - I could check the "what" result (the "C Compilation System" "what" command), which gives the Clearcase status, so that I can check whether the same Clearcase versions have been delivered, but while doing this, I have seen that *.so files have been delivered, the sources of which were checked OUT (!), so also this does not give me any certainty.
    - In addition, it is possible that there is a change in the platform components, resulting in a different product specific *.so file, which however does not mean that the behaviour of the product specific *.so file is different.
    Therefore I am looking for another way of comparing two binary *.so files, in order for me to judge the correctness of the new Clearcase view.
    Does anybody have an idea?
    Thanks
    Dominique

    Thanks Alan for the fast response,
    Unfortunately, I don't have "elfsign" on my system and reading more about the command, I have the impression that this command can verify whether a signature is correct, but in order to do so, the file needs to be signed before, which is not the case here.
    Do you have other suggestions?
    Thanks
    Dominique
    P.s. yesterday, another issue popped up: the *.so files I am referring to are compiled from a whole list of files, and it seems that the "what" command can only check the Clearcase history of the hole list, while in our department, mostly only the impacted files are checked out/checked in for doing an update, and not the hole list of files, causing the "what" command to give erroneous results.

  • OAF Java File Location

    Hello,
    I need to create a customization in iProcurement and for that reason I need to find the java files in the server, I have searched the server and the only files that I have found are the class files, how can obtain the java files or where is their location.
    Thanks

    Moreover if you want to get the original source code file from oracle, then you would have to raise TAR asking for source Java file.

  • Dynamic Routing? how to read files from 2 different directories?

    i need to do that..pick files but from 2 different locations..
    any simple idea?
    yes, the best simple is to have 2 bpels listenening to each directory...
    can i create only 1 BPEL?
    i heard about Dynamic Routing...too complex?
    Thanks!
    Pablo.

    Hi,
    I guess you can try it with Pick as the initial activity( With Create Instance Checked) and you map your two File Adapter to two On Message branches..
    I guess this should work but i am not sure how far this is reliable.. with Pick..
    Worth giving a try..
    Thanks,
    Jp

  • How to run an applet with .java files in 2 dirrerent directories ?

    I have an applet with :
    5 .java class files and its .html file in one directory and
    2 .java class files ( with identical names) and its .html file in another directory .
    How do I go about executing this applet ? In the past all the applets
    I have run had all the classes in one directory.
    Thank you in advance

    If you want them both in the same page, put both applet tags in 1 page,
    I could do that but both directories have a SpaceDunes.class
    and both directories have a Shot class (diffferent immplementations
    but the same name)
    so the applet tag
    <APPLET CODE="SpaceDunes.class"
    CODE="SpaceDunes.class"
    This can't be the right approach ? ?
    Thank you for your advice
    <HTML>
    <HEAD>
      <TITLE>SpaceDunes Applet
      </TITLE>
    </HEAD>
        <BODY>
         <H1>SpaceDunes Applet
        </H1>
          <HR>
            <APPLET CODE="SpaceDunes.class"
                              CODE="SpaceDunes.class"
                         WIDTH=500
                         HEIGHT=500
                           CODEBASE=".">
                ALT="Your browser understands the <APPLET>
                         tag but isn't running the applet, for some reason."
                          Your browser is ignoring the <APPLET> tag!
          </APPLET>
         <HR>
        </BODY>
    </HTML>

  • File location is different for other webpages

    I was wondering if this is bad? I have my template set for my other pages as like ../file name, but when I do my other pages its //C /user / documents/ website. Does this automattically self correct when I up load to a server or what?

    This is how all links will look in an unsaved page. DW has no idea what the path is to any linked file until you have saved the page, so it uses an absolute 'file' link to compensate. When the page is saved, the link is automatically adjusted in light of the location of the saved page and the location of the target file.
    If you have saved pages that contain links looking like that, then your links will NOT work when you upload the files. Almost always, this problem is the result of not working within a site that has been properly defined in Dreamweaver. Can we see the path that you have placed in the Local Root folder part of your site definition (edit it with DW's SITE > Manage Sites menu option).

  • Losing File Locations Across Different Users

    Hi!
    The snow yesterday caused a partner to open an InDesign Book that I was working on, but when she opened a file in the book, the links were broken.
    A little background: are are both using IDCS5 on an Intel iMac using MacOs 10.6.6. The ID book & files (as well as graphics) are on a disk we call "X", and the content (DOCX) files are all kept on a drive called "Y". Both "X" & "Y" drives are on the same IP address, and as near as I can tell, are connected the same way from both her and my machine. The server itself is a Windows Server 2008.
    Now, ID finds the graphics on both machines just fine. It is the content source on the "Y" drive that gets lost. The link information on my machine says "Y:/content...", while hers says "X:/content..."
    Any idea what is causing this issue? A little research tells me that sometimes MacOs doesn't actually save network locations starting in the "/Volumes" folder, but our IT Specialist has checked this and says that both our network settings are the same. We are both logging on to the network from two separate accounts as well. We are also not structuring these files as XML, so there are no attributes assigned to our linked assets.

    Im excited to be heading to New York this week for the AWS Summit, and not just for the chance to discover strange new life forms. Its a a well timed event as we are doing a lot of work in with public cloud services, and Im looking forward to getting some feedback from people using F5 in AWS. As preparation, Im running through a crash course in Python and Ansible to better understand the excellent AWS deployment scripts that Alex Applebaum and Chris Mutzel have put up on Github. I urge you to check them out although very much a proof of concept at the moment, they represent a great starting point. If you need more of a primer about F5 in AWS then check out Chriss latest blog post, which will give you an overview of the F5 networking setup in AWS. Ill be honest, Im only really dabbling in automation tools at the moment, but the power of...

  • GPO run file located in different forest?

    Hello Community
        In Windows 2008 Server exists Domain1/Forest1 as the trusting domain
    and a Domain2/Forest2 as the trusted domain in a one-way trust relationship,
    can a GPO in Domain1/Forest1 execute a program file, bat file, html file, aspx file
    or any other type of file that resides in Domain2/Forest2 and if so how?
        Thank you
        Shabeaut

    >      In Windows 2008 Server exists Domain1/Forest1 as the trusting domain
    > and a Domain2/Forest2 as the trusted domain in a one-way trust relationship,
    > can a GPO in Domain1/Forest1 execute a program file, bat file, html
    > file, aspx file
    > or any other type of file that resides in Domain2/Forest2 and if so how?
    Since Domain2 is the trusted domain, Accounts from Domain2 can
    authenticate and gain access to ressources in Domain1, not vice versa.So
    the answer is:
    To access ressources in Domain2 from Domain1, the accessor has to
    provide valid credentials of a Domain2 account.
    Which I believe essentially translates ot "no, they cannot".
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • How to call java files from different directories

    hi, how do i call java files from a different directory??
    let say i got partA.java, and i need to include functions from partB.java which is in a different folder. how can i do that?

    Chicon wrote:
    Hi nuttynibbles,
    Before the class declaration in partA.java, you must have an import statement like :
    import someDirectory.partB;
    public class partA {
    ... and before you ask... you'll probably want to read through this http://java.sun.com/docs/books/tutorial/java/package/index.html

  • Oracle EBS R12 - how to compile jsp and keep .java file

    Hello.
    When I compile the jsp file, it will create the _pagename.class file into $COMMON_TOP/_pages directory. Some of the time it also keep _pagename.java file in there.
    How can force the compiler to keep the java file always.  I am using following command which creates _pagename.class file. 
    perl $FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'ptcResponse.jsp' --flush
    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.

    It keeps the _pagename.java file some of the times and not other, example if the compilation fails then java files stored there otherwise only class.
    This is an expected behaviour.
    There has to be some way/location to see/keep the _pagename.java file, we need them for troubleshooting runtime error.
    The "perl ojspCompile.pl" command doesn't offer this -- Issue "perl ojspCompile.pl" and you will see what options are available.
    Your option is to keep/save the java files in a different directory.
    Thanks,
    Hussein

  • How to configure a scenario which posts same file to different directories

    How to configure a scenario which posts same file to different directories of a receiving system?
    Consider an Idoc to file scenario where I have to post same file to two different directories but logical receiver system has to be same.

    Hi,
    You can try out like this: Using multiple receiver interfaces you can send it to multiple directories with the help of enhanced interface determination/conditions and with the help of multiple receiver communication channels.
    Another option is to copy the file from one target directory into another directory  with the help of Unix script by executing the same from the OS command level.
    One more option is to create a Java Server Proxy and inside the proxy, you can write java code to FTP into different locations.
    Hope this helps,
    Regards,
    Moorthy

  • Drop the files into different directories based on the filename

    Hi,
    I had a reqiuirement based on the file name, i should drop the files in to different directories.
    I can get the filename through variable substitution in receiver file communication channel, now i want to drop the file into different folders based on conditions.
    suppose, if the file name is DDDX234
    i should do substring of filename0+(4), if the value is L then i should drop in X directory
    suppose, if the file name is DDDY234
    i should do substring of filename0+(4), if the value is L then i should drop in Y directory.
    How can i drop the file into differnent directories based on filename.
    Thanks
    Srinivas

    Thanks Michal,
    I mapped the directory and filename to the target header in the mapping
    Filename --> UDF --> Header(target)
    and in the receiver channel checked the ASMA and given * in the filename and directory name.
    But in runtime iam getting the error as
    Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header
    MY UDF is
    public String Directory(String a,Container container){
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key  = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
    String FileName = conf.get(key);
    FileName = a;
    conf.put(key, FileName);
    %%%based on filename the directory should change
    String Directory = conf.get(key1);
    Directory = "/SAPInterface/XI/PPD/DHX/out";
    conf.put(key1, Directory);
    return "";
    Help me in correcting this error.
    Thanks
    Srinivas

  • Find and delete files with common name in different directories

    I have hundreds of invisible files in many different directories on my 10.4.11 server with .fstemp at the beginning of their name.
    They are taking up space and I would like to delete them.
    I can find them using
    find . -type f -name .fstemp
    But I can't work out how to use the rm command with a wildcard to delete them - I don't want to have to visit many different directories and run rm.
    Do I need to pipe the results from the find to rm ?
    For extra credit (you can probably tell I am out of my comfort zone here)... the files are all locked. I believe they will need to have
    chflags nouchg /Directory/filename
    applied to unlock them before they can be deleted. Can the terminal pipe find|chflgs|delete?
    Thanks,
    b.

    Well, if they weren't locked you could just 'delete' them in the find command. Otherwise …
    Open the Terminal (from /Applications/Utilities) and copy and paste the following into the Terminal window, one line at a time, with a return after each line:
    sudo -s
    find / -type f -name ".fstemp*" -exec echo 'chflags nouchg "{}" && rm -f "{}"' ; | sh
    I have tested this, but obviously with some substitutions. You only need the double quotes around the curly brackets, "{}", if your filenames contain a space.
    To be on the safe side, you should check this out without the final "| sh". Then you will see the commands that would be executed with the full version.
    Finally type exit to get out of the root shell.

  • Error: code too large for try statement, when compiling a big java file.

    Hi,
    I have a big java file ( around 16000 lines). When compiling it, I got following error message:
    MyMain.java:15233: code too large for try statement
    } catch ( Throwable t ) {
    In MyMain.java, I just repeat following statements about 1000 times.
    try {
    if ( year >= 2002 ) {
    System.out.println( "year: Evaluation version is not valid" );
    } else {
    System.out.println( "year: Evaluation version is still valid" );
    } catch ( Throwable t ) {
    if ( year >= 2002 ) {
    System.out.println( "year: Evaluation version is not valid" );
    } else {
    System.out.println( "year: Evaluation version is still valid" );
    I tried 1.3 and 1.4 javac compiler, there was some error.
    How to make compiler to compile this code?
    Thanks,

    Hi,
    I have a big java file ( around 16000 lines). When
    compiling it, I got following error message:
    MyMain.java:15233: code too large for try statement
    } catch ( Throwable t ) {
    I tried 1.3 and 1.4 javac compiler, there was some
    error.
    How to make compiler to compile this code?
    You don't. Each method has an absolute limit on the number of byte codes. You have reached that limit. The limit is part of the specification and JVMs will refuse to run classes that exceed the limit. So even if you could compile it, it wouldn't run.
    It is quite common for code generators to generate large monolithic blocks of code. Presumably this is how you got to this spot. Modify the code generator to break it into smaller blocks.
    If you did it manually then you did it wrong. And you will have to manually break it into smaller blocks. (And re-examine your design since it is probably wrong.)

Maybe you are looking for