Importing entire user defined packages......

When I try to import all the classes from a package using the * symbol
(as in: import shapes.*;)
I get the following error:
bad class file.
class file contains wrong class: shapes.RightTriangle
Please remove or make sure it appears in the correct subdirectory of the classpath.
However if I import the classes individually,
import shapes.RightTriangle;
import shapes.Circle;
import shapes.MyRectangle;
etc......
It works fine. I haven't a clue why this is happening, can anybody help me?

The shapes package contains five .class files(no .java files):
Circle.class
RightTriangle.class
MyRectangle.class
Figure.class (abstract class for above base classes)
DrawFigure.class (interace used for drawing the different)
It is in the same directory as my main program .java and .class files.
I currently import all these .class files individually as in
import shapes.Figure;
import shapes.DrawFigure;
import shapes.Circle;
import shapes.RightTriangle;
import shapes.MyRectangle;
The next few lines of code are:
public class TestFigure1 extends Applet
MyRectangle rect1;
RightTriangle tri1;
Circle circ1;
public static void main(String argv[])
This compiles and runs without any problems.
However, I know it should be possible to import the entire shapes package in one go, so I replace the individual import statements with:
import shapes.*;
Now the compiler returns the error message I described above.
Any ideas?
P.S. How would I type the fully qualified path for the shapes directory?
It is located at C:\myjava\Figures\shapes
For example:
import myjava.Figures.shapes.Circle;
Is this statement correctly written?
When I try

