Packages, import and Inheriting with static

Hello.
I am programming a program, in which the main class (file: Main.java) uses objects declared in Components.java.
The problem is, the import of the components only works if I explicitly make the main class inherit from the components class with whose objects being declared as 'static'. A simple import instruction, the way I learned it, in the main class such as 'import <project>.components;' does not work.
Sample code:
Current state; working
Main.java:
package <project>;
public class Main extends Components {  
    public static void main(String[] args) {
        start();
}Components.java:
package <project>
public class Components {
    public static void start() {
        // code
}Desired:
Main.java
package <project>;
import <project>.components;
public class Main {  
    public static void main(String[] args) {
        start();
}Components.java:
package <project>
public class Components {
    public void start() {
        // code
}How to realize this idea into a working program?
Thanks in advance!

I apologize for not conveying my problem proberly, but you have to know I did not learn Java with reference material in the English language, therefore it might happen that some terms are not translated correctly (by me) and thus not equaling the standardised terms.
Anyway, let me try to rephrase my problem.
I want to use the object declared in Components.java in the main class/main methode of the file Main.java. In order to achieve this goal I used inheriting, concretely the main class inherits from the components class, as a makeshift to use Components.java's objects in the main class. However this is not the way I want to accomplish my objective with.
To make a long story short I just want to utilise Components.java's object in Main.java's main method. The manner to achieve this does not matter, though I want to do it preferably with 'import'.
Hope this clears things up. Thank you anyway.
Edited by: Ikaragua on May 31, 2008 6:00 AM
Solution found.
package project;
public class Main {  
    public static void main(String[] args) {
        Components.start();
}

Similar Messages

  • HT201302 Even though there are over 200 photos on my ipad, after trying both methods of importing and connecting with a lead, a message appears saying that there are no photos on this device. Any ideas?

    Even though there are over 200 photos on my ipad, after trying both methods of importing and connecting with a lead, a message appears saying that there are no photos on this device. Any ideas?

    Did you connect your iPad to your computer then open the application on your computer that transfers photos from a camera? Your computer should recognize the iPad as a camera. All photos in the Camera Roll on the iPad should then be seen and you should be able to copy them to the computer using that application.
    Photos that were synced to your iPad by connecting to your syncing computer cannot be copied back this way as the master file for those photos are on the syncing computer.

  • Imported and Inherited properties

    Hi ,
    Can anyone please explain me what are the imported and inherited properties in OCD?
    How are they created?

    You can try running following query in your instance.
    SELECT f.*
    FROM cz_xfr_fields f, cz_xfr_tables t
    WHERE t.order_seq=f.order_seq
    AND t.dst_table='CZ_PROPERTIES'
    AND f.xfr_group='IMPORT'
    AND t.xfr_group=f.xfr_group
    AND f.dst_field='DEF_VALUE';
    SELECT f.*
    FROM cz_xfr_fields f, cz_xfr_tables t
    WHERE t.order_seq=f.order_seq
    AND t.dst_table='CZ_PROPERTIES'
    AND f.xfr_group='IMPORT'
    AND t.xfr_group=f.xfr_group
    AND f.dst_field='PROPERTY_UNIT'
    If the NOUPDATE field returns value 1, then update it to 0 by preparing appropriate UPDATE query for it.

  • A simple Q about package, import and classpath

    Hi!
    Could You help me! Where's the problem?
    dir is C:\Omat tiedostot\Pasin Kansio\Et�lukio\eph200,
    sub dirs are datat, javat (java-files) and luokat (classes),
    file kaanna.bat is
    "set classpath=C:\Omat tiedostot\Pasin Kansio\Et�lukio\eph200
    del luokat\*.class
    c:\jdk1.1.8\bin\javac -d luokat javat\Examiphobia.java"
    Examiphobia.java is
    "import luokat.*;
    class Examiphobia...
    new ExamiphobiaFrame(Asetukset[0]);
    ExamiphobiaFrame.java is
    "import luokat.*;
    class ExamiphobiaFrame..."
    Thanks /m35Fin

    Laitetaanpa nyt kuitenkin enklanniks� jotta muutkin ymm&auml;rt&auml;&auml;...
    The problem is that package structure and directory structures are different things.
    You can't import the package "luokat" since there is no package called that. Packages are made with the package declaration: "package packageName;".
    So, remove "import luokat.*;". It's not needed.
    Instead, modify kaanna.bat:
    set classpath="C:\Omat tiedostot\Pasin Kansio\Et&auml;lukio\eph200"
    del luokat\*.class
    REM cd to the real directory and compile
    cd javat
    c:\jdk1.1.8\bin\javac -d ..\luokat Examiphobia.java
    REM cd back to parent
    cd ..
    I'd also recommend downloading up-to-date SDK, you may need it in the future...

