Import Statement Error

Does anyone know what is wrong with these import statement?
import Reduction;
import Mapper;
import ApplyObj;
import ApplyObjUnary;
import java.lang.String;
public class Driver{
public static Driver me = new Driver();
public static void main(String[] args){
int i;
I places all my *.java file in the same directory as Driver.java
But when i try to compile Driver.java, it says :-
C:\assignment1>javac Driver.java
Driver.java:10: '.' expected
import Reduction;
^
Driver.java:11: '.' expected
import Mapper;
^
Driver.java:12: '.' expected
import ApplyObj;
^
Driver.java:13: '.' expected
import ApplyObjUnary;
^
4 errors
I set my class path as
C:\>SET CLASSPATH = .;C:\j2sdk1.4.0_01;c:\assignment1
Apparently, the current directory has been set and my assignment1 directory has been set.
Did i miss out anything? Why does it can't recognize the existence of other class file in the same directory?
thanks.

You don't need to import classes that are in the default package (i.e. you didn't put them in a package). And in Java 1.4, you can't import them. Just remove the import statements, you shouldn't need them.

Similar Messages

  • Import statement error as SYSDBA

    Hi,
    As I need to use Sys user as SYSDBA, the syntax through an error which given below.
    Kindly come up with Correct syntax to use SYS user as SYSDBA while import the dump.
    c:\>imp userid=sys/sys@orcl AS SYSDBA
    file=exp_db.dmp log=imp_sct.log fromuser=scott
    _dev touser=scott ignore=y
    LRM-00112: multiple values not allowed for parameter 'userid'
    IMP-00022: failed to process parameters, type 'IMP HELP=Y' for help
    IMP-00000: Import terminated unsuccessfully
    Kindly leave the import syntax by use SYS user as SYSDBA.
    Thanks in advance,
    Orahar.

    Orahar wrote:
    Hi,
    As I need to use Sys user as SYSDBA, the syntax through an error which given below.
    Kindly come up with Correct syntax to use SYS user as SYSDBA while import the dump.
    c:\>imp userid=sys/sys@orcl AS SYSDBA
    file=exp_db.dmp log=imp_sct.log fromuser=scott
    _dev touser=scott ignore=y
    LRM-00112: multiple values not allowed for parameter 'userid'
    IMP-00022: failed to process parameters, type 'IMP HELP=Y' for help
    IMP-00000: Import terminated unsuccessfully
    Kindly leave the import syntax by use SYS user as SYSDBA.
    Thanks in advance,
    Orahar.From the Oracle 10g Database Utilities manual, chapter 19, covering original import and export:
    Invoking Export and Import As SYSDBA
    SYSDBA is used internally and has specialized functions; its behavior is not the same as for generalized users. Therefore, you should not typically need to invoke Export or Import as SYSDBA, except in the following situations:
    At the request of Oracle technical support
    When importing a transportable tablespace set

  • Length error occured in IMPORT statement

    Hello everyone,
    i hv one requirment in PO print(ME23N). in po print asset no nt display without changing other format.
    so that i first copy both smartform and driver program, in that i made certain changes such that i declare the patameter p_ebeln and i comment to data statement of p_ebeln & p_ebeln = nest-objky.
    then i join asset no (anek-anln1) with the help of inner join. then in smartform i gave condition that if bsart = 'ZCAP'
    wa_final-anln1 = gv_anln1.
    endif.
    i import gv_anln1 in smartform and exported in deriver program.
    both are synthetically currect but when i gave print preview dump is occured.
    length error occured in IMPORT statement
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_IMPORT_MISMATCH_ERROR', was
         not caught in
        procedure "%GLOBAL_INIT" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        During import the system discovered that the target object has
        a different length than the object to be imported.
    what i do?

    Hello,
    can u send me coding for that?
    program line is already created for that
    and their first coding is like that,
    if gv_bsart = 'ZCAP'.
    wa_final-matnr = space.
    endif.
    and in text they fetch matnr no.
    but as per requirement they want asset no when bsart = 'ZCAP'
    how that asset no will come.
    matnr comes there is bsart is other that ZCAP, but bsart = ZCAP they want asset no instead of matnr.

  • Javac(1.4.2) gives error in import statement

    Hi All,
    I am facing a surprising problem. I have 2 java class files. I write the import statement for second one in the first one. There is no package & these are in the same directory. I have compiled the second one. But when I try to compile the First one. Javac throws error at import statement like below :
    D:\Clubs\oct\6>javac -d . ManojTest.java
    ManojTest.java:1: '.' expected
    import SessionBean;
    ^
    1 error
    My Java Files are as below :
    import SessionBean;
    public class ManojTest
         public static void main(String args[])
    //ManojTest.java
    public class SessionBean
         public static void main(String args[])
    //SessionBean.java
    I have compiled SessionBean.java successfully but when I try to compile ManojTest.java I get error mentioned above.
    However this probelm comes when I use j2se 1.4.2.. but works in j2se 1.3.1..
    Another way could be I use package structure.
    But I can't do any of these, as I have to port my big project to j2se1.4.2.. from j2se1.3.1.. (Live project is running on Tomcat).
    Problems is similar in Unix & Windows both.
    Is this javac compiler issue or there is some setting which I can make.
    I have already included . (dot) in PATH & CLASSPATH environment varibales.
    Please help me out if there is any way around this, as i am stuck up in between
    thank you
    Manoj :confused:

    Use a package and then add that package in your classpathOr don't use a package, leave the file in the default (noname) package, and don't use the import statement. Java will find it in the default package without the import.
    Explicit import statements from the default package are no longer allowed

  • Length error occurred during in IMPORT statement

    Dear Friends,
    (length error occurred during in IMPORT statement),when im using the SUBMIT syntax..can i know what is the reason.
    Thanks
    Rajkumar.A

    Hello,
    I would like to know how did you solve the issue as i came across the same issue.
    Thanks,
    FBK

  • Length error occurred in IMPORT statement.

    Hi All,
               while exexuting a program i got dump saying that Length error occurred in IMPORT statement. through ST22 i came to know that both import and export structres are not same. Import structure is longer than the export structure.
             I tried in SDN but i coudnt find any solution. can you please suggest how to solve this.
    Thanks in advance,
    Sreekala.

    Hi,
    Maybe what you can do si....
    Program X
    data: v_var(20) type c.
    export v_var.
    Program Y
    data: v_var(20) type c,
             v_var2(50) type c.
    import v_var.
    v_var2 = v_var.
    Create a variable that is exactly the same with the exporting parameter, then just assign it to a local variable declared in the 2nd program.
    Hope this helps.
    Benedict

  • JSP import Statement importing a Class File giving ERROR

    Hey guys,
    There is a problem to which I dont know the reason,
    Consider the code below:
    <%@ import Converter, ConverterHome %>
    It gives me a Compile Time error of this type:
    '.' Required in import Converter ;
    but when i put these classes in a package suppose "converter"
    and the above import statement like this :
    <%@ import converter.Converter,converter.ConverterHome%>
    It gives me no error
    So whats the reason behind this? Cant I compile a JSP program by refrencing classes without in any package?
    please Reply
    Thanks in advance..

    So whats the reason behind this?
    Cant I compile a JSP program by refrencing classes without in any package?No, I do not beleive you can, is you are using Java 1.4. In 1.4, you can only reference classes in the Default Package (none) from other classes in the default package. If you are in a package, then you can not import from the default package. And this is for ALL java classes, not just JSP and Serlets. Since the JSP servlet would be part of a package (which depends on the server you are using) you will need to put your classes into packages to import them...

  • MAXL Import data statement error

    Can someone assist me in the maxl import data statement.
    In the import data statement "import database App.DB data from data_file "\\servername\\folder1\\folder1\\data.txt";
    The error I get is trying to specify the syntax for the path of the server. Does someone have an example of the import statement syntax that is referencing the data file from a server?
    Thanks

    Have you tried something like :-
    import database App.Db data from text data_file "\\\\servername\\sharename\\directory\\datafile.txt" using server rules_file "dataload" on error write to "dataerrors.err";
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Error on import statement.

    I got compiler error for an import statement which is: import MyClass;
    It said: '.' expected at the end of the statement. However, MyClass isn't any package. Also, I can compiler the same code with the import statement as above on other machine with no error. So, I'm thinking there might be some kind of settings for windows that I've done wrong.
    I have my path point to jdk\bin and my classpath point to current directory. I'm using win2k + jdk1.3.1
    Anyone has idea about this??
    Cheers,

    Didn't you ask this once before?
    Anyway, the statementimport Myclass; is malformed. You cannot explictly import a member of the default package, and you don't need to, they are already imported as are those classes defined in your package and those classes defined in java.lang.
    Chuck

  • Import Package statement - Error

    I have read a thread at Developer Forum on Package - import statement erroe and saw the advice to compile the package by using the command:
    javac -classpath %CLASSPATH%;[your path to the risk classes] <source files to compile>
    I have done that and I have also included the path on the PATH environment variable (Windows XT), but it still does not work.
    Why JBUILDER does not allow an import of an extrenal package?

    Post some simple code that demostrates what your problem is. Include the complete error message. I personally don't know anything about JBuilder, but there people on the forum that do.

  • Import statement giving error

    Hi All,
    I am writing a JSP page, and need to instantiate an object of a certain class within my package, in my JSP page.
    How do I do that? Do i use the <%import = "Myclass.class" %>
    I am using Sun Forte.. and the directory is myprojects/test/Classes/MyClass.java
    so how would the import statement look like?
    Thanks
    Kal.

    Kal,
    You would use the page directive with the import attribute. It looks like this: <%@page import="MyPackage.MyClass"%> or if your class is in the default package <%@page import="MyClass"%>. It is suggested that all classes used in JSP be packaged. (That is they include the package statement in thier source file and reside in a directory structure resembling the package name.)
    Cliff