Similar Messages

  • How to use user-defined packages in JAX-RPC web service

    I am trying to use Object of my class located in my package in jax-rpc webservice,the code is
    package supercomputer;
    import Hello.*;
    public class SuperImpl implements SuperIF
    public String sendParam(String data)
    Temp ob=new Temp();
    int i=ob.get1(10000);
    return data+"returned by supercomputer";
    Temp is located in Hello package,I have jar the Hello package as Hello.jar and has set its classpath in targets.xml of Ant tool.
    The code compiles well and service is deployed successfully,but when i try to call the service from the client its gives me following error.
    [echo] Running the supercomputer.SuperClient program....
    [java] java.rmi.ServerException: Missing port information
    [java] at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingSender.java:357)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
    [java] at supercomputer.SuperIF_Stub.sendParam(SuperIF_Stub.java:60)
    [java] at supercomputer.SuperClient.main(Unknown Source)
    I dont know if it deploys why it gives error on client side.
    Please tell how to use user-defined packages and class in jax-rpc service code ,i am not talking about passing user-defined parameters i am just talking about making objects of user defined classes in jax-rpc service.I think there is some problem in classpath.
    Please guide me in doing that.
    Thanks,
    Farrukh

    Farrukh,
    I don't know if your error is about a missing class from your custom package, ... what track did you followed to say that?
    To use your package in the implementation of you web service, you should only follow the rules of making a web application: put your package jar in your \lib directory inside WEB-INF/ or your package classes unjared in classes (also in WEB-INF/).
    As I already said, I have doubts that your error should be originated from a missing class from your package, but:
    -try to see the logs (errors?) when you deploy your web service that could give a hint about the problem.
    -try to see if you can access your endpoint through your browser to see if there is a online status
    -display your config/WSDL file, and the steps you did to build your web service.
    regards,
    Pedro Salazar.

  • How to make an applet load user-defined package?

    How to have an applet load user-defined package?
    I have packages in their own directories, and the applet compiles and links with them, by use of CLASSPATH env variable. But when it comes time to run, it ignores that and does not know where the classes (in the packages) are.
    If I don't use packages and put all code in one directory, runs fine. If I use an application, I can link with and load my packages.
    I know applets can't use things like CLASSPATH for security reasons, but still, they should be able to be compiled out of several packages, why do I have to put all code together??

    OK, for reference for future newbies, here's the answer:
    use CODEBASE attribute in your html file (if on Windows server, don't use drive letter but relative path to .html file, Unix style, and put all your .class files beneath that, for example, in your .html file
    <applet
    CODEBASE="..\class
    and then have package bar Bar.class file, in ..\class\bar

  • Creating User Defined Package Groups

    Hi everyone!
    I'm currently exploring/experimenting with strategies to stabilize parts of the Arch system on machines which I plan do update less frequently (I am aware of the risks and the potential difficulties associated with infrequent updates; that's why this is an experiment). It seems to me that Package Groups would be an asset which could be leveraged for a few different strategies. However, I cannot find any documentation on creating user defined package groups. Is there a way to do this? Any documentation anyone could point me to would be awesome. Thanks!

    You can compile the package yourself or change just the metadata. I think xyne had a tool for that, if only I could remember the name ...
    Edit: It's repkg https://bbs.archlinux.org/viewtopic.php?id=158970
    Edit 2: What do you need package groups for anyway? You should update the whole system rather than individual packages / groups of packages.
    Last edited by karol (2014-01-30 20:25:04)

  • Java User-defined packages problem!

    Hi everyone,
    I am new to java programming.I am trying to do a small program to see how the user-defined pckages work.I wrote 2 small programs one is Balance.java and TestBalance.java.
    The code for Balance.java is as follows..
    package MyPack;
    public class Balance{
            String name;
            double bal;
            public Balance(String n, double b){
                    name = n;
                    bal = b;
            public void show(){
                    if(bal < 0)
                         System.out.print("--->");
                      System.out.println(name + ": $" + bal);
          }The code for TestBalance.java is as follows..
    import MyPack.*;
    class TestBalance{
            public static void main(String args[]){
                    Balance test = new Balance("Leela",99.88);
                    test.show();
      }These r both in the same directory....I am able to compile Balance.java...but when I try to compile TestBalance.java I am getting the following errors
    TestBalance.java:1: package MyPack does not exist
    import MyPack.Balance;
                  ^
    TestBalance.java:5: cannot resolve symbol
    symbol  : class Balance
    location: class TestBalance
                    Balance test = new Balance("Leela",99.88);
                    ^
    TestBalance.java:5: cannot resolve symbol
    symbol  : class Balance
    location: class TestBalance
                    Balance test = new Balance("Leela",99.88);
                                       ^
    3 errorsI am using j2se1.4 version ....my path is set to bin folder..
    Could someone plz tell me what is the mistake...it would be very helpful for me if someone could plz tell me what the problem is...
    Thanx in advance.

    99% going to work
    i have noticed some of the few thing
    trying to help
    u told that ur both the classes r in same directory right
    ok
    now ur first class has this as first line
    package mypack;//till here its ok only "mypack" should be small case
    now put this same line also in the other class as firat line
    and remove that import statement since both r in same package so no
    need to import it ok
    here's the code
    package mypack;class TestBalance{        public static void main(String args[]){                Balance test = new Balance("Leela",99.88);                test.show();           } }
    now compile it this way
    create a folder call mypack and put this both the classes in that folder
    say its c:\mypack\ur classes
    now in dos prompt
    type this
    set classpath=%classpath%;C:\mypack \
    now u compile ur first class and then second
    Surely this going to work if not tell me the errors u r getting

  • SQL Developer 3.1 EA3 unable to import / export user defined reports

    Hi gentlemen,
    Name says it all. Import / Export do not appear anymore neither in dropdown menu for User Defined Reports, nor export for other reports (DD reports or shared reports).
    Best Regards,
    Olivier.

    Those are now Save As / Open...
    Hope that helps,
    K.

  • Importing User defined package problem.

    Hi All,
    I have made to package, "forum" and "utility". DBhandler java file is in "utility" package and Forumhandler is in "forum" package.
    I want to import DBhandler classes from "utility" package into "forum" package for this i write
    "import utility.*" in forum package's Forumhandler java file. But it is giving error.
    The error is -
    forum/ForumHandler.java:13: cannot resolve symbol
    symbol : class DBHandler
    location: class forum.ForumHandler
    DBHandler dbhand = new DBHandler();

    forum/ForumHandler.java:13: cannot resolve symbol
    symbol : class DBHandler
    location: class forum.ForumHandler
    DBHandler dbhand = new DBHandler();
    Do you have your visibility right?
    The class DBHandler should be declared public.
    P.s. it's a bad practice to use wildcards for imports if you just want to import a few classes, use
    import my.company.product.utility.DBHandler;instead (or something similar).

  • Importing user defined package in JDEV

    Hi,
    new to the JDEV9i tool. i have a project arranged in packages and am tryin to import this to the jdev9i. i successfully created the workspace and project and added all the packages. I can also view the package tree and package list but when i run my project the files in one directory import the files from the package structure.
    do i have to change Project properties?
    C:\jdev9i\jdev\mywork\Workspace1\Project1\websphinx\workbench\WebGraph.java
    Error(26,14): cannot access class graph.Graph; file graph\Graph.class not found

    It sounds like the Class path is not set up properly. You can configure this manually from the Project Settings dialog (Project > Project Settings). Alternatively, if you import all the packages from the top level, the path should be set for you automatically. For example, if you have your work in a directory structure like this:
    d:\mywork
    d:\mywork\toppackage
    Class1.java
    d:\mywork\toppackage\subpackage1
    Class2.java
    Class3.java
    d:\mywork\toppackage\subpackage2
    Class4.java
    Class5.java
    You can create a new project from existing source by creating a Workspace, then selecting File > New. In the Projects category there is an item called Project from Existing Source. Launch this wizard, and select the top level package from the directory listing (d:\mywork\toppackage in the example above). You then get the option to recurse through subdirectories, picking up all the classes along the way, and the paths will be set automatically. Note that you can use the Categories View button in the Navigator to view the files by package name.
    I hope this helps!
    -- Brian (JDev Team)
    Hi,
    new to the JDEV9i tool. i have a project arranged in packages and am tryin to import this to the jdev9i. i successfully created the workspace and project and added all the packages. I can also view the package tree and package list but when i run my project the files in one directory import the files from the package structure.
    do i have to change Project properties?
    C:\jdev9i\jdev\mywork\Workspace1\Project1\websphinx\workbench\WebGraph.java
    Error(26,14): cannot access class graph.Graph; file graph\Graph.class not found

  • How to use classes from different user defined Packages

    well i made 2 packages... one containing employee class and realted matter and other contaning bankaccounts and bank related work... now how can i use them in an another.. i know about the import statement but still couldn't make it work.... now suppose iam makin a obejct of employee class and passing in name and salary and all in the constructor... now i want that when i create the bankaccount class then the name of the employee should be passed to the bankaccount class so that it can assigen a account no. .. now how do i do this as when i create a object of employee class its made at runtime.. and if i create a object of bankaccount.. how wil it take that name as before goin to bank account i should already have a list of emplyees and then this list should be worked upon by the backaccount class to assign the accountno.s
    Hope my question was clear... would appriciate a explanation and guidance!!!

    Thank you so much ... i was able to solve the problem... i passed the object in the constructor of the accounts class and it all worked out the way i wanned... thank you so much... it wasn't that difficult but the idea was just not clicking...this place is wonderful... everyone rocks!!! and so greatful about all the help.. please keep up the good work and even i will try to contribute as much as possible!!

  • How to make user defined packages visible in Web Applications

    Hello,
    I am not new to JSP and I develop a web based geographical information system. I use MapViewer Application Server (Oracle) as run time environment. I do not encounter any problems in running JSP files. However, I have my own package under WEB-INF/classes/tr/com/bizyaptik/cgs and
    when importing a Class in my JSP file, the web server says:
    500 Internal Server Error
    OracleJSP: oracle.jsp.provider.JspCompileException:
    Errors compiling:C:\mapviewer1012_qs\mv1012qs\oc4j\j2ee\home\application-deployments\mapviewer\web\persistence\_pages\_cgsworkspace\_cgsproject\_public__html\_multiplesp.java
    Line # Error
    7
    package tr.com.bizyaptik.cgs.beans does not exist import tr.com.bizyaptik.cgs.beans.ContainerBean;
    10
    package tr.com.bizyaptik.cgs does not exist import tr.com.bizyaptik.cgs.PathManager;
    11
    package tr.com.bizyaptik.cgs.util does not exist import tr.com.bizyaptik.cgs.util.NetworkProperties;
    83
    [jsp src:line #:44]
    cannot resolve symbol symbol : class ContainerBean location: class cgsworkspace.cgsproject._public__html._multiplesp ContainerBean cb = new ContainerBean();
    83
    [jsp src:line #:44]
    cannot resolve symbol symbol : class ContainerBean location: class cgsworkspace.cgsproject._public__html._multiplesp ContainerBean cb = new ContainerBean();
    92
    [jsp src:line #:53]
    cannot resolve symbol symbol : class PathManager location: class cgsworkspace.cgsproject._public__html._multiplesp PathManager pm = new PathManager();
    92
    [jsp src:line #:53]
    cannot resolve symbol symbol : class PathManager location: class cgsworkspace.cgsproject._public__html._multiplesp PathManager pm = new PathManager();
    93
    [jsp src:line #:54]
    cannot resolve symbol symbol : class NetworkProperties location: class cgsworkspace.cgsproject._public__html._multiplesp NetworkProperties np = new NetworkProperties();
    93
    [jsp src:line #:54]
    cannot resolve symbol symbol : class NetworkProperties location: class cgsworkspace.cgsproject._public__html._multiplesp NetworkProperties np = new NetworkProperties();
    I use JDeveloper editor, worked hard to find the neccessary configuration but I failed. I also inserted ...... WEB-INF/classes into my classath but it didn't work.
    So, could anybody tell me the main concept of introducing packages and class files to a web server ?

    Farrukh,
    I don't know if your error is about a missing class from your custom package, ... what track did you followed to say that?
    To use your package in the implementation of you web service, you should only follow the rules of making a web application: put your package jar in your \lib directory inside WEB-INF/ or your package classes unjared in classes (also in WEB-INF/).
    As I already said, I have doubts that your error should be originated from a missing class from your package, but:
    -try to see the logs (errors?) when you deploy your web service that could give a hint about the problem.
    -try to see if you can access your endpoint through your browser to see if there is a online status
    -display your config/WSDL file, and the steps you did to build your web service.
    regards,
    Pedro Salazar.

  • User defined packages in TOMCAT HELP PLEASE!!!!

    Hello all,
    I am have created a package (foo).
    I then tried to import it into a jsp but TOMCAT say the package foo
    doesn't exist. I have stored the class file for the foo package in the same root directory with the jsp file. I have I stored the class file in the wrong place.
    <%@ page import="java.util.*,foo.*"%>
    <%!
    ResourceBundle bundle = null;
    public void jspInit()
    bundle = ResourceBundle.getBundle("forms");
    %>
    <jsp:useBean id="formHandler" class="foo.FormBean" scope="request">
    <jsp:setProperty name="formHandler" property="*" />
    </jsp:useBean>
    <%
    if (formHandler.validate())
    %>
    <jsp:forward page="<%=bundle.getString(\"process.success\")%>/">
    <%
    }else{
    %>
    <jsp:forward page="<%=bundle.getString(\"process.retry\")"%>/>
    <%
    %>
    can anyone help PLEASE!!!!!!!!!!!!
    Rohan

    you should read the docs provided with tomcat showing where to put your classes!
    WEB-INF/classes !

  • Accessing user-defined package

    I have two packages 'A' and 'B' at same directory level.
    How can I access the methods/files in one package from another package.
    i.e., I want to access file_A.put() in (package 'A') from file_B (package 'B').
    Is it possible to do so?
    If yes, then how can I do this?

    Check Using Package Members section of the Learning the Java Language tutorial.

  • User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_f

    Hi Expert,
    While running the Order Import i am getting the error please help us :
    Order Import Concurrent Program
    Concurrent Program Parameters
    Validate Only: N
    Order Source:
    Order Ref:
    Sold To Org Id:
    Sold To Org:
    Change Sequence:
    Performance Parameter: Y
    Trim Blanks: N
    Operation:
    Number of Instances: 0
    Debug Level: 0
    Request Id: 4471
    Org Id: 2453
    Failed to perform Action Request BOOK_ORDER
    Failed to perform Action Request BOOK_ORDER
    No. of orders found: 1
    No. of orders imported: 0
    No. of orders failed: 1
    Source/Order/Seq/Line Message
    10/1046001534//2 ATP Process resulted in no data
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_tbl
    10/1046001534//2 User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Load_Results_from_rec
    End of Order Import Concurrent Program
    Regards,
    Suraj

    And also check
    Order Import error : User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Undemand,User-Defined Exception in Package OE_SCHEDULE_UTIL Procedure Action_Reschedule [ID 737031.1]

  • Importing user defined triggers

    Hi,
    I need to import multiple user-defined triggers from one DB schema to another DB. Is this possible in 11G? Can someone help me out.
    Thanks,
    Sunita

    If you need to only export and import the triggers, then you have to generate the script for all the triggers(manually or using the DBMS_METADATA.GET_DDL.
    dbms_metadata.get_ddl(object_type => 'TRIGGER', name => 'TEST_TRIGGER');
    to get the script of all the triggers associated with a table
    SELECT dbms_metadata.get_ddl(object_type => 'TRIGGER', name => trigger_name) FROM user_triggers WHERE table_name = 'EMP';
    may be this can help you.

  • User Defined Function Missing In EF 6?

    I'm using Entity Framework 6 and I have imported several user-defined functions like the one shown below, but it doesn't
    appear when I try to select the function in intellisense and the model doesn't recognize this function as a method on the EF context.  How do I call this function in EF 6?
    <Function Name="getCycleDate" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" ReturnType="date" />
    MCSD .NET developer in Dallas, Texas

    Hello DallasSteve,
    >> I have imported several user-defined functions like the one shown below,
    What is your UDF? If it is a TVF, starting from EF5, it is supported already:
    https://msdn.microsoft.com/en-us/data/hh859577.aspx
    However, it is a scalar function, unfortunately, as far as I know, even entity framework 6 doesn't suport generating calls for scalar functions by default. The workaround is to write a custom method like this inside your DbContext class, for example, there
    is scalar function as:
    CREATE FUNCTION [dbo].[Function20150410]
    @param1 int,
    @param2 int
    RETURNS INT
    AS
    BEGIN
    RETURN @param1 + @param2
    END
    When we imported it to the model, it would generate code in SSDL as:
    <Function Name="Function20150410" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="true" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo" ReturnType="int">
    <Parameter Name="param1" Type="int" Mode="In" />
    <Parameter Name="param2" Type="int" Mode="In" />
    </Function>
    While, it will not generate a call method as a store produce, for a workaround, we could write a custom function as:
    [DbFunction("DFDBModel.Store", "Function20150410")]
    public ObjectResult<int> GetContentByIdAndCul(int id, int culture)
    var objectContext = ((IObjectContextAdapter)this).ObjectContext;
    var parameters = new List<ObjectParameter>();
    parameters.Add(new ObjectParameter("Id", id));
    parameters.Add(new ObjectParameter("Culture", culture));
    return objectContext.CreateQuery<int>("DFDBModel.Store.Function20150410(@Id, @Culture)", parameters.ToArray()).Execute(MergeOption.NoTracking);
    I suggest that you write this custom method a separate cs file since if we update the model, the original context call would be reset.
    Calling it as:
    using (DFDBEntities db=new DFDBEntities())
    var result = db.GetContentByIdAndCul(1, 1).FirstOrDefault();
    }s
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for