Problem importing packages...

hello!
I am learning Java for a while. I have a very strange problem with packages. The problem is the next one:
When I import the complete package like this:
import ThePackage.*
I got the following the next errors:
main.java:8: cannot resolve symbol
symbol : constructor Class1 ()
location: class Class1
Class1 C1=new Class1();
^
main.java:9: cannot resolve symbol
symbol : constructor Class2 ()
location: class Class2
Class2 C2=new Class2();
^
2 errors
In order to use this packages, I have to use it this way:
import ThePackage.Class1;
import ThePackage.Class2;
My question is if I have to import every class I am going to use per package? Or why I can�t import using asterisks ('*')
My other problem is when I use class within the same package, I have to import them too. I have to put the "import ThePackage.*;" in every class within it.
Thanks,
Santiago (A Java Newbie)

You can try to compile with javac -verbose and see what happens. It's because the class you want to compile is not in a package, and you want to import a whole package. But how would the compiler know if you want to use the Class1 and Class2 that is not in a package or those that are in a package?! First it checks if there are those classes which are not in a package. It doesn't find them, but it finds the java source code, so it attempts to use that (which will fail becuase you have package declaration in them). So sudha_mp is right about that you have to remove the source code, then you should be able to compile your code (or the class you want to compile has to be in a package).

