Package--basics problem

I have only just started using Java and immediately
ran into problems when trying to import a package that
I had written myself. I wrote the following minimal
programs to figure out what I am doing wrong, but I still
do not know.
1. package with method that adds two numbers.
package arithmetic;
public class Arithmetic {
   public static int addnum(int a, int b)
       return a + b;
}It compiled OK.
2. package that imports and uses addnum
package aritest;
import arithmetic.addnum;
public class Aritest {
    public static void testadd() {
       int addresult = addnum(3,2);
}It did not compile.
The output window of Sun ONE Studio 4 shows:
aritest/Aritest.java [3:1] cannot resolve symbol
symbol  : class addnum
location: package arithmetic
import arithmetic.addnum;
                  ^
aritest/Aritest.java [8:1] cannot resolve symbol
symbol  : method addnum (int,int)
location: class aritest.Aritest
       int addresult = addnum(3,2);
                       ^I am mystified by addnum being reported as a 'class' in
the first error message and as a 'method' in the second.
I also tried javac from the commandline (from a different directory).
Package arithmetic compiled OK, but aritest did not. The error
messages were slightly different from those produced by
Sun ONE Studio 4.
Would be most grateful for advice.

In the Aritest class, you want
import arithmetic.Arithmetic;instead of
import arithmetic.addnum;You can't import methods, only classes.
The first message is saying there's no class in the
arithmetic package called addnum. The second message
is saying it can't find a method called addnum anywhere in
the Aritest class.

Similar Messages

  • PACKAGE BASICS.UTIL..REGEX

    I have problem with my perogram!
    is package basic util.regex need to be download or it's already built in java!for information i use j2sdk 1.4.1!
    thanks a lot

    you're probably thinking of java.util.regex, which is part of jdk 1.4 and above.

  • Why do we run into stupid basic problems with firefox?

    I have jre1.6_u31 installed on a Windows 7 and the brilliant
    firefox keep tell me that I've to install the jre_1.6_u29 missing plugin when I try to run an applet...a simple applet!! The plugin doesn't appear on add-ons manager then i use "check your plugins" and the stupid response is: "For your safety, Firefox has disabled your outdated version of Java. Please upgrade to the latest version."
    Running an applet is basic! Why are u making new versions when older ones are better? I' m sick of running into this stupid problems with firefox! Everything works on ie, chrome and safari but not on Firefox!
    I' m sick of trying to solve firefox basic problems!
    We have a site that has one thousand ore more visits per day...and we only have troubles with firefox! What do I tell the costumers? I' m not going to give them solutions difficult and confusing as usually your solutions are! They are common people not developers as me...they just want the things to work! I gave up and the solution that I give to them now is to stop using firefox and uninstall it. And people ask I chrome is becoming the second most used browser...here is your answer...
    I' m a developer and I've to develop I don't have the time patiente to trying solving basic firefox problems. If you don't know how to solve the problems then stop developing this and save us the headaches.

    Have you updated Java lately? You say you have jre1.6_u31 installed, but "Java(TM) Platform SE 6 U31" is not showing in the Plugins submitted with your question (click "More system details" to the right of your original question post). To enable, Add-ons > Plugins, and enable the item.
    If your OS is 64-bit and you have 32-bit browsers (Firefox) and 64-bit browsers installed, then you need to install both the 32-bit and 64-bit versions of Java.
    *See --> https://www.java.com/en/download/faq/java_win64bit.xml
    '''Older versions of Java blocked in Firefox''' --> https://addons.mozilla.org/en-US/firefox/blocked/p80 <br />
    '''Using/Updating Java''' --> [https://support.mozilla.org/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox] <br />
    '''Unblocking Java''' --> https://support.mozilla.org/en-US/kb/unblocking-java-plugin
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • JScrollPanel basic problem

    Hi,
    would be grateful if someone could help out with this basic problem:
    I'm using a JTextArea that displays additional text added using the append() method in a java2 1.4 program, but I need it to automatically scroll down to show the latest line of text added whereas the panel by default requires the user to scroll down.
    Thanks,
    Allan.

    try looking at setCaretPosition(int position).

  • Allowed packaging materials problem

    Good Morning Experts,
    I have some problems to configure packaging materials for an trading good material
    I've configure a material group and packaging material type. I've created a packaging material (VERP), for this material i'veinsertes these values:
    1) Matl Grp Pack.Matls: new group;
    2) Packaging mat. type: new type;
    I've added entry in Allowed Packing Materials, I've associtaed group with pack. mat. type.
    The Matl Grp Pack.Matls of trading good material is setted to new group.
    When I confirm Transfer Order (Handling Unit mech<nism) and i use my new packaging material, application throws an exception during elaboration "HU packaging data are invalid for TO item ... ".
    Can you help me?
    thanks,
    regards.
    Marco Genova

    Hi,
    You need to customize Packing material type
    SPRO-->Logistic general > HUM>Basic setting-->Packaging material type
    Assign this in material master.
    Also you need to create Packing group .
    Assign that packaging material type in packing group.
    Mention this packing group in material to be packed.
    Regards,
    Vishal

  • A sample project with basic problems to solve. Lets make it as a tutorial!

    The project is attached it's supposed to end up being a simple file manager, so you can browse the files and folders using the list component.
    I've done some part which is the attached one. Now I meet some problems since it's my first project and I need some help so I can solve them. I will try to make this project available to everyone because I think in it's end it will really cover the basics you need to know to get started making more complex stuff.
    So I zipped the php folder with just 1 file that currently has script for browsing the current directory. At this stage of the development I would only like to be able to make the files and folders that the php returns to be displayed correctly in the list, the files no icon and the folders with the folder.png icon. To have a nice padding so they look good in the list and have a nice hover.
    Problems:
    1) warning: unable to bind to property 'name' on class 'Array' (class is not an IEventDispatcher)
    Note: that's the first problem you will see when you setup the project, change the php server urls and run it.
    http://flexponential.com/2009/11/11/binding-warnings-when-using-object-in-a-list -dataprovider/ - this post has some info on the problem but the example is with static mxml data and I am not sure how to fix this when the data comes from the php.
    2) what's the proper way to make some customizations on the data received, so to speak I need to check if the type of the file is "dir", that would mean it's a folder and should display the folder icon and if it's not not to display any image infront of the file. I am really not sure how to do that so any solutions are welcome.
    3) What's the most convinient way to adjust the padding between each line in the list and padding for the icon and label inside the line.
    I think solving these 3 problems will be a huge step forward to finish and have a complete structure which could help more people understand how things work.
    Everyones help will be greatly appreciated

    Anamorphicizer didn't work.
    I can use Quicktime Pro cause I currently have Quicktime X on my computer (snow leopard) which doesn't have a Pro upgrade.
    Any myDVDedit is really confusing to use do I have to export the DVD into a VIDEO_TS file to fix it? I'm still puzzled

  • Package execution problem with SQLSERVERAGENT

    Hello,
    I'm having a problem with the execution of SSIS packages: I created locally a package with SQL Server Data Tools, then I deployed it on my server in the SSISDB database. Then I created a job to execute periodically this package with SQL Server Agent. The
    package works fine and does everything I want, but I always get a failed notification. In the global view of the execution I can see:
    Result: "failed"
    Package name: "Package.dtsx"
    Task name: "Package"
    Execution access path: "\Package"
    Every other task returns a success and their execution access path is a subfolder of "\Package". I tried everything I found on the web, check the "Runtime 32bits" box, create a "Job Account" user to execute the package via a
    "Job Account Proxy", modify the ProtectionLevel of the package to "DontSaveSensitive", give the "Job Account" user full rights on everything, nothing works.
    Do you have an idea of what my problem is and how to solve it?
    I must precise that all my packages do the same thing: I have a loop on all the csv files in a folder that for each file loads the contents of the file in my database and the delete the file. I observed that the error message do not appear when there is
    no file in the folder when the package executes.
    Thanks in advance.

    Not sure what error message, is the one "est introuvable.
    Cette erreur est retournée par la collection Connections lorsque l'élément de connexion spécifique est introuvable"?
    So, here is in short: the ForEach Loop once in its beginning of operation "senses" the files currently present in the working folder. If a new file arrives after this stage, it will not see it.
    In your case it seems that the ForEach "saw" a file at the beginning, but it was gone at the time the processing wanted it for execution.
    Like many above indicated, the common practice, call
    it elegant or not is to indeed move the files to a different directory (working folder). This is done to avoid collisions with some other activity in that folder.
    Furthermore, you can have all the files deleted using a ForEach against the working folder as say in
    http://beyondrelational.com/modules/2/blogs/88/posts/10178/ssis-delete-files-from-specified-folder-using-file-system-task-in-sql-server.aspx And there is no need to delete the working folder
    itself.
    The job is run in SQL Server's Agent
    need to be set to run using a domain proxy account as it needs write access to the file system.
    Arthur My Blog

  • Adobe Air package damaged -problem

    Hi!
    I packaged my Adobe Air HTML/JavaScript -application with Dreamweaver CS 5.5 AIr Extension. Packaging with homemade signature went without any problems, but installing the application doesn't work. I get the error #1000 during installation. I suspect that problem relates to same bug that has been discussed in this thread: http://forums.adobe.com/thread/778613#3405543 (internal bug number 1674848). I thought that the bug has been resolved, but the installation works if I remove large (420MB) sqllite-db-file from package. The package's compressed size is ~ 95MB.
    My developing enviroment:
    Windows 7 x64 (4GB RAM)
    Adobe Dreamweaver CS5.5
    Latest Adobe Air Extension for Dreamweaver
    Latest Adobe Air runtime  / SDK (2.7; I have also tried building from command line with same results)
    Is the bug still there or should I try something else?

    The only idea that comes to mind is to keep the file on the dvd, then have your app install (copy) it on first launch.
    Thanks for adding the bug.  For others affected by this, please visit the bug and add your vote.  All feedback is appreciated!
    https://bugbase.adobe.com/index.cfm?event=bug&id=2938315
    Chris

  • Basic Problems with Attributes and Data Loading

    Hi Specialists,
    I have a basic understanding Problem. I will explain it with a simple Example. I have to load Employee-Data from a file. For each Employee we have
    EmployeeNo
    EmployeeName
    EmployeeLanguage
    My Modelling:
    1 InfoObject Employee, with EmployeeNo as Key and EmployeeName as Text. For the EmployeeLanguage I create an additional InfoObject, in order to have an Attribute EmployeeLanguage at the InfoObject Employee. So far so good (I think).
    What kind of DataSources have I to create?? It is necessary to load the possible Languages first?? If yes, what kind of DS I have to choose, for loading only "English", "German", "Dutch". Attribute? Text?
    If not, the loading process is not possible, because one language exists more than one time in my flat file.
    Hope you can help me to see it clear.
    Thanks.
    Denise

    Hi Denise,
    I don't think you have to load all possible languages first. This is only necessary if you also want to load texts for EmployeeLanguage (example language german with texts "german", "deutsch", ...).
    Specify Employee as data target (in tab Master Data / Texts) and assign your InfoArea. There you will find your targets for texts and attributes, now create InfoSource for your file and assign update rules for both texts and attributes.
    Best regards,
    Björn

  • IWeb basic problems? Issue with galleries

    Hi,
    A while ago I posted a question about a photo gallery I was trying to display, which went something like:
    "Hello,
    Just finished putting together a website for my brother but having issues with the gallery. I have a portfolio page for his photos. When I'm in iweb the photo album covers scroll nicely between images and link straight to the photo gallery page. But when I put it online I click and nothing happens, as you can see here:
    http://www.guycollier.com/guycollier/EdmundCollier_Theatre_Photography_My_Portfolio/Edmund_Collier_Theatre_Photography_MyPortfolio.html
    Does anyone know why? This is driving me crazy. I have deleated and uploaded the sight several times from iWeb and also Filezilla and Cyberduck but have the same issues. Please help!
    ps. also if anyone knows how to set the title of the page in the browser then that would be great too!"
    I have finally got the time to get back to it and have been trying various options suggested by users, including deleating and rebuilding the gallery, but it still doesn't work either online or on a local hosting. It was suggested that I might have some basic iWeb problems. Any idea what these maybe and how they might be resolved?
    Thanks
    Guy

    Thanks for the suggestion. I rebuilt it and without making any changes to the layout it seemed to work ok. However, when I have made some minor changes (putting a frame around the images, changing the layout slightly, removing the navigation menus) it no longer works. Any idea? Might I be deleting something by accident?
    Guy

  • Compiling package body problem

    hello
    i have a problem with portal 9.0.2.2.22(win2k server). When i try to log in i get the error
    Error: Could not open web cache connection. The portal use-web-cache setting is set to ON while web cache may be down. (WWC-40019)
    after that i run oracle enterprise manager console, logged into iasdb and tried to compile different package bodies(dbe_build_sql, wwv_qbe,...) and get the error:
    Line # = 0 Column # = 0 Error Text = PLS-00801: internal error [56106]
    inside this package body there is only one word
    wrapped
    and nothing else
    on a different machine i have in the same package body tons of code(dbe_build_sql consists of 20622 lines), inside my package only one word
    wrapped
    where is the problem?
    can anybody help me? please
    need help
    thanks
    Marjan

    Marjan,
    Try to post your question in the Portal Caching forum.

  • MDM Business Package : Deployment problem with SDM GUI

    Dear Experts,
    I want to deploy the MDM Business Package on to the j2ee engine.However, when i go to the SDM GUI and select the first SDA(com.sap.mdm.tech.mdm4j.sda) file for deployment, it just hangs and nothing happens after that.I feel something is wrong with the SDM GUI.
    Please let me know any possible solutions/alternatives to this problem.
    Thanks,
    Karambir Singh

    Hi Karambir,
    1) Are you trying to deploy the sda from your local machine or from a network drive? If a network drive, try copying it to your local machine and then deploying it.
    2) If the SDM is connecting to a remote application server, it can sometimes take a long time to get a response.
    3) Can you deploy other deployable archives via the SDM, or is only mdm4j.sda causing a problem?
    Walter

  • Oracle package invalidate problem with the jdbcOracleConnectionCacheImpl ()

    Hi all,
    I am using the OracleConnectionCacheImpl(); to Create the Oracle connection pool (OracleConnectionCacheImpl class)
    In my application i am calling the oracle stored procs.
    (DB environment :Oracle 9i)
    to call those stored proc i used the Prepared statements.
    All the requests are calling the same java bean to invoke the same package.
    when ever the changes occured in the db level,(it means if that package is invalid. i.e when ever the db refreshes occured), all the requests are geting oracle error.
    after the oracle package become valid.. still i am geting the oracle errors.
    it should not happen, because stored proc is in valid state.
    if we restart our adapter or java service then we are geting the proper responses.
    we don't know when the db problems occurs, when it will be solve
    can any one help me to make my application stable
    kindly help me to get underastand the behaviour of our java code and the jdbc behaviour.
    if any one didn't understand the above description i can mail you the code what i am using..
    Thanks in advance
    RajThota

    A regular Oracle database environment comes with several mandatory userids. These include SYS and SYSTEM. SYS 'owns' all details of the database and SYSTEM is the 'super DBA'. These are database userids, not operating system userids.
    I suspect the repository wizard wants to access the SYSTEM userid to be able to create a new schema (equivalent to 'database' for other vendors) within the Oracle environment.
    In older versions of Oracle, the default SYSTEM password was 'MANAGER'. These days, any security conscious DBA will have changed that quickly, but ...

  • Package permissions problem with Snow Leopard

    Under Leopard, changing permissions at the Get Info window for a package file also changes the package contents to the same permission settings. This no longer works in Snow Leopard. For example, I have tried adding another user name with read & write privileges. The package file displays the correct setting, but all the contents of the package have the newly added user as read only. This is causing me problems with a virtual machine I want to share with other users of my computer. I also tested it with iWork (Pages) packages - in Leopard the package contents keep the r&w setting for the new user, but not in Snow Leopard. Note that for package files, there is no option to apply to contents, as is the case for folders, but it should do it automatically.
    I would be grateful if someone could verify this bug. Also, I intend to use chmod -R at the terminal, but I am not sure how to use it to add a specific user with r&w privileges, so any help appreciated.
    Many thanks
    George

    I don't believe it's ever worked you the way you describe in leopard. I just tried it on my leopard machine with an application package and changing permissions to the package itself did nothing to its contents.
    you can change permissions recursively from terminal but it's easier from GUI.
    make a folder and put the package in that folder. *DO NOT* use system created folders for this. go to the permissions panel for the folder and set permissions as you like. then click on the "gears" action button at the bottom of the "get info" popup and select "apply to enclosed items". This will change permissions recursively on everything in that folder.
    NOTE: as I said, never do it with system created folders as they often have hidden ACLs and doing so will propagate those ACLs inside.
    to give a particular user read+write right to the whole package from terminal run the following terminal command
    chmod -R +a "username allow list,addfile,search,add_subdirectory,deletechild,readattr,writeattr,
    readextattr,writeextattr,readsecurity" /path/to/package

  • Package compilation problem in WinXP

    I am creating a simple program to throw a dice but have some problem with packages.
    I have 2 files, in the directory, C:\Dgame\Dgame\Dice.java and C:\Dgame\Dgame\Dealer.java .
    I packaged both of them into a package called Dgame (using "package Dgame;" at the first line of the file).
    The Dealer class creates a few NTDice instances. I tried to compile both a whole load of errors came out.
    Something like:
    cannot resolve symbol
    class NTDice
    location Dgame.Dealer
    Dice A = new Dice(1,2,3,4,5,6);
    any ideas on how to solve this problem will be greatly appreciated =)
    nb:i did not set any classpath settings

    Look up your error message here
    http://www.mindprod.com/errormessages.html and review
    the possible causes.
    If you still have problems post relevant portions of
    the code for review.Heres the code:
    I changed the file names abit. Dice == NTDice
    Any idea on how to solve the problem?
    Dealer.java
    package Dgame;
    import Dgame.*;
    import java.util.*;
    public class Dealer{
    //set the values for the dice
    NTDice A = NTDice( "A", 5, 6, 7, 38, 39, 40);
    NTDice.java
    package Dgame;
    import java.util.*;
    public class NTDice{
    //data members
    private String name;
    private ArrayList faceValues = new ArrayList();
    private Integer throwResult;
    static private int NTDiceCounter=0;
    //constructor
    public NTDice(String aName, Integer f1, Integer f2, Integer f3, Integer f4, Integer f5, Integer f6){
    name = aName;
    faceValues.add(f1);
    faceValues.add(f2);
    faceValues.add(f3);
    faceValues.add(f4);
    faceValues.add(f5);
    faceValues.add(f6);
    ++NTDiceCounter;
    public void roll(){
    ArrayList theDice = new ArrayList(faceValues);
    Collections.shuffle(theDice);
    setThrowResult(theDice);
    public void setThrowResult(ArrayList aDice){
    throwResult = (Integer) aDice.get(0);
    public Integer getThrowResult(){
    return throwResult;

Maybe you are looking for

  • Why does iTunes not recognize my phone and looks at it as a new phone everytime I connect?

    It started after the iOS 5.0 upgrade. Continues after iOS 5.0.1. (I have been syncing the same iPhone, my iPad 2, my iPod touch, and an older iPod Nano, for months.) I connect (via USB or wireless) and iTunes says "This computer has previously been s

  • Lifetime enable caused problem

    Hi, I have published an xml form in a folder and enabled the lifetime to that folder as explained this link http://help.sap.com/saphelp_nw04/helpdata/en/b4/fd2c407586ea01e10000000a155106/frameset.htm. I have created a km iview to display the xml form

  • Combine 2 rows

    I have result of a query as : emp_id emp_name wife_1 wife_2 wife_3 12   abc      xx 12   abc          yy 34  xyz         tt 34  xyz           pp 34   xyz                  uu I want to combine these reords so that the result should be like this : emp_

  • Flex 3 : Accessing Rest Ful  Webservices from Flex

    Hi , I am new to this term RestFul Webservices . I am using FlexBuilder 3. For accesing Restful web services , what is the Component Required , is it <mx:HttpService> or the <mx:Webservice> Please clarify , Thanks .

  • DC archive generation - deploy without JDI

    Hi everybody I have Web Dynpro DC "parent" depending on WebDynpro DC "child", and no JDI in use. I would like to create a deployable archive for father and then one for child and then ask customer's sysadmins to deploy them (e.g. with SDM), as I cann