  • Exact difference betwteen aggregation and Inheritance with example

    hi everybody
    Just I got some doubt regarding the difference betwteen aggregation and Inheritance and where we can differntiate the use of each other. I am little bit confused with the two usages when refering to objects.
    Thank you

    ramsy wrote:
    hi everybody
    Just I got some doubt regarding the difference betwteen aggregation and Inheritance and where we can differntiate the use of each other. I am little bit confused with the two usages when refering to objects.
    Thank youIt's the difference between the "is-a" and "has-a" relationship. A Car is-a Vehicle. A Car has-a Engine.

  • Advantages and disadvanteges with static methods

    Hi,
    Can anybody suggest me the advantages and disadvantages of static methods? In my project i am using templates which are used by different programs and in that templates i am using static methods.
    It is web application. is there any problems if made methods as static in templates that are used by diferent clients?
    Thanks
    Karimulla

    A static method can't be overridden, and static methods are usually only used for some utility methods and other things which don't belong to the class. I would probably not make the methods static.
    Kaj

  • Port Forwarding and Printing with Static IP Address

    Hey there -
    I am trying to setup a network printer that can be printed to from anywhere in the world. My organization has 5 static IP addresses given to us by our ISP. Four of those I have on computers, and one of them I have on my Linksys router (WRT54G v.8).
    What I want to do is be able to setup a printer on my router that I can print to from anywhere I have an internet connection. My wireless router's static IP address is 74.172.54.XXX - The address on my network is 192.168.7.1 - I have a printer statically assigned the IP address 192.168.7.2 - and I have a port forwarding for port 70 to forward to 192.168.7.2
    In theory, I would think that now I could print to 74.172.54.XXX:70 and have no problems. But that doesn't seem to be working. Even printing to 192.168.7.1:70 doesn't seem to work either.
    Also, the printer has a web GUI interface that if I type http://192.168.7.1/ into my browser it comes up, so in theory I would think typing http://74.172.54.XXX:70 into my browser it should come up (but it doesn't nor does http://192.168.7.1:70).
    Anybody got any suggestions? I tried to do a search about this, but ever Port Forwarding question seemed to deal with gaming (which I have no desire to do). Thanks!
    I will include two screen snapshots of what I am talking about:
    Thanks for any help.

    Is the router setup to accept static connections?
    I have my router set up to accept both, so from 192.168.1.100 to 192.168.1.192 the addresses are static the other addresses are given by DHCP.
    If you do not define a range and the address your laptop has as static IP conflicts with the address given by DHCP your loose ... as in you get no address.
    Set up of that feature may depend on your type of router but usually any decent router will have that capability ... read your manual for specifics about your unit.
    Best of luck.
    R.
    Last edited by ralvez (2009-12-10 00:08:50)

  • Cannot import  and work with the files from Canon 6D and Panasonic GH4

    Thanks for your answer, but it is not really helpful. Perhaps my question was not exactly enough-sorry but my english is not in the best condition. I dont need trials I have some applications and my Intel MAC Pro 2009 is strong enough. For instance Phase One can read my RAW-pictures from my Canon 6D, but no RAW-file from the GH4. Finalcut Pro Vers 7.0.3 no chance to open Movies made with the GH4 and the AVCHD-codec, though the AVCHD-codecs from my old Canon Videocamera works perfect. Even movies with Mpg 4 H 264 are not recognized.  Perhaps I need a special Converter App, for all my Converter Apps like Mpeg streamclip or Flip for MAC cannot read and convert the these files into RS 422.

