Working with packages

I have two classes within a same directory (directory name is myPackage), but one using package statement as:
package myPackage;
other file doesn't. The codes are as follows:
* file: myPackage\A.java
public class A{
     public void call(){
* file: myPackage\B.java
package myPackage;
public class B{
        public static void main(String[] args){
          A a = new A();
{code}
When compiles B.java it successfully compiles.
javac myPackage\B.java
But when try to invoke call method of A, the compilation fails. Here I'm confused wonder why can not be invoked if you can create an instance. Please reply if some one knows this issue.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

* file: myPackage\A.java
public class A{
     public void call(){
* file: myPackage\B.java
package myPackage;
public class B{
public static void main(String[] args){
          A a = new A();
When compiles B.java it successfully compiles.
javac myPackage\B.javaI doubt that B.java successfully compiles base on the code structure above.
B here is assuming to instantiate myPackage.A

Similar Messages

  • Problem when working with package???Please, help me!!!

    I got 3 .java files from one Java tutorial as follow:
    Server.java (in package mygame.server)
    Utilities.java (in package mygame.shared)
    Client.java (in package mygame.client)
    All the above files are placed in "E:\Java Programmes\source"
    After compiling, i got correspponding .class files:
    Server.class (placed in "E:\Java Programmes\class\mygame\server")
    Utilities.class (placed in "E:\Java Programmes\class\mygam\shared")
    Clients.class (placed in "E:\Java Programmes\class\mygame\client")
    But when i run Server.class which contains main method, i got error as follow:
    E:\Java Programmes>java class\mygame\server\Server
    Exception in thread "main" java.lang.NoClassDefFoundError: class\mygame\server\S
    erver (wrong name: mygame/server/Server)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    That was very puzzled for me. I cannot find out what wrong with my files. Please., any boby, help me!!! I always got this problem when working with package and managing files. Thanls a lot.

    java -cp "E:\Java Programmes\class" mygame.server.Server

  • Problem while working with packages?

    hi,
    I am new to java.while running the program which is using package i am getting the following error
    *Exception in thread "main" java.lang.NoClassDefFoundError: HelloServlet2 (wrongname: coreservlets/HelloServlet2)
    at java.lang.ClassLoader.defineClass1(Nativ... Method)
    at java.lang.ClassLoader.defineClass(Unknow... Source)
    at java.security.SecureClassLoader.defineCl... Source)
    at java.net.URLClassLoader.defineClass(Unkn... Source)
    at java.net.URLClassLoader.access$100(Unkno... Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivile... method)
    at java.net.URLClassLoader.findClass(Unknow... Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadCla... Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(... Source).*iam using windows xp and iam working with jdk1.5 version.plz any one help me to solv this problem.
    thanks in advance.

    This is the program iam trying to run
    package coreservlets;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Simple servlet for testing the use of packages.
    * <P>
    * Taken from Core Servlets and JavaServer Pages 2nd Edition
    * from Prentice Hall and Sun Microsystems Press,
    * http://www.coreservlets.com/.
    public class HelloServlet2 extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>Hello (2)</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>Hello (2)</H1>\n" +
    "</BODY></HTML>");
    I have installed jre1.5 version.and i have specified my class name has coreservlet.HelloServlet in my web.xml.after sending the request sever giving the exception like
    javax.servlet.ServletException: Wrapper cannot find servlet class coreservlet.HelloServlet2 or a class it depends on
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Unknown Source)
    iam using Tomcat 5.5 web server for my web appln.After compiling the above program the coreservlets subdirectory must be created in development directory right,but it is not doing that. plz help me.

  • Java-JSP working with packages and classes

    Hi everybody,
    I'm bearly new on Java-JSP developping and I wanted to know how Tomcat (for example) manage the imported packages and classes.
    The fact is I'm working on a project ('/bob') which use some packages that I don't see in the '/bob' directory. So, is that possible that '/bob' is downloading packages and classes from Internet to '/bob/download' virtual repertory and use it? If it is true, is it possible to override this download by making '/bob' project using local packages or classes (example : com.boblibrary.classes.util in '/bob/WEB-INF/classes/com/boblibrary/classes/util') instead of downloading it?
    Therefore, the '/bob' project is using bugged classes (that I think it downloads from Internet) which I can't correct.
    Thanks for your help.
    - Renaud

    Thank you for your answer, but I can't imagine where is physicaly the class that my project use and show me as http://localhost:8080/atlassian-jira-3.13.2/download/ressources/br.com.ecore.jira.plugin.projectViewPlugin:ProjectViewTabPanel/js/projectviewtabpanel.js. Where is that Javascript file suppose to be on my hard drive? Or where is that class 'br.com.ecore.jira.plugin.projectViewPlugin' suppose to be on my hard drive? If it is not dowloaded from the Internet.
    I have no trace of that class on 'atlassian-jira-3.13.2/', neither on 'jdk1.6.0_18/', 'jre6/' or 'apache-tomcat-5.5.28/common/classes/'.
    Thanks.

  • ORA-00600 when working with packages

    Record/key deleted
    ORA-00600: internal error code, arguments: [kkxpityp1], [], [], [], [], [], [], []
    This is a result of a "SELECT * from table(p_df.r_dochdr(1))"
    where "p_df" is a package, "r_dochdr" is a table function,
    which has a very simple SELECT statement, which is returned through PIPE ROW statement and works fine when called not from this function.
    This error disappears when package is dropped and recrated(recompilation doesn't help) and then appears again after a while.
    Sometimes similar errors appear when I try to recompile the package

    Hi
    You are probably hitting bug# 2136476, i.e. ORA-00600 [KKXPITYP1] WHEN SELECT FROM TABLE FUNCTIONS.
    According to Metalink:
    - Workaround: Do not use functions, which returns types defined inside packages
    - Fixed in 9.2
    Chris

  • The "Adobe Reader 11.0.08 security update - All languages" is not working with "Adobe Reader 11.0 - Multilingual (MUI) installer" using msiexec when creating an msi package. is there going to be a release of Adobe Reader 11.0.08 update - Multilingual (MUI

    Is it possible to create an msi package if the product you are upgrading is Multilingual (MUI) and the update(msp) you are applying is not Multilingual (MUI) but "All languages"?

    Please download the latest Adobe Reader patch from the below mentioned location, it will work with MUI installer.
    ftp://ftp.adobe.com/pub/adobe/reader/
    ~Deepak

  • I've lost CS5 Design Premium Teachers Edition CD Installation Package. How can I download it? Typical version of CS 5 Design Premium is not working with my serial number

    I've lost CS5 Design Premium Teachers Edition CD Installation Package. How can I download it? Typical version of CS 5 Design Premium is not working with my serial number. Can someone help me?

    Łukasz%20Molenda if you purchased Creative Suite 5 from Adobe directly, and choose the download option at the time of purchase, then the download will be available in your account at http://www.adobe.com/.  You can find additional details at https://helpx.adobe.com/creative-suite/kb/find-download-link.html.
    If you purchased the software on a DVD and your current computer does not have an optical drive then you can copy the installation files to a USB drive on a computer which does contain an optical drive.

  • CRM Business Package - Error while working with Iview

    Hi,
    I would like to know if any one had a chance to work with CRM Competitor Products Iview. I am using BUSINESS PACKAGE FOR SAP CRM 4.0_60_2_2. There is no problem is displaying the Iview, also I am able to work with the Iview, but when I try to open tabs, I am getting a fatal error. A run time error occurs and the iview doesn't work after that.
    the exact message is :
    A run time error occured, Do you wish to Debug ?
    Line 22
    Error : Invalid syntax.
    Since this is a standard package I don't know what this error means.
    Help is greatly appreciated.
    Thanks!
    -SG

    Hi Suresh,
    Similar Problem we faced for other IViews like Products, Accounts BSP Application from the SAME Business Package.
    Later we found that the error is not in Business Package, but the Version of IE Browser caused the Problem.
    Just for info we need to have the IE 5.5 or Greater (IE 6.0 is Best) After Upgrading the IE Version to 6.0, then we did not face this error.
    Hope its helpful.
    Regards
    Sumanth

  • Working with R packages for Big Data

    Hi ,
    I wonder which R package from it big data an parallel processing family are relevent to work with in ML Studio ?
    It depends on if ML Studio uses Map Reduce during R script ? If yes , RHadoop package seems not useful .
    If using snowfall package for parallel processing will help for high volume datasets . If it will exploit several CPU ?
    Thanks in advance

    Currently, the R scripts are executed on single VM. You can manually set up map-reduce pattern by splitting the data and having multiple Execute R Script modules in parallel in your experiment graph.
    -Roope

  • Anyone with a hint ref. why my office package wont work after showing this message: "Check with the developer to make sure it works with this version of Mac OS X. You may need to reinstall the application. Be sure to install any available updates"

    also, I have to mention I already reinstalled package and nothing works. Help please!

    Hi, thanks for getting back. Here is the full content on the window that pops up every time I click on my Word icon: "Microsoft Word cannot be opened because of a problem. Check with the developer to make sure Microsoft Word works with this version of Mac OS X. You may need to reinstall the application. Be sure to install any available updates for the application and Mac OS X. Click Report to see more detailed information and send a report to Apple". I reinstalled the application, and everything else is updated, so I am not sure what to do.

  • Anybody work with oracle.javatools.editor package ?

    Subj

    To answer your question: Yes, I am sure many people work with oracle.javatools.editor package. If you have a more specific question post it. Someone might have the answer you're looking for.
    PS I don't work with this package, I was just wondering why this post didn't have any replies.
    DB

  • Will Photoshop Elements 12 work with Mac OS X v10.9.4? Need to make sure before opening package... Thanks!

    Will Photoshop Elements 12 work with Mac OS X v10.9.4? I need to make sure before opening package... Thanks in advance!

    Yes, PSE versions 6 through 12 work in 10.9, although PSE 11 is a bit buggy. All other versions are fine, including PSE 12.

  • Captivate 8 Continually Crashes: When trying to publish, When trying to use the Object Style Manager. Also it is blocked by Windows Firewall (adobecaptivatews) every time it launches. Working with Captivate App Packager the pane to import from Adobe Edge

    Captivate 8 Continually Crashes: When trying to publish, When trying to use the Object Style Manager. Also it is blocked by Windows Firewall (adobecaptivatews) every time it launches. Working with Captivate App Packager the pane to import from Adobe Edge is missing, so not clear how to import. Overall it seems unstable. Am I doing something wrong? Trying to evaluate before buying so working on a trial version (14 days left), but a bit concerned with Captivate 8 Performance. Please help! :-

    Hi Vikram and Lilybiri,
    Thanks for your responses :-)
    I'm working on Windows 8.1... I think that I may have found the issue... I was saving the file in a project directory rather than the default My Captivate Projects folder...
    Perhaps Captivate was struggling to find resources it needed?
    It hasn't crashed for a while now, though it is struggling - I'm working with a 54 slide PPT presentation that is linked and it takes a very long time to interact.
    Sometimes it says that I've removed slides, which I haven't?
    Best,
    Christy.

  • Getting php + apc to work with the arch-package

    Hi,
    I am trying to get APC to work with PHP. And I am wondering if it is really working.
    I have installed the archlinux APC and PHP.
    Then I uncommented /etc/php/conf.d/apc.ini in so:
    extension=apc.so
    When i run php_info():
    there is actually a new section for APC:
    APC Support     enabled
    Version     3.0.19
    MMAP Support     Enabled
    MMAP File Mask     no value
    Locking type     pthread mutex Locks
    Revision     $Revision: 3.154.2.5 $
    Build Date     May 15 2008 19:49:30
    but,
    when i do: php-cgi -v
    PHP 5.2.9 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Mar 25 2009 14:59:15)
    Copyright (c) 1997-2009 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    shouldn't it print something at the bottom saying something like "with APC ...."
    my other consern is if php actually needs to be compiled with support for APC and that is not the case with the php that comes with the
    archlinux package? If I do: php-config
    I can not see anything about APC.
    If I try to benchmark with and without extension=apc.so I don't see any improvements, actually it is some percent slower with apc commented in.
    Last edited by jb234 (2009-06-22 11:27:25)

    Ok, I think it is working.
    The problem was testing with a too small a php-script. The bigger a php-script the more potential for speedup from apc.
    Sorry for the confusion.

  • Has any one worked with PooledPreparedStatement in apache dbcp package ?

    Has any one worked with PooledPreparedStatement in apache dbcp package ?
    Is there a sample ? Can you share the code
    Raees

    Hi Rahul,
    I am not an expert in this matter, but i think i can share some info.
    SAP Fiori uses a very different development approach using SAPUI5 (HTML5/Javascript/CSS etc).
    I really don't know if there is a way to migrate WDA with your intent, it seems more like a redesign of your applications using the SAPUI5 resources, which can result in a reasonable amount of effort, depending on your WD applications quantity, complexity, size and other several factors.
    It has to be sized very carefully, and the new designs must be based on a solid software modelling that suits and leverages the advantages of the SAPUI5 framework. 
    There is much content to venture into, you can search for SAPUI5 tutorials/info, or add it with Fiori.
    Here is an example of interesting content from last year:
    What SAPUI5 and Fiori tells us about the future of UI development skills
    Hope it helps you, i am also studying these topics, please feel free to correct my mistakes.
    Regards,
    Renan

Maybe you are looking for

  • Can't open Pages 05 saved in Dropbox on new Pages iPad app and visa-versa

    Updated to the new Pages 05 on all my devices (macbook, iPad, iPhone). Problem now is that I want to save documents into Dropbox. Works fine when saving a file from my macbook to dropbox, and then opening it on my macbook again. But whenever I create

  • How do i back up my library to dvd

    i'm trying to back up my itunes library to blank dvds and it doesnt give me that option

  • CU4 Client Version not showing

    I upgraded my lab environment to CU4. The upgrade process went flawless. I then deployed the client update, which also went smoothly. All of my clients show the version 5.00.7958.1501 under Control Panel. What is unusual is I'm not seeing the updated

  • Iphone email received as code

    When sending emails via my handset (3Gs with IO5 software), they are received by the recipient with coding (see example below).  This issue is intermitent. How do I stop it?

  • Adobe illustrator cs6 has stop working

    Hi, I get this error every day when i work on illustrator cs6. the illustrator close and crash. any idea how to resolve this error?