  • Filename in import statement

    Hi srinivas bobbala,
    Thank you for your response.But I think my quesition was not clear.My ques... is for suppose there is one datafile for importing like.. "datafile_21" Here my intention is it takes file from datafile_21 only but it appears in import statement like datafile_21<<curmon>>.
    import database sample.sample data from data_file "c:\\ABC\datafile_21_AUG.txt" using server rules_file datafile on error abort;
    In this it takes datafile from datafile_21.But it appears like datafile_21_AUG in import statement.This AUG coming from batch file.
    Essmsh c:\\ABC\loadmxl.mxl %curmon%

    No it is not possible.
    I assume the data file "datafile_21" is first renamed to datafile_21_${CurrMth} in the batchscript.
    After that this data file *datafile_21_${CurrMth}* is pointed in the import statement.
    In the logs you will see this file as datafile_21_Aug.

  • 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;
    }

  • Import statement and directory structure

    First of all, sorry for such a long post, I believe part of it is because I am unsure of the concept of importing in Java. Secondly, Thanks to anyone who can ultimately enlighten me to the concept of import. I did ask this question before in the "erorr and error handling" forum, and the people who have helped me there did a great job. But, I believe I require a little more clarification and thus have decided to post here.
    Anyhow, my question..
    Could someone explain to me the concept of the import statement, or direct me to a webpage with sort of explanation for newbies? For some reason, I am having a hard time grasping the concept.
    As I understand it, the import statement in Java, is very similar to the namespace keyword in C. That is to say, import doesn't actually "import" any source code, the way that the #include statement does in C.
    So I suppose what my question is, say I have a java class file like below:
    //filename: sentence.java
    //located: c:\school\csc365
    package csc365;
    class sentence
    //some variables here..
    //some constructor here..
    //some methods here..
    And some sample program like the one below which implements the above..
    //filename: test.java
    //located: c:\school\csc365
    import csc365.*;
    import java.io.*;
    class test.java
    //creates some sentence object
    //uses the object's methods
    //some other things.
    As I understand it, the test.java file should not compile because the csc365 package is not in the correct directory. (assuming of course, the classpath is like c:\school\csc365;c:\school )
    But, ... where then should the sentence.java be located? In a subdirectory of c:\school called csc365 (i.e c:\school\csc365\) ?
    And thus that would mean the test.java file could be located anywhere on the hard drive?
    I suppose, I just need a little clarification on the correlation between a package's "name" (i.e package csc365; ) and its corresponding directory's name, and also how the javac compiler searches the classpath for java classes.
    ..So, theoretically if I were to set the classpath to look in every conceivable directory(provided the directory names were all unique) of the harddrive, then I could compile a test.java anywhere?
    As a note: I have been able to get the test.java file to compile, by leaving out the import statement in the test.java file, and also leaving out the package statement for the sentence class, but I assume this is because the files are defaulted to the same package?

    Hi Mary,
    No, import isn't analogous to C++ namespace - Java package is closer to the namespace mark.
    import is just a convenience for the programmer. You can go your whole Java career without ever writing an import statement if you wish. All that means is that you'll have to type out the fully-resolved class name every time you want to use a class that's in a package other than java.lang. Example:
    // NOTE: No import statements
    public class Family
       // NOTE: fully-resolved class names
       private java.util.List children = new java.util.ArrayList();
    }If you use the import statement, you can save yourself from typing:
    import java.util.ArrayList;
    import java.util.List;
    public class Family
       // NOTE: fully-resolved class names
       private List children = new ArrayList();
    }import isn't the same as class loader. It does not bring in any source code at all.
    import comes into play when you're compiling or running your code. Java will check to make sure that any "shorthand" class names you give it live in one of the packages you've imported. If it can't find a matching fully-resolved class name, it'll give you a message like "Symbol not found" or something like that.
    I arrange Java source in a directory structure that matches the package structure in the .class files.
    If I've got a Java source file like this:
    package foo.bar;
    public class Baz
       public static void main(String [] args)
            Baz baz = new Baz();
            System.out.println(baz);
       public String toString()
           return "I am a Baz";
    }I'll store it in a directory structure like this:
    root
    +---classes
    +---src
          +---foo
               +---bar
                    +---Baz.javaWhen I compile, I go to root and compile by typing this:
    javac -d classes foo/bar/*.javaI can run the code from root by typing:
    java -classpath classes foo.bar.BazI hope this wasn't patronizing or beneath you. I don't mean to be insulting. - MOD

  • IMPORT statement in OO

    Hi All,
    Can some one give me a code sample of exact syntax for IMPORT statement.
    I tried the following way
    IMPORT gt_dispute_data FROM MEMORY ID co_memory_id.
    but giving an error.
    shylesh

    Hello,
    Please declare gt_dispute_data and try the following:
    IMPORT gt_dispute_data FROM MEMORY ID 'CO_MEMORY_ID'.
    Thanks,
    Venu

Maybe you are looking for