Import statement is not working

hi everybody,
I have a directory under which I have a number of sub-directories. Lets call this directory "parent_directory". under this directory I have another directory called "child_1". Under "child_1" I have another subdirectory called "child_2". Now I have a code in child_2 that has the following statement:
import program_1;
//this is a program present in the parent directory. lets call it
//program_1.java
when I am compiling I am getting an error saying:
program_2.java:28: '.' expected
import program_1;
^
1 error
program_2.java is the program present in child_2 in which I have included the import statement.
If I change the ";" to "." then again error appears as the import statement only needs the name of the class and doesnot need the extension.
I will be very grateful to you if you could please suggest me a way around this.

This questions belongs in the "New to Java" forum ...
sigh
Anyways, import works on package names with trailing * or full qualified class names, e.g.import mypackage1.*; // imports all classes in mypackage1
import mypackage2.MyClass2; // imports MyClass2 from mypackage2So instead of import program_1; you need to do
1. ensure that program_1 is in some package
2. ensure that your directory structure mirrors your package structure (same names!)
3. ensure that your CLASSPATH is either not set at all or points to the parent dir of your topmost package
Example:
Directory structure:C:\tmp\java\top\
C:\tmp\java\top\MyClass1.java
C:\tmp\java\top\bottom\
C:\tmp\java\top\bottom\MyClass2.java
CLASSPATH=".;<java install dir>\jre\lib\rt.jar;C:\tmp\java"Source for MyClass1.java:package top;
public class MyClass1 {
}Source for MyClass2.java:package top.bottom;
import top.MyClass1;
public class MyClass2 {
  private MyClass1 myClass1;
}