    Will the DNG files perform the same, meaning will I retain all the information that makes RAW important for processing?
    Yes. That's why DNGs were invented. Adobe has put a lot of work into the DNG format for this very reason.
    Raw files are proprietary and manufacturer specific. Raw formats change with every make and model of camera. Software must be updated for the new Raw format of every single camera. Adobe does an admirable job of upgrading Camera Raw for every new camera.
    DNG is also a Raw format but it's open source and works in any software which can read the DNG format. If camera manufacturers used the DNG format instead of their own Raw format, you would not have to upgrade Elements 10. But they don't, and probably never will, so you must upgrade the Camera Raw plugin (and therefore Elements 10 since it's not compatible with the new Camera Raw) to read the new Raw format from the 6D or add another step to your workflow with conversion to DNG first.
    See
    http://photographylife.com/dng-vs-raw
    http://www.adobe.com/products/photoshop/extend.displayTab2.html

  • Import, and interact with, Flash 8 movies in Flex3.

    Hey gang,
    I have a Flash CS3 App built with ActionScript 2.0 that imports Flash 8 SWFs. Those Flash 8 SWFs are each comprised of hundreds of movieclips.
    I'm rebuilding the Flash CS3 App in Flex 3, and even though I can import the Flash 8 SWFs but can't interact with them (change their color, change their sizes, duplicate them, etc).
    Before you tell me to convert all the Flash 8 SWFs to CS3/ActionScript 3.0 know that there are 700+ of them.
    Tips? Tricks? Ideas?
    A sample SWF (and source FLA) I'm trying to import into Flex 3 can be found here:
    http://www.bensmash.net/sample/SM2.swf
    http://www.bensmash.net/sample/SM2.fla
    I appreciate your help!
    -Benjamin

    ejl_70 sorry but is true you need flash cs3 to save in flash 8 in flash cs4 your only save as to flash cs3

  • Specifying package structure and inheritance for jaxb generated classes ??

    Friends,
    Now I am tuned up with the sweet JAXB utility...
    I need answers to this..
    1. How do I specify a package structure in my generated java files?
    2. How do I specify inheritance heirarchy to my generated java files ?
    I assume, there must be some way of doing this, without opening the actuall source.
    any ideas ??
    Thanks
    Rakesh

    how about inheritance heirarchy ? What if i plan to include theses generated classes in my inheritance heirarchy ?
    Bhakti, any idea what is the final version release date ? I desperately need answer to this.
    Thanks
    Rakesh

  • Import and export with oracle 9i

    Hi
    What is best method for to export and impor data from/to text file with oracle 9i,
    I used sql loader in 8i , is there others methods ?
    where can I to find examples ?
    tia

    By taking a look at the user documentation?
    Oracle9i Database Utilities
    C.

  • Very slow CD import (and Backup) with itunes using Windows 7

    I just got a new HP Pavilion Windows 7. It takes hours to import a CD thru itunes - seconds thru any other software. I have uninstalled and reinstalled itunes (all components) multiple times. Apple phone support was no help. Does anyone have any suggestions?
    Thank you

    It's probably something else entirely, but just check under *Edit > Preferences > General > Import Settings* that you don't have a tick in the box marked *Use error correction when reading Audio CDs*.
    <hr>
    *Fast backup for iTunes library (Windows Only)*
    Grab SyncToy 2.1, a free tool from MS. This can be used to copy your entire iTunes library (& other important data folders) onto another hard drive or network share. You can then use SyncToy periodically to synchronise or echo your library to the backup. A preview will show which files need to be updated giving you a chance to spot unexpected changes and during the run only the new or updated files will be copied saving lots of time. And if your media is all organised below the main iTunes folder then you should also be able to open the backup library on any system running the same version of iTunes.
    tt2

  • Import and Export with iPhoto and Raw

    I use PSE10 for AppleMac. 
    How do I export raw photos from iPhoto into PSE10 please, for editing?  I have set my preferences in iPhoto for editing in PSE .  The PSE edit page opens up blank - no raw picture editor or picture appears.  (I can take pictures into the software from picture folders in the usual way and work on them).
    The obverse of this issue is, that  'export' is greyed out, so, even if I complete an edit direct
    from a  folder I cannot export it back to iPhoto.
    Thanks.

    By taking a look at the user documentation?
    Oracle9i Database Utilities
    C.

  • Can FCPX import and work with Pixeomater layers the same way it does with Photoshop layers?

    I meant to type in "Pixelmator" above.

    choose in Pixelmators Export dialog 'Photoshop' as format:
    I frequently use this feature to create with two or three 'layers'  my "3D' animations of the team logos in Motion5 …

  • Import and Syndicate Server Configuration

    Hi All,
    Is it possible to setup the time interval in Import and Syndicator, with specific to one repository.
    For example, if i have one repository, for which the import has to run every 30 mins, and for another if it has to run every 3 mins.
    Is it possibel to do it?.
    Same for syndicator as well?
    Thanks,
    Priya.

    Hello Priya,
    This is possible in MDM 7.1 without PI .
    1. For MDSS, there is a repository level MDSS.ini configuration setting for such a delay
    From the MDM 7.1 Console Reference Guide:"
    Auto Syndication Task Delay= (seconds) .
    Integer.The number of seconds MDSSu2019s automatic syndication task waits after syndicating to all ports associated with the repository. Value copied from the corresponding property in MDM Console
    2. With MDIS it is a bit more complicated as MDIS is able to process in chunks of data.
    Therefore you are able to define the delay between chunks
    From the MDM 7.1 Console Reference Guide:"
    Inter-Chunk Delay= (MS)
    Integer. The number of milliseconds MDIS waits between processing chunks of records to allow other clients access to MDS.
    These are all explained in the Console reference guide.
    I advise you to read the appropriate sections.
    Regards,
    Hedda Cohen.

Maybe you are looking for