Similar Messages

  • Visual age problem - importing packages

    Hello,
    I have created a Java client NT application on Visual Age which interacts with Oracle database thru JDBC driver.
    when i give
    import oracle.jdbc.driver.*;
    the visual age editor is not able to find the above package, whereas when i export the same application and execute it on DOS environment there are no problems.
    I want to know the best way to import packages in Visual Age because when I added the required packages to my application, "no suitable driver" error occurred.
    Not as familiar with Visual Age. Any help would be appreciated. Thanks :-)
    Raj

    Thanks! Got it fixed.
    Giving the duke dollar to myself ;)
    raj

  • Problem importing packages via ICE??

    Hello,
    I am running Portal 6.0 on Windows Server. For one of the business package that is to be implemented in my Portal, i have to deploy two files as a pre-requisite that are associated with SAP Note 660777(https://service.sap.com/sap/support/notes/660777). I have imported the "com.sap.pct.crm.kmconfig40.par" file but having problems deploying "fullupdate_completeBP602.zip". I must admit that i haven't got much idea about importing packages via ICE as i have never used it before.
    I tried to import it via, Portal->System Administration->System Configuration. In there, Actions->Import. When i point to the "fullupdate_completeBP602.zip" file and say Preview, i get a error message saying "Enter a valid configuration archive name". Isn't this the right way to import this package? Please guide. Thanks.
    Regards,

    I suggest you also ask in the KM forum about ICE. There is also some information in the SAP help pages about ICE. For example an overview of it can be found
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/63/42aa17425c514f85ad5ecd45988509/frameset.htm">here</a>
    Cheers

  • Problem importing package

    hi,
    i need to import my own package into my project i am building using Jdev11.1.1.0.1 on windows....i tried by File-->Import-->java classes-->package....it is showing the package in left side under application navigator but it is not able to find the classes in package.....i also tried by inserting pkg in Libraries and Classpath option in project properties.......what should be the value of JDEV_USER_HOME....please help

    Hi,
    Did you try adding the jar file contains your packages to the Libraries and Classpath of your Project Properties?
    -Arun

  • Argument Order Reversed Importing Package into OWB

    I'm having a problem importing Packages into OWB. It recognizes the Functions contained in the Package, however the order of the arguments for each Function are reversed after I complete the import into OWB. This causes execution of the mapping to fail... Additionally, after importing into OWB, OWB doesn't seem to recognize any optional parameters or default values in the signature of the Function. I must be doing something wrong... Can anyone help...
    Thanks
    Alan

    Hi
    Standard approach to be followed for any object modification
    1. If you have created your package from OWB and deployed it into your DB, always do it that way i.e. Design center -->DB . Do not make any modifications on DB level and import in back to your Design center. OWB manages Ids for all objects on the repository and this will confuse it. That is why you see two versions of the same package . Any modifications should be done on Design center level and then do a replace on the package from control center
    2. If an object (package or procedure) is created on DB directly and is imported into design center, follow the same norm everytime you make any changes to that object. The status of that object will appear as "New" or "Not deployed" on control center but that is fine because OWB has no ID on its repository to maintain this information.
    3. If you need to rename any object already deployed from OWB, always drop it first, then rename it and then deploy it. That way OWB will maintain the name and ID on its end and not get confused.
    4. For your case, you can drop the older version of the package from OWB, delete the one imported from Database into OWB, make the changes on OWB level (adding parameter etc) and then redeploy the same package as replace from control center.
    Hope these tips help
    birdy

  • Problem in importing package

    i am new to java and facing problems in importing package which are self made.
    secondly does JDK 1.1.3 can support swing

    Hi,
    I had some problems myself. I will add few lines, maybe it helps:
    OK, let's assume that you work in a directory. In this case, set classpath to this hierarchy as well as to "." ('this' hierarchy - like in DOS).
    Now, assume that you want to use packages MyPack1 and MyPack2. The source files of classes belonging to MyPack1 must:
    - start with command
    package MyPack1;
    - be located all in the directory MyPack1
    (and the same for MyPack2, of course)
    If you want to use MyPack1 within MyPack2, you have to include:
    import MyPack1.*;
    even though MyPack1 is, in fact, located on path: ../MyPack1/*
    (trust the classpath is important here)

  • Problem importing a package

    Hello all! I'm relatively new to Java programming, but an experienced programmer in other languages, which is why this problem is so disturbing.
    I'm running through an exercise in the Thinking in Java book that introduces you to packages and importing packages. The code runs fine if I explicitly import the package by name, but not if I use the "*" wildcard.
    I'm running on Windows NT, and my CLASSPATH variable is:
    CLASSPATH=.;D:\Java\Books
    Here are the programs that work:
    //P.java
    package tools;
    public class P {
      public static void rint(String s) {
        System.out.print(s);
      public static void rint(int i) {
           System.out.print(i);
      public static void rintln(String s) {
        System.out.println(s);
      public static void rintln(int i) {
           System.out.println(i);
    //PrintTest.java
    import tools.*;
    public class PrintTest {
      public static void main(String[] args) {
           P.rint("Test String print - No line feed...");
           P.rintln("---");
           P.rint(1);
           P.rintln("");  //Force line feed.
           P.rintln(2);
           P.rintln("---");
    }Both of these files reside in the D:\test directory, and I compile them from that directory.
    To compile the P.java program, I use the following statement: javac -d . P.java
    The P.class file ends up in the D:\test\tools directory, which is fine. When I try to compile the PrintTest.java file, I get an error for each reference to the P class as follows:
    PrintTest.java:6: cannot resolve symbol
    symbol: method rint (java.lang.String)
    location: class P
    P.rint("Test string print - No line feed");
    However, if I change the first line in the PrintTest.java program to:
    import tools.P;
    Then it works.
    Why is the import working with an explicit call to the class, but not with the "*" wildcard? Any help would be greatly appreciated. I've been through all of the forums, the documentation, etc. and can't find a definitive answer.
    Thanks in advance,
    Tim

    Here is the error that I'm getting when I compile the PrintTest.java file.
    PrintTest.java:6: cannot resolve symbol
    symbol: method rint (java.lang.String)
    location: class P
    P.rint("Test string print - No line feed");
    Actually, I get one error for each reference to the P class in the PrintTest code, so there are 6 errors total.
    The P.class file is in the \tools directory under the directory where the PrintTest.java file exists, so the "import tools.P;" command works and the file runs OK, but when I switch to the "import tools.*" command, I get these errors. I'm just confused as to why it works when it is explicitly imported, but not when it is wild-carded.
    Thanks for the help! I'll keep trying...

  • Import package problems

    hi:
    if my program need to import package A which store in :
    C:\Documents and Settings\sharon\My Documents\project
    and my java file also store in the same folder, but i always got this error:
    C:\Documents and Settings\sharon\My Documents\project\test.java:36: package A does not exist
    import A;
    can anyone please tell me what happen? i m a newbie to java, pls help.

    Assuming you have the following: C:\project\A\Class1.class
    C:\project\A\Class5.class
    C:\project\test.javaand assuming all the Class1.java-Class5.java files start with package A; and assuming test.java starts with import A.Class1; And assuming javac.exe is in a directory that's on your path (NOT classpath), then if you do, in a DOS promptjavac -classpath . test.java
    or
    javac -classpath C:\project test.java it will work.
    You say you're using an IDE. Somewhere in that IDE's preferences/options will be a place to set the classpath. It must include . (a dot, meaning the current directory) OR the full path up to and including ...\project. (Dot may actually not work, since the IDE might not have the same notion of "current directory" as you would in a DOS prompt. There may also be a setting for "project root" or something. It really depends on the IDE.)
    Side note: Convention in Java is for package names to be all lowercase, and for class names to start with uppercase.

  • Error while running import package

    Hi,
    Transformation file was validated successfully. But after running import package i am having following error on MS-BPC-7.0.
    Invalid character in the given encoding. Line 1, position 1.
    When i try validate and process trans file i am having the following error message. But same data file and same trans file was working till couple of days ago. After that whatever changes i have made to file, i did revert them to have it working like beofre.
    Warning: Some records were rejected.
    Rejected records reference either calculated members or invalid members.
    Actually rejected record is only, one, but even other data was not loaded.
    Thanks in advance for sharing your ideas or similar experiences.
    Thanks,
    KK

    Hi,
    There is definitely some problem with one of the records there. Do you have header? What is the delimiter? Do you have the same delimiter in the transformation file? You need to take a look at all the possibilities.
    Hope this helps.

  • Import package from one project into another

    Hello everyone,
    I have some projects.
    An enterprise and war project created in netbeans.
    I would like to use some files from one project to another. when I import
    the package I get the error-
    'package x does not exist'
    I have added the package to the project but I still get the error.
    I have also added the project to import to my glasspath but still.
    E.g.
    set classpath
    .;c:\enterpriseA;
    My next idea is to create a war project into my enterprise project and copy the files
    from the war project into it in order to use it. But I'm sure there is a better way.
    THanking you in advance.
    eve
    Edited by: evepokua on Nov 22, 2009 1:44 PM

    One mistake I keep making is that I don't add the package to the
    Dependencies of the plugin I'm writing. You have to go to plugin.xml,
    and add the package you depend on to the Dependencies section. Maybe you
    didn't do this?
    Michael
    nasti wrote:
    > Hello everybody!
    > I am new user of osgi and eclipse. I tried to do some of Oscar examples
    > but I had some problems. Namely, the problem in import of package from
    > one project into another in Eclipse.
    > I add first project to the Build Path of the second one.
    > I add to the first project manifest line: Export-Package example2.service.
    > I add to the second project manifest line: Import-Package example2.service.
    > But when I tried to execute these bundles the
    > java.lang.NoClassDefFoundError was occurred. May be you will help me
    > with this problem.
    > Thanks....
    >
    >

  • Import package error in SAP BPC 4.1

    Hi,
    Can anyone please assist.
    I tried running the import package several times on bpc ver 4.1 without aby success. I even tripple checked Users and Security and it validated successfully but the package still crashes in the middle of processing.
    The error message read:
    [Package Result = Error]
    Package:                    Import
    Appset:                       CQS
    Application:                 FIXEDCOST
    Request Time:             2009-06-23 13:44:42
    Start   Time:                2009-06-23 13:44:42
    End     Time:               2009-06-23 13:48:51
    Total   Time:                00:04:09
    TOTAL STEPS  3
    1. Assign initial parameters:        completed  in 0 sec.
    2. Convert data:                     completed  in 7 sec.
    3. Load and process:                 Failed  in 241 sec.
    [Selection]
    FILE= DATAMANAGER\DATAFILES\CQSSA\2009\Fixed Costs Testnew.txt
    TRANSFORMATION= DATAMANAGER\TRANSFORMATIONFILES\CQSSA\FC_Trans_ZA_ACT.xls
    CLEARDATA= Yes
    RUNLOGIC= No
    [Member Selection]
    CATEGORY: ACTUAL
    ENTITY: SQSSA
    TIME: 2009.MAY
    [The list of conversion file in each transformation file]
    Transformation file: DATAMANAGER\TRANSFORMATIONFILES\CQSSA\FC_Trans_ZA_ACT.xls
         - Conversion file : ConversionFiles\CQSSA\FC_CONV_ZA.XLS!FCOSTACCOUNT
         - Conversion file : ConversionFiles\CQSSA\FC_CONV_ZA.XLS!FCOSTCENTRE
         - Conversion file : ConversionFiles\CQSSA\FC_CONV_ZA.XLS!MARKETS
    [Messages]
    FIXEDCOST
    Failed
    Submit Count  : 15278 (Record count in source file  : 20056)
    Accept Count : 0
    Reject Count : 15278
    You do not have WRITE authority.::ACTUAL
    Where can I enable WRITE authority?

    Hi Vishal Mahawadhi,
    Thank you for replying. I've tried all your suggestions before I even logged the query. I even went to analysis manager, gave access to the application and processed the cube but still that didn't help.
    But I noticed that I only have read access when I look at the settings on the roles in analysis manager. The problem is that I can't change the settings to read/write. Version 4.1 is a mess.

  • Import package needs to show extra info in the log.

    Hi,
    I have a problem regarding an import package.
    I am trying to edit in a way, that in the package log I get details about for which entity, time and category the import has run. Is this possible?
    Regards, Tim Vierhout

    Yes I know about this, but customer is coming from V4, where they had a log for which ENTITY/CATEGORY/Time period the import has run. And also when import ran without errors.
    I have already created a workaround with adding a logic task to the import containing a logic which writes no records but does return a member selection log, only I was wondering if there was a easier way to get the same result.
    -Tim

  • Import package does not exist  java

    Hi ,
    i try to compile as following
    javac -cp "myapplication.jar:." modelapp.java
    my batch file as follwong
    set PATH=C:\Program Files\Java\jdk1.6.0_32\bin;C:\Users\DELL\Downloads\myfolder;C:\Users\DELL\Downloads\myfolder\edu;
    set CLASSPATH=C:\Program Files\Java\jdk1.6.0_32\bin;C:\Users\DELL\Downloads\myfolder;C:\Users\DELL\Downloads\myfolder\edu;
    cd C:\Users\DELL\Downloads\Stanfordnew
    but the error appear as following
    package edu.appli.machr. doesn't exist
    import package edu.appli.machr. doesn't exist
    i have already add the package to classpath
    please help me in how can i solve this problem.
    tHANKS

    javac -cp "myapplication.jar:." modelapp.java You compile on Linux and run on Windows or something? That is the Linux classpath, on Windows the list separator is ; If you do everything on Windows I'm a bit amazed it worked.
    set CLASSPATH=C:\Program Files\Java\jdk1.6.0_32\bin;C:\Users\DELL\Downloads\myfolder;C:\Users\DELL\Downloads\myfolder\edu;You made a copy/paste mistake, the classpath contains the path.
    please help me in how can i solve this problem.Research what the classpath actually is. Google can easily provide you plenty of articles describing it.

  • Import package Out of Memory.

    HI,all
    I'm having a problem importing a package from one enviroment to another, it gives me Out Of Memory.
    It's a package the hasn't been update in more then a year of executions.
    I've already tried to increase the Max heap size in the odiparam.
    The ODI logs have never been purge can it be the reason for this?
    Is there a way do purge the log of a specific package or scenario?
    Thanks,
    André

    Yes excessive logs could cause this issue. You should always, in my opinion, have a log management process in place otherwise you could be storing up much worse issues further down the line. You can manage session logs from within the Operator console or you can create a utility package which automates the log management using calls to the ODI Log management Tools

  • Error running import package: it removes the journals

    Hello experts,
    I have a problem when I run the import package using the "Replace&Clear "data option. Apart from clearing the INPUT data, it clears the journals. When the package ends running, the previous data is correctly cleared, the new data correctly introduced, but the journals that were posted before running the package are not posted any more. I would like to know where could I change this option so that it work's properly, not affecting journals. 
    Thank you,
    Álvaro

    Journal are posted but the main problem is that you clear all the values for all category, entity, time (including values for data source journal).
    That's means into database were inserted records with oposite values for all configuration (category.ebtity, time from that import file).
    You have two solution:
    1. Use work status to avoid any DM packages run after Journal posted.
    2. Modify the Import packages to avoid clear of the values for Journal (see the clear package).
    Regards
    Sorin Radulescu

Maybe you are looking for

  • Error message opening .jpg saved for Web in Photoshop CS3

    After I save a file for "Web & Devices," when I open it, it returns this message, "This file contains file info data which cannot be read and has been ignored." Will this cause any problem with the file once I place it in the website I'm building? I'

  • Issue with Disabling one of the menu item in Forms6i

    Hi, I have a requirement where I need to disable the IR/PO Information (menu item) created using Form Personalization in Sales Order form. If the Warehouse is other than 'FIM' it should be disabled for that particular line. Please let me know if anyb

  • How to implement a singleton class across apps in a managed server}

    Hi , I tried implementing a singleton class , and then invoking the same in a filter class. Both are then deployed as a web app (war file) in a managed server. I created a similar app , deployed the same as another app in the same managed server . I

  • Access connection​s 5.50 and EAP TLS with Computer certificat​e

    Hello, I'm trying to connect to a Wifi using Computer certificate to authenticate and it works perfectly fine with windows Wireless Zero Config however with Thinkvantage Access Connection I always get an authentication error. I'm using a R61 with a T

  • SAP ERP or ECC installation

    Hi i would like to install SAP ERP 6 Could you help me which files i need to download from market place? I have dowloaded SAP ERP 6.0 SR3 Installation Export 1 of 6 to 6 of 6 ; ERP 6.0 SR3 Upgrade Master Windows Server on x64 64bit ; SAP ERP 6.0 SR3