Similar Messages

  • Insert statement will not work if select statement has less number of colum

    Hi,
    One of my thread is already resolved on the following URL : unable to insert rows into the table
    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM CASE_101 WHERE 1=2;
    DECLARE
    S VARCHAR2(200);
    STMT VARCHAR2(500);
    begin
    for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CASE%' TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
    STMT := 'INSERT INTO TEMP SELECT * FROM ';
    STMT:=STMT || C.TABLE_NAME;
    EXECUTE IMMEDIATE STMT;
    dbms_output.put_line(c.table_name);
    end loop;
    end;
    i am facing now some different; almost all the tables have same number of columns except in few of tables have some additional columns. As above i am creating a table "TEMP" who has highest column temp(by doing some manual process). The table who has less columns than "TEMP" table : Insert statement will not work. 'INSERT INTO TEMP SELECT * FROM less_columns_table_name'.
    Please let me know , how can i execute proper way.
    Thanks.
    Best Regards
    Arshad

    user13360241 wrote:
    Hi,
    One of my thread is already resolved on the following URL : unable to insert rows into the table
    DROP TABLE TEMP;
    CREATE TABLE TEMP AS SELECT * FROM CASE_101 WHERE 1=2;
    DECLARE
    S VARCHAR2(200);
    STMT VARCHAR2(500);
    begin
    for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CASE%' TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
    STMT := 'INSERT INTO TEMP SELECT * FROM ';
    STMT:=STMT || C.TABLE_NAME;
    EXECUTE IMMEDIATE STMT;
    dbms_output.put_line(c.table_name);
    end loop;
    end;
    i am facing now some different; almost all the tables have same number of columns except in few of tables have some additional columns. As above i am creating a table "TEMP" who has highest column temp(by doing some manual process). The table who has less columns than "TEMP" table : Insert statement will not work. 'INSERT INTO TEMP SELECT * FROM less_columns_table_name'.
    Please let me know , how can i execute proper way.
    Thanks.
    Best Regards
    Arshadmore often than not "TEMP" tables are NOT required & are highly inefficient in Oracle.
    Either only specify explicit column in TEMP to get data,
    or provide value for "extra" column in TEMP

  • CASE Statement is not working Derived table

    Hi All,
    in the bello SQL Statement case statement is not working in derived table. I am new to creation of derived table if any body knows plz kinldy help me out on this.
    SELECT x.market, x.droprate as med1
    FROM
    (select upper(market_name) as market, fulldate as date_value,
         (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN (month(BBHDLY.FullDate)}>= 6 and { year(BBHDLY.FullDate)} = 2011) or {fn year(IDENSLABBHDLY.FullDate)} > 2011
    THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >= GETDATE()-46
                   group by market_name, fulldate) x,
    (select market_name as market, fulldate as date_value,
    (sum([Dy_LOT_DROPS_N][Dy_OB_HO_DROPS][Dy_NonRF_Drop]))/
              nullif(sum(CASE WHEN ({fn month(BBHDLY.FullDate)}>= 6 and {fn year(BBHDLY.FullDate)} = 2011) or {fn year(BBHDLY.FullDate)} >
    2011 THEN  BBHDLY.Dy_Calls - BBHDLY.Dy_HO_CHAN_ALLOC ELSE BBHDLY.Dy_Calls END),0)*100 as droprate
    from BBHDLY sla
    inner join Dim mkt
         on sla.bts_name = mkt.bts_name and sla.SectorID = mkt.Sector_Id
                   where fulldate >=GETDATE()-46
                   group by market_name, fulldate) y
    where x.market = y.market
    GROUP BY x.droprate, x.market
    HAVING
       SUM(CASE WHEN y.droprate <= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)+1)/2 AND
       SUM(CASE WHEN y.droprate >= x.droprate
          THEN 1 ELSE 0 END)>=(COUNT(*)/2)+1
    Thanks

    It looks like SQL Server or Sybase given that you're using getdate().
    As such, Vinesh's comment to use decode is wrong - decode is  Oracle syntax.
    Looking at your statement again, I've noticed the following:
    you have no { to match the first } - not sure why you're using them anyway.
    you haven't given x.market a name - use x.market as market instead
    use coalesce instead of nullif if you're on SQL Server.

  • Insert statement is not working for z table.

    Hi experts,
    My insert statement is not working.
    I have used follwing code to update z table .
    INSERT ztable FROM TABLE gt_table.
    here i have checked gt_table and its filled up with all the records properly.
    now the problem is in this table i have 15 fields and it inserts 14  fields of it but
    the last field is never inserted though in gt_table i can see value for last fields also.
    I have added this field in ztable recently . so i also used se14 to adjust table but still i am facing same problem.
    please help me out.
    thanks,
    Neo

    > > Table maintainance will have nothing to do with
    > this
    > > issue.
    >
    > It does sometimes when you are trying to see the
    > values from SM30 instead of SE16. The value may be
    > there, but it may just not seen in SM30 because the
    > table maintenance hasn't registered the addition of
    > new field.
    >
    > Another place to look at is the activation log to see
    > if there are any warnings issued there.
    You shouldn't use SM30 to view table entries. You use this transaction to maintain the table entries. Pure and Simple.

  • Delete Statement is not working correctly

    Hello,
    The following delete statement is not working correctly.
    If I press delete it will delete everything in the category table
    I don't know whats wrong with it.
    ----delete row from category if there is not infrastructure to support------
    IF :P12_DFCY_SEQNO4 IS NOT NULL AND :P12_DFCY_CATG_C = '7' THEN
    DELETE FROM DFCY_CATG
    WHERE NOT EXISTS(SELECT I.DFCY_SEQNO
    FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
    WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
    AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
    end if;
    Thanks
    Mary

    Hi,
    IF :P12_DFCY_SEQNO4 IS NOT NULL AND :P12_DFCY_CATG_C = '7' THEN
    DELETE FROM DFCY_CATG
    WHERE NOT EXISTS(SELECT I.DFCY_SEQNO
    FROM DFCY_CATG C, DFCY_CATG_INFRSTRCTR I
    WHERE C.DFCY_SEQNO = I.DFCY_SEQNO
    AND :P12_DFCY_SEQNO4 = I.DFCY_SEQNO);
    end if;So, if P12_DFCY_SEQNO4 does not exist, then I would expect all records to be deleted because the NOT EXISTS() function would just return TRUE for every record on the table. Somewhere in the statement, I would expect to see something that links between the table being deleted from and the NOT EXISTS() data or, perhaps, using the P12_DFCY_CATG_C value as a filter?
    Andy

  • Delete statement is not working.

    Hi,
    find the code. Here the delete statement is not working and i am getting sy-subrc = 4. although ,
    xe1edp10-idnkd = 34596 and dint_edidd -sdata = 34596.
    please help me ...
    loop at dekek_x.
    loop at dint_edidd where segnam = 'E1EDP10'.
    if dekek_x-stpin = 1 .
    CLEAR xe1edp10.
      MOVE dint_edidd-sdata TO xe1edp10.
    delete dint_edidd where sdata = xe1edp10-idnkd.
    endif.
    endloop.

    1st thing..
    i tried this :
    tables: edidd, e1edp10.
    edidd-sdata = '315934 EA 017'.
    WRITE edidd-sdata.
    move edidd-sdata to e1edp10.
    IF edidd-sdata = e1edp10-idnkd.
    WRITE: e1edp10-idnkd.
    else.
      WRITE: 'nothing'.
    ENDIF.
    output
    >315934 EA 017
    >315934 EA 017
    2nd thing,.
    your loop inside loop doesnt make any sense as they are not related any where.
    3rd thing:
    the fields are not type compatible.. this might be the reason for wrong delete statement..
    and 1 more clarification:
    TABLES: edidd, e1edp10.
    DATA :it TYPE TABLE OF edidd WITH HEADER LINE.
    edidd-sdata = '315934 EA 017'.
    WRITE edidd-sdata.
    APPEND edidd TO it.
    edidd-sdata = '315934 EA 018'.
    APPEND edidd TO it.
    LOOP AT it." where segnam = 'E1EDP10'.
      CLEAR e1edp10.
      MOVE it-sdata TO e1edp10.
      DELETE it WHERE sdata = e1edp10-idnkd.
    ENDLOOP.
    in this also delete is working perfectly fine... you run and check..

  • SORT statement is not working!

    Hi frdz,
    Below SORT statement is not working. Can any one explain me why this is happening.
    SORT i_bseg ASCENDING BY belnr bukrs
                        DESCENDING kunnr.
    I have table content as below.
    BELNR      BUKRS KUNNR   
    0016000000|CROP |         
    0016000000|CROP |0008910168
    Before and after the sort content order is same.
    I want to sort the content like below.
    0016000000|CROP |0008910168
    0016000000|CROP |       
    Is there any thing wrong with the sort statement???
    i_bseg is defined as TYPE STANDARD TABLE OF
    Sort criteria must not change i. e ascending by belnr and bukrs and descending by kunnr.
    Thanks,
    Vinod.

    hi vinod,
    this is because on your statement, you are sorting BUKRS in descending order and KUNNR in ASCENDING order.
    please take note that the sort order should come after the sorted field. if no order is given, the default which is ASCENDING will be used.
    do your sorting like this
    SORT i_bseg BY belnr bukrs kunnr DESCENDING.
    regards,
    Peter

  • Importing bookmarks I go to file and the IMPORT link is not working ... not Illuminated ... what can I do?

    I want to import bookmarks from Explorer and I go to File Tab and the IMPORT link is not working or not illuminated?

    Make sure that you not run Firefox in permanent [[Private Browsing]] mode.
    * You enter Private Browsing mode if you select: Tools > Options > Privacy > History: Firefox will: "Never Remember History"
    * To see all History and Cookie settings, choose: Tools > Options > Privacy, choose the setting <b>Firefox will: Use custom settings for history</b>
    * Uncheck: [ ] "Permanent Private Browsing mode"

  • "Do not import duplicates" is not working

    The "Do not import duplicates" box is checked for all imports but is not working.  This is both for my Nikon DSLR, my Canon S-95 and my iPhone. This was happening with both Snow Leapord and Lion as operating system.  I have been using Aperture since the first release and only in the last few months has this been an issue.  Any thoughts?

    There's a known (and old) bug when duplicate identification fails on photos
    that have been imported from another catalog.
    Sent from phone.

  • ?Import ? Statmenet Not working When Deploying it on Server.

    What should be the process if I want to use import statement in RTf template on Standalone BI Publisher (Verision 10.1.3.4)
    I have uploaded both the main.rtf and include.rtf and I have put the <?import:include.rtf?> in main but it does not work.
    Please advise
    Thanks

    I did that but it complains that file not found. I used the following statement
    MAIN FILE
    <?import:include.rtf?>
    <?call:TC?>
    SUB TEMPLATE (include.rtf)
    <?template:TC?>
    TESTING THIS Include Page
    End Template
    It complains that file not found.
    I have uploaded both the file BI Publisher Console.
    May be I am putting the wrong path or something now sure.

  • JSP import directive does not work

    We are using WebLogic 5.1. We have a problem with our
              JSPs. The jsp compiler could not find the Connection class
              until we said java.sql.Connection.
              We had a valid import statement! We had
              <%@ page import="java.sql.*" %> and this page worked
              perfectly under Resin.
              Does Weblogic not implement the JSP spec correctly?
              Please help-- urgent!
              Thanks,
              Brian Williams
              

    Try to put flush="true" behind the page attribute, maybe it'll work now.
              for example: <jsp:include page="<%= inludeName%>" flush="true">
              Greetz
              Tom
              "rl" <[email protected]> schreef in bericht
              news:[email protected]..
              > Hello,
              > I'm new to weblogic.
              >
              > I got an jsp page wich shuold open another .
              >
              > I use the following command:
              >
              > <jsp:include page="<%= inludeName %>"/>
              >
              > This don't work.
              >
              > What can I do , that this will work?
              >
              > MfG,R.Lenz
              >
              >
              

  • SELECT statement does not work if characters ## are contained in field

    Hi Experts,
    I have the following statement:
    select single field1
        from table1
        into var1
        where field2 = text.
    This is a very simple statement that is working for me almost always correct. However there is a situation where the system is not able to find the record in my table. If text is equal to JAN##2011 the system won't deliver a result even if I have an entry in table1 with exactly this value.
    TABLE1
    field1 field2
    rome JAN##2011
    paris JAN2011
    only if text is JAN2011 the select will find a result.
    all fields are defined as CHAR.
    Thanks in advanced

    Hi Alberto,
    probably ## is not ## :-).
    is the visible representation used by ABAP to show any non-displayable characters as control characters like TAB, CR, LF, FF and the like.
    In debugger you can switch to HEX display of values, if you see something like 0A0D you can find this using CL_ABAP_CHAR_UTILITIES constant attributes.
    Regards
    Clemens

  • Message statement is not working?

    I would like to place a message in the following method:
    It's defined like this:
    Position & cannot be delimited because the position is occupied until &
    This is in the program:
    MESSAGE: s029(zpom_001) WITH st_hrp1001-objid(8) st_hrp1001-endda(8), display like 'E'.
    I inserted the (display like 'E' ) in so I can get the RED 'X' error message.  If I take out the display like 'E', it works.
    I get the following error:
    Three-digit error number XXX required in the "MESSAGE EXXX..." statement.
    Thanks for any help you can give?
    Jeff

    Satish,
    That did not work...
    If I remove the part of the message (  Display like 'E' )  it works......  But if I want to get a RED X error message, what would I do?
    JeffG

  • Import metadata xml not working

    Import metadata as Xml Datasource with network files(using url) not working and giving a message cannot connect - invalid url.
    but the same url can be run from a browser.
    What can be the problem?

    Hi Radosla,
    Yep, thx for the hint.
    Looks like i put it on th test server in compatibility mode, but not on the real server.
    Changing this with F12 to IE 8 did the trick!
    Regards
    Frederik

  • Import scenario package not working

    Hi exports,
    On a test environment i created a scenario which i now would like to transfer to another server.
    I exported the correct scenario, but on the other server, the import is not working.
    I can submit my package, it shows that there is no current version of this package, but hitting the "IMPORT" button doesnt do anything.
    Im using (on both servers) SAP B1 9.0 pl 08 with the same integration framework.
    Any idea's on how to solve this?
    Kind regards
    Frederik

    Hi Radosla,
    Yep, thx for the hint.
    Looks like i put it on th test server in compatibility mode, but not on the real server.
    Changing this with F12 to IE 8 did the trick!
    Regards
    Frederik

Maybe you are looking for

  • Problem in using at selection-screen output

    Hai Frnds, I am using 5 parameters in the selection screen . I am entering data in the 4 input fields. Then I am doing concatenate 4 fileds data into the 5th field in the event AT SELECTION-SCREEN OUTPUT, but my problem is When ever i click ENTER , t

  • Need help about portal server

    hi, i'm new to java. and i installed java enterprise server on windows xp. the installation was successful ..but i can't login to portal server using the admin console username/password ? ....how do i set the password for the portal server ? ....and

  • No print preview

    Office Jet 5742 has no print preview option. Anyway to attain this option?

  • Need to make a Call Center

    I need to make a call center at HQ Using a co-lines directly connected to the V3PN router to route calls to the other three VOIP branches? Also can any external call at the branches be routed to the call center at HQ?

  • Editing in Photo elements 7

    I had to reinstall my windows 7 operating system.  In so doing I lost all my programs.  When I re-installed adobe photoshop elements 7, I cannot open the editor, which is where I have fixed all my photos.  Please help!  I am totally  lost without thi