Keyword package and import

helo,
someone, pls tell me the difference between using package and import? wat are the difference things that they include in our source file?
in simple terms pls.
thanks

http://java.sun.com/docs/books/tutorial/java/interpack/packages.html

Similar Messages

  • How to create package and import from jar file?

    Hi all,
    I am writing a software and I am not sure how to create a package for the classes.
    Say I have two classes in the same directory as follows:
    testA.java
    ==========
    package AB;
    public class testA
    public static void main(String[] args){
         testB myB = new testB();
         System.out.println("A test");
    testB.java
    ===========
    package AB;
    public class testB
    public testB(){
         System.out.println("B constructor");
    both file compile without the package heading;
    both file compile using: javac -classpath .\ *.java
    Question 1:
    I cannot run testA by: java -classpath .\ testA
    I think it is a syntax error. What is the correct one?
    If I run testA by: java testA
    The only output I get is: A test
    But I am expecting: B constructor /n A test
    What went wrong?
    Question 2:
    I need to use APIs of another software. I have downloaded a .jar file (xxx.jar) with all the classes in it. And I have put "import xxx.*;" in my source file. But the compiler complains about the importing. What is the right way to copmile it?
    I have read a couple of tutorials but they don't answer my question.
    (I am using windows2000 and don't have the classpath variable.)
    Hope some one can help.
    Thanks a lot

    Try moving testA out of the package and importing 'AB.*;'
    If you have:
    ./testA.class
    ./AB/testb.class
    Then to execute testA from ./ type: java -cp . testA

  • Package and import

    I have a problem about the syntax package and import . If i create a class file that call "Play.java" and keep it at directory call "test".
    Now , i create the main file that call the "Play" class and this current file keep at directory that call "demo". That is mean the "demo" directory includes the main file and "test" subdirectory. So , what should i do ?
    Thanks.

    I would assume that you have two files and want one of them to belong to a package. If the main directory you are working out of is c:\demo\ (/demo/ on a *nix system) you would have the following in that directory.
    c:\demo\MainProgramClass.java
    c:\demo\test\
    The c:\demo\test subdirectory would then contain a class called Play.java (c:\demo\test\Play.java)
    Right?
    That means the Play.java class belongs to the package 'test', so you would include the following at the start of the Play.java file:
    package test;
    Your MainProgramClass.java file (or whatever you named it) should contain the following import statement:
    import test.*;
    This will import all of the files in the test package (basically everything in the test directory). You could also use 'import test.Play;' if you only want to import the Play class.
    Hope this is what you wanted,
    Ryan

  • How to make a package and import it later

    Hi folks,
    this is a very basic question but it is not working to me so i will appreciate your comments.
    I had programmed many classes that are going to be used in many projects so they must be part of a library. Tell me whether or not this procedure is correct ?
    Compile those classes into .class files. Create a package with the jar application putting the .class files into a single file called my_utils ( .jar or .zip ?). Import the package from other projects using the import directive and storing the my_utils file in the project's library directory. Is this correct ?
    Many thanks in advance
    Marla.

    If you want to create a package and then put the package into a jar file, first compile into .class files (in appropriate package directories), then jar all of the .class files.
    Here's a link for a tutorial on packages. http://java.sun.com/docs/books/tutorial/java/interpack/packages.html
    Here's a link for a jar file tutorial. http://java.sun.com/docs/books/tutorial/jar/index.html
    You do not have put the .class files into a jar. Java packages are used for organizing classes, managing class name space, and controlling access to classes. Java jar files are a way to put multiple classes into a single file while compressing the content. Jar files can contain multiple packages and packages do not have to be inside of jar files.

  • Very Basic Package and Import question

    Thanks in advance ...
    - I read/tried all tutorials and documents on the matter
    - the programs are from "Java 2 from scratch" book (Steven Haines)
    - I suspect the problems result from using new SDK 1.4.2 version versus SDK 1.2.1 (that the book uses)
    OK, here we go :
    package Stock1.PortfolioTotalsPanel;
    - first line in PortfolioTotalsPanels.java file
    package Stock1.StockTablePanel;
    - first line in StockTablePanel.java file
    package Stock1.StockTableTabPanel;
    - first line in StockTableTabPanel.java file
    --- then:
    Import Stock1.PortfolioTotalsPanel ;
    Import Stock1.StockTablePanel ;
    NOW : I guess I have to compile 'PortfolioTotalsPanels' and 'StockTablePanel' on their own - which I did successfully and kept the '.class' in the same directory (folder) - Stock1
    When trying to compile 'StockTableTabPanel.java' file...
    StockTableTabPanel.java : cannot resolve symbol
    Symbol : class StockTablePanel
    Location: class Stock1.StockTableTabPanel.StockTableTabPanel
    StockTablePanel stockTablePanel = new StockTablePanel();
    ...and the same error message for 'StockTablePanel' class.
    - I noticed the last line has 'stockTablePanel' instead of 'StockTablePanel' ...not sure if it makes a difference..same with the 'portfolioTotalsPanel'
    I'm out of ideas...HELP !!

    package Stock1.PortfolioTotalsPanel;
    - first line in PortfolioTotalsPanels.java file
    package Stock1.StockTablePanel;
    - first line in StockTablePanel.java file
    package Stock1.StockTableTabPanel;
    - first line in StockTableTabPanel.java file
    --- then:
    Import Stock1.PortfolioTotalsPanel ;
    Import Stock1.StockTablePanel ;
    NOW : I guess I have to compile
    'PortfolioTotalsPanels' and 'StockTablePanel' on their
    own - which I did successfully and kept the '.class'
    in the same directory (folder) - Stock1Both of your source files are in a directory named Stock1, right? Change directory so that you are in the directory above Stock1:
    c:\javastuff\Stock1> cd ..
    c:\javastuff> javac Stock1/StockTablePanel.java Stock1/PortfoloiTotalsPanels.java
    to run them, run them from this root directory:
    c:\javastuff> java Stock1.StockTablePanel
    assuming that that class has a main() method.

  • Test Packages and import library error.

    Maybe somebody can help me. I'm working with a developer who created our project in NetBeans and uploaded to a CVS. (I am using JSE8) Because he did this it did not generate a "Test Packages" source folder. When I go to my local machine and create a folder named "test" the project creates the correct icon folder.
    1. At this point I select generate test (junit test) of my class in the package com.ca.web.utils
    2. in Test Packages it creates a package named com.ca.web.utils and then the test class classATest.
    3. My imports would not reference the class in the source package it only reference my TestClass in the Test Package.
    for example,
    Src
    com.ca.web.utils
    classA
    test
    com.ca.web.utils
    classATest
    and in my classATest when i attempt to reference classA
    import com.ca.web.utils. (only class in intelisense is classATest)
    Can anybody help?

    Seems if we add the "test" file package to the CVS itself that fixed the problem.

  • Please tell how to use package and import?

    Hi,
    My classes are in different packages
    for eg
    package manage.ui
    package manage.data
    package manage.layer
    if I try to import
    import manage.layer.*;
    in a class in manage.ui
    it shows
    package manage.layer does not exist
    Please help to find the problem?????

    Are your classes placed in a folder stucture that mirrors the package structure? So, like this:
    -manage(folder)
    --ui(subfolder of manage)
    --data(subfolder of manage)
    --layer(subfolder of manage)

  • Java Packages and Imports

    Hi,
    I have 2 java classes
    A.java
    B.java
    ### A.java ###
    import B;
    public class A
    public static void main(String[] args)
    public class B
    public void foo()
    when I compile B , it works fine, but when i compile A.
    it gives following error
    '.' expected
    why java doesn't allow to create & import a class without package, is there any workaround to resolve this issue
    this is a sample code i have posted, but actually I am facing the same problem in my current project. even if i include that class in classpath error doesn't go away.
    Please suggest what can be done to resolve this issue.
    Thanks in advance.
    NP

    - the default package (the package with no name)It does? Not for me.Gosh, you're right, it doesn't. Sorry.
    Actually, I never use it, my post was a copy/past from damned tutorial...
    - Tim - Harakiri - aaarrhhggg...

  • Export and Import a Keyword List

    Yesterday I exported the keyword list and then acted on the suggestion from LightroomSecrets site to 'organize' while it is in text format. This went very well using a text editor.
    The IMPORT doesn't overwrite the existing list. It merges INTO the list.
    So now I'm still scrolling up and down collecting the keywords that are stand alone to undo and then put a checkmark beside the subkey in a category. I would have been wiser to have reorganized a few and repeated the export,import <grin>
    If keywording is promoted as such an important feature and a main item for management in Lightroom then, it would seem to me that the 'LIST' itself could have been designed in a more efficient manner...Such as : a right click menu...or a browse and choice to move to...
    I suppose the architects of this list assumed users would have their keywording planned out ahead of time. Never assume <grin> I've only now (V1 to V3.4.1) got my head around the category concept so much reorganization required. Scroll up and down and zoom past the category wanted....not an exercise I can stay with for long periods of time <LOL!>
    Rose

    gtigan
    Keywords are kept in the main database file and when you create a new library, you create a new database.
    The only way I can think of to what you want is to select a single pic and give it ALL the keywords, then use iPhoto Library Manager to move that pic from the old library to the new one. iplm is the only way to move pics and metadata between libraries while using v6. (hmm, another reason to upgrade.)
    And, as I mentioned in my other post, if you're a "keyword fanatic" then check out Keyword Manager
    Regards
    TD

  • Import packages and Compilation issues

    hello,
    I am trying to compile and import a package in eclipse but it is not working.
    Any helpful links or feedback would be helpful.
    In the left pane is package explorer.
    I right clicked and imported the apache commons .jar files.
    The source .java files are in the same project folder.
    On the top navigation in Eclispe the Project Button is not showing the build project accessible.

    Your problem is really vague. It´s too generic and visually. Please use technically correct terms. Also please tell what error message exactly you got.
    As far it sounds like that you don´t understand how classpaths work and how the Eclipse´s buildpath is related to that.

  • Import package and create view object

    Hi,
    How can i import package from another project and create a new view object with my package and with the imported package.
    Thanks
    null

    Hi,
    How can i import package from another project and create a new view object with my package and with the imported package.
    Thanks
    null

  • BPC10 - Data manager package for dimension  data export and import

    Dear BPC Expers,
    Need your help.
    I am trying to set up a data manager package for first time to export dimension - master data from one application and import in another application ( both have same properties) .
    I created a test data manager package from Organize > add package > with  process chain /CPMB/EXPORT_MD_TO_FILE  and Add
    In the advance tab of each task there are some script logic already populated. please find attached the details of the script logic written under each of the tasks like MD_Source, concvert and target .
    I have not done any chnages in the script inside the task .
    But when i run the package , I have selected a dimension 'Entity' but in second prompt ,it ask for a transformation file , and syatem autometically add the file ... \ROOT\WEBFOLDERS\COLPAL\FINANCE\DATAMANAGER\TRANSFORMATIONFILES\Import.xls
    I have not changed anything there
    in the next prmpt , it ask for a output file ..and it won't allow me enter the file name .....i
    Not sure how to proceed further.
    I shall be greatfull if someone guide me from your experiance  how to set up a simple the data manager package for master data export from dimension . Should I update the transformation file in the script for import file and  output file in the advance tab. how and what  transformation file to be created and link to the data manager package for export / import .
    What are the steps to be executed to run the package for exporting master data from dimension and import it another application .
    Thanks in advance for your guidance.
    Thanks and Regards,
    Ramanuj
    =====================================================================================================
    Detals of the task
    Task : APPL_MD-SOURCE
    (DIMENSIONMEMBER, %DIMENSIONMEMBERS%, "Please select dimension", "Please select members", %DIMS%)
    (TRANSFORMATION,%TRANSFORMATION%,"Transformation file:",,,Import.xls)
    (OUTFILE,,"Please enter an output file",Data files (*.txt)|*.txt|All files(*.*)|*.*)
    (RADIOBUTTON,%ADDITIONINFO%,"Add other information(Environment,Model,User,Time)?",1,{"Yes","No"},{"1","0"})
    (%TEMPNO1%,%INCREASENO%)
    (%TEMPNO2%,%INCREASENO%)
    (/CPMB/APPL_MD_SOURCE,SELECTION,%DIMENSIONMEMBERS%)
    (/CPMB/APPL_MD_SOURCE,OUTPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,INPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,TRANSFORMATIONFILEPATH,%TRANSFORMATION%)
    (/CPMB/EXPORT_MD_CONVERT,SUSER,%USER%)
    (/CPMB/EXPORT_MD_CONVERT,SAPPSET,%APPSET%)
    (/CPMB/EXPORT_MD_CONVERT,SAPP,%APP%)
    (/CPMB/EXPORT_MD_CONVERT,OUTPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,INPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,FULLFILENAME,%FILE%))
    (/CPMB/FILE_TARGET,ADDITIONALINFO,%ADDITIONINFO%))
    Task : EXPORT_MD_CONVERT
    (DIMENSIONMEMBER, %DIMENSIONMEMBERS%, "Please select dimension", "Please select members", %DIMS%)
    (TRANSFORMATION,%TRANSFORMATION%,"Transformation file:",,,Import.xls)
    (OUTFILE,,"Please enter an output file",Data files (*.txt)|*.txt|All files(*.*)|*.*)
    (RADIOBUTTON,%ADDITIONINFO%,"Add other information(Environment,Model,User,Time)?",1,{"Yes","No"},{"1","0"})
    (%TEMPNO1%,%INCREASENO%)
    (%TEMPNO2%,%INCREASENO%)
    (/CPMB/APPL_MD_SOURCE,SELECTION,%DIMENSIONMEMBERS%)
    (/CPMB/APPL_MD_SOURCE,OUTPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,INPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,TRANSFORMATIONFILEPATH,%TRANSFORMATION%)
    (/CPMB/EXPORT_MD_CONVERT,SUSER,%USER%)
    (/CPMB/EXPORT_MD_CONVERT,SAPPSET,%APPSET%)
    (/CPMB/EXPORT_MD_CONVERT,SAPP,%APP%)
    (/CPMB/EXPORT_MD_CONVERT,OUTPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,INPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,FULLFILENAME,%FILE%))
    (/CPMB/FILE_TARGET,ADDITIONALINFO,%ADDITIONINFO%))
    Task : FILE_TARGET
    (DIMENSIONMEMBER, %DIMENSIONMEMBERS%, "Please select dimension", "Please select members", %DIMS%)
    (TRANSFORMATION,%TRANSFORMATION%,"Transformation file:",,,Import.xls)
    (OUTFILE,,"Please enter an output file",Data files (*.txt)|*.txt|All files(*.*)|*.*)
    (RADIOBUTTON,%ADDITIONINFO%,"Add other information(Environment,Model,User,Time)?",1,{"Yes","No"},{"1","0"})
    (%TEMPNO1%,%INCREASENO%)
    (%TEMPNO2%,%INCREASENO%)
    (/CPMB/APPL_MD_SOURCE,SELECTION,%DIMENSIONMEMBERS%)
    (/CPMB/APPL_MD_SOURCE,OUTPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,INPUTNO,%TEMPNO1%)
    (/CPMB/EXPORT_MD_CONVERT,TRANSFORMATIONFILEPATH,%TRANSFORMATION%)
    (/CPMB/EXPORT_MD_CONVERT,SUSER,%USER%)
    (/CPMB/EXPORT_MD_CONVERT,SAPPSET,%APPSET%)
    (/CPMB/EXPORT_MD_CONVERT,SAPP,%APP%)
    (/CPMB/EXPORT_MD_CONVERT,OUTPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,INPUTNO,%TEMPNO2%)
    (/CPMB/FILE_TARGET,FULLFILENAME,%FILE%))
    (/CPMB/FILE_TARGET,ADDITIONALINFO,%ADDITIONINFO%))
    ================================================================================

    1. Perhaps you want to consider a system copy to a "virtual system" for UAT?
    2. Changes in QAS (as with PROD as well) will give you the delta. They should ideally be clean... You need to check the source system.
    Another option is to generate the profiles in the target system. But for that your config has to be sqeaky clean and in sync, including very well maintained and sync'ed Su24 data.
    Cheers,
    Julius

  • OWB 9.0.3.37 and imported plsql packages

    I have some problems in owb version 9.0.3.37 with imported packages.
    I can't delete a procedure/function in the imported package,in the package body I can do this .
    The only way do delete procedure/function is do delete the package and re-import it from the db into OWB.
    Problem then is that when I valid a mapping I must reconcile inbound the transformation (link broken).
    Is there not another way to do delete function/procedure from a imported package.
    Is the import of packages in the new version 9.2 still possible?

    Hi,
    There is an internal reason (validation) why we cannot allow you to delete functions from a package that you imported. That model is still the same in the latest production release.
    Thanks,
    Mark.

  • FormValueBean syntax and import package

    Hi,
    OAFormValueBean dummy= (OAFormValueBean)webBean.findIndexedChildRecursive("rrrr");
    dummy.setValue="yes";
    dummy.setValue="no";
    and used package is
    import oracle.apps.fnd.framework.oaFormValueBean;
    Error(19,46): cannot access class oracle.apps.fnd.framework.webui.beans.OAFormValueBean; file oracle\apps\fnd\framework\webui\beans\OAFormValueBean.class not found
    any body tell me the correct package nd formvaluebean syntax..pls..
    Thanks
    Madhu

    Hi KP,
    Thanks for your answer its working.Thanks a lot..
    Edited by: 885404 on Sep 15, 2011 10:58 PM

  • BPC 7 SP3 and Import Excel package

    Hi,
    I use VPC 7 SP3 (with SQL Server 2005) and I have some problems with the standard package named "Import Excel". The following error is returned:
    Package Error Events: 
    ErrorCode = -1073450901
    Source = ExcelToText
    SubComponent= DTS.Pipeline
    Description = "component "EXCELFILE" (1)" failed validation and returned validation status "VS_NEEDSNEWMETADATA".
    Here is the parameters:
    %XLFILE%     /ECOS/COMPTABILITE/DataManager/DataFiles//EXPORT_COMPTABILITE.XLS
    %SHEET%     COMPTABILITE_CIBLE
    %COLUMNS%     
    %TRANSFORMATION%     /ECOS/COMPTABILITE/DataManager/TransformationFiles//Transf_JDE_Compta_Actual.xls
    %CLEARDATA%     1
    %RUNLOGIC%     0
    %CHECKLCK%     0
    Any ideas?
    thanks,
    Romuald

    Hi,
    here is more information. The Excel file I try to load has different columns from the standard ones (I have an HYP dimension and no INTCO dimension). I have specified the list of columns in the package parameters interface. It seems that these values are not used by the package. I think that the package waits for a file with the standard columns, no less, no more. It works fine with BPC 4.2 (I use the standard Import Excel package and the file is well loaded).
    thanks for your help,
    Romuald

Maybe you are looking for

  • Download error on creative cloud. not possible to download new items

    hi i am unable to download new apps to my creative cloud . i have a full membership. it keeps on saying download error on the apps page. what can i do ?

  • New Problem Viewing Honeymoon Phtos...

    Hello again, Well, as stated in my previous post, it looks as if we were able to salvage about 90% of our honeymoon photos off our memory discs. However, we came across a problem. The way my folders are set up, a thumbnail is viewable as we scroll th

  • Imesh has taken over. Wont get out. Has taken over my homepage.

    I downloaded imesh to get access to more music. It has now taken over my computer like a virus. I have w XP and have removed it out of the add/remove section of the computer. CNN is my homepage, but since downloading It, cannot get my hompage back. E

  • Cisco ACS Policy Mapping

    Hallo, I have a question about the policy mapping in ACS 5.4. When a request matches in "Access Selection Rule" the request goes to an "Access Service". In "Access Service" there are three kinds of policy rules: - Identity: If condition match then re

  • Pass code lock app

    I'm looking for an app, if any, that would turn on the pass code lock when I leave my house. I know this app was available if you jailbroke your iPhone. I don't need my pass code on when I am home but at work it is handy. Is there an app or would app