Newbie question : import statements

So, i'm a complete java newbie trying to make his first swing application, a basic calc. I download NetBeans 6.5, install it, and begin to code. I quickly learn about the Matisse GUI editor, find it very easy to use, and in a couple hours, the work is done and runs very fine.
But looking at my code, I realize I have forgotten all import statements (like import javax.swing, import java.awt.event ....), nevertheless the application runs fine. I suppose then that the Netbeans compiler automatically corrects my mistakes, but I want to do it right.
So, I write the import statements explicitly in my code and I get a warning message : "import unused". After that, I find out about the "fix import" tool in Netbeans, use it and all my import statements disappear. I guess i'm missing something here.
I thought import of swing classes were mandatory to write a swing application. I have NO import statement in my code, even if I'm using jFrames, jButtons, event handlers and the program works fine, why ?
Would I be able to compile this importless code in another environment (let's say Eclipse or even javac) ?
I'm using JDK 1.6 and Netbeans 6.5 with Windows XP.
TIA

glawen wrote:
Ok, thanks for the answers, and sorry for my misinterpretation of BigDaddyLoveHandles's first post. I understand now, the import statements are useful only if you don't want to write full class names, and the generated code uses full class names so no import needed.Please also understand BigDaddyLoveHandles's latest post. If you learn to code Swing with NetBeans' Matisse, then you will be learning Matisse, not Swing. When it comes time to try to tweak or upgrade your program, you will be lost. Better is to learn Swing from the ground up by going through the Sun Swing tutorials. Though having said that, if you are very new to the language, better still is to learn the fundamentals of Java first before embarking in the murky waters of GUI programming. Best of luck to you in your endeavors.

Similar Messages

  • NewBee question - Import statements

    Hi,
    I am new to Bea workshop.
    Can someone help me out in how to add my own Import statements in Java classes
    created in workshop.
    Thanks and Regards,
    Nikita

    Hi Nikita,
    Welcome to Workshop!
    The JWS classes used in Workshop are essentially Java classes with the
    additional capability to understand the JWS metatags in the comments.
    Hence you can use the import statements in the same manner as you use in a
    normal Java class.
    Please do let us know if you have any further queries.
    Regards,
    Anurag
    Workshop Support
    "Nitika" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    I am new to Bea workshop.
    Can someone help me out in how to add my own Import statements inJava classes
    created in workshop.
    Thanks and Regards,
    Nikita

  • Newbie Question: Importing (from PC) and Organizing Photos in iPhoto

    Hi everyone,
    I am currently a PC user and am contemplating buying an iMac, and I'm trying to determine if iPhoto will meet my needs for photo importing and organization.
    I currently have around 20-30 gigs of digital photos and am using Windows Photo Gallery (for Windows Vista) to view/organize/import them.
    The directories are organized by the photo date taken in the format "yyyy-mm-dd" .
    Some of these directories are appended with an event name if applicable, i.e. "2011-12-25_Christmas Party" while others will only have the date, i.e. "2011-12-20"
    My photos are named according to date/time taken so that a file listing will display the photos in chronologic order. Again, some of these will be appended with an event name or other descriptive label. So, many photos will look like this: "yyyy-mm-dd_hh-mm-ss" while others will look like this: "yyyy-mm-dd_hh-mm-ss_event name"
    A possible complicating factor in all of this is that some of the photos were taken with a camera where the time/date was not set properly, or with cameras whose date/times were set for a different time zone. I adjusted this within Windows Photo Gallery, but I am not sure if it permanently changed the date/time in the photo file's properties... I've seen some evidence that it may not have. I did make sure that the file name was named according to the correct date/time in every case, however.
    Now, here are my questions about using iPhoto:
    1) When I initially import my photos into iPhoto, will iPhoto recognize (or is there a way to make it recognize) each separate directory as a separate event based on the directory in which it is found?
    2) If I copy photos into iPhoto library, will it respect and preserve my directory structure wherein photos are separated by date taken? If not, then is it practical to still use iPhoto without copying the files into its library (by keeping them organized as subdirectories in a directory elsewhere and having iPhoto setup to automatically display photos in that directory)?
    3) If I use iPhoto to import pictures from a digital camera, can I control how it sorts those pictures into directories by making it name the directories in yyyy-mm-dd format? This is what Windows does and I find that format very convenient for organizing and viewing photo files, especially those that I have not yet tagged.
    4) Again, if I use iPhoto to import pictures from a digital camera, can I control the naming convention so that photos are named according to date&time taken (i.e. yyyy-mm-dd_hh-mm-ss ), or at least according to just date taken (i.e. yyyy-mm-dd) as well as appended with event names?
    5) Will I be able to edit photo properties, such as date taken, within iPhoto if I discover that a photo is incorrectly organized?
    Thanks in advance,
    JB

    Here's the thing: You've put a lot of time developing a system of managing files. iPhoto is all about Photos. So, frankly. forget your current system and use iPhoto. it has more powerful and more varied tools for managing your snaps.
    There's a conceptual leap to be made with apps like iPhoto. The illustration I use is as follows: In my iTunes Library I have a file called 'Let_it_Be_The_Beatles.mp3'. So what is that, exactly? It's not the song. The Beatles never wrote an mp3. They wrote a tune and lyrics. They recorded it and a copy of that recording is stored in the mp3 file. So the file is just a container for the recording. That container is designed in a specific way attuned to the characteristics and requirements of the data. Hence, mp3.
    Similarly, that Jpeg is not your photo, it's a container designed to hold that kind of data. iPhoto is all about the data and not about the container. So, regardless of where you choose to store the file, iPhoto will manage the photo, edit the photo, add metadata to the Photo but never touch the file. If you choose to export - unless you specifically choose to export the original - iPhoto will export the Photo into a new container - a new file containing the photo.
    All of your queries are about files and filenames and file storage. They're all pretty much moot if you use iPhoto. If you use iPhoto it becomes the "go-to" app for all your photos. Everything you need to do with the photos can be done via iPhoto or with iPhoto.
    When I initially import my photos into iPhoto, will iPhoto recognize (or is there a way to make it recognize) each separate directory as a separate event based on the directory in which it is found?
    Yes, but...  Events are organisation for those who can't really be bothered. They are automatic - based entirely on Date and Time the camera records the photos as taken. You can move photos between Events, you can Merge Events, you can Rename them and sort them in various ways except one: You cannot manually sort in an Event as Events are all automated.
    Albums are a much more varied and powerful organising tool.
    2) If I copy photos into iPhoto library, will it respect and preserve my directory structure wherein photos are separated by date taken?
    Well forget about "directories", you're talking Events, Album and Folders now. But yes, you can define Events (or Albums) based on date. However, given that iPhoto can sort on date, can search on date and date ranges and can generate Smart Albums based on date (say, All the Photos from 2010, only the photos from June 2010 or just the photos fron June 10, 2010, or even the photos from May 12 2009 to July 11 2010) how the fies are organised on the disk is of little concern. You never access them via the HD anyway.
    If not, then is it practical to still use iPhoto without copying the files into its library (by keeping them organized as subdirectories in a directory elsewhere and having iPhoto setup to automatically display photos in that directory)?
    Yes you can do this. It's called a Referenced Library. I don't recommend it - especially for a new Mac user - and it adds nothing except complexity to the process. It has no extra capability. It's just dumb file storage. For more on this:
    https://discussions.apple.com/thread/3062728?tstart=0
    3) If I use iPhoto to import pictures from a digital camera, can I control how it sorts those pictures into directories by making it name the directories in yyyy-mm-dd format?
    No.
    This is what Windows does and I find that format very convenient for organizing and viewing photo files, especially those that I have not yet tagged.
    There are various tools in iPhoto that will allow you to find photos that you have not yet tagged or organised.
    Again, if I use iPhoto to import pictures from a digital camera, can I control the naming convention so that photos are named according to date&time taken (i.e. yyyy-mm-dd_hh-mm-ss ), or at least according to just date taken (i.e. yyyy-mm-dd) as well as appended with event names?
    You can add titles to photos, yes. But as the date and time of the photo are already in the Exif, using those in the name of the photo is a bit redundant.
    Will I be able to edit photo properties, such as date taken, within iPhoto if I discover that a photo is incorrectly organized?
    Yes.
    It's a bit to take in I know, and I always suggest to people that the best thing is to create a library on their Mac, import a couple of hndred pics and explore what it does (and doesn't), and see if it works for you.
    iPhoto uses a lot of virtualisation. Photos are stored in the Library. (Events are just one of two possible views of the Library). Albums reference photos in the Library. So a shot can be in any number of albums and use no extra disk space. Keywording is also very powerful. Here’s a stock answer I use for folks when wondering what iPhoto can do:
    I use Events simply as big buckets of Photos: Spring 08, July - Nov 06 are typical Events in my Library. I use keywords and Smart Albums extensively. I title the pics broadly.
    I keyword on a
    Who
    What
    Where basis (The When is in the photos's Exif metadata). I also rate the pics on a 1 - 5 star basis.
    Using this system I can find pretty much find any pic in my 40k library in a couple of seconds.
    So, for example, I have a batch of pics titled 'Seattle 08' and a  typical keywording might include: John, Anne, Landscape, mountain, trees, snow. With a rating included it's so very easy to find the best pics we took at Mount Rainier.
    File -> New Smart Album
    set it to 'All"
    title contains Seattle
    keyword is mountain
    keyword is snow
    rating is 5 stars
    Or, want a chronological album of John from birth to today?
    New Smart Album
    Keyword is John
    Set the View options to Sort By Date Ascending
    Want only the best pics?
    add Rating is greater than 4 stars
    The best thing about this system is that it's dynamic. If I add 50 more pics of John  to the Library tomorrow, as I keyword and rate them they are added to the Smart Album.
    In the end, organisation is about finding the pics. The point is to make locating that pic or batch of pics findable fast. This system works for me.
    Finally, all of this can be exported from iPhoto should you decide to migrate to a different app or different OS in a year or two.
    Regards
    TD

  • Newbie ?: import statement

    import java.awt.*
    import java.applet.*
    Are these just like the
    #include
    statements in C++?

    Yes, it is.
    java.awt.* and java.applet.* are packages that you are importing.

  • Newbie Question, OR statement for GET requests

    I apologize but I am not sure what to google to get the information I need. Typing OR is google in useless :(.
    Is there a way to use OR statements in HTTP requests? For example, I am making a call to a web service like this:
    http://services.myintranet.net/program?xml=1&name=von+w
    Is there a way to specify an alternative for name, like
    http://services.myintranet.net/program?xml=1&name=von+wORKEYWORDname=w+von

    If I understand you well: there is no predefined OR token in the query string the HTTP protocol would be aware of.
    You have to choose the logical operator which is expected by the service processing your URL. This could be simply "OR" or the escaped sequence of "||" or even a blank - which would escape to "+" - when specified this way.
    Search Engines as Google use the following:
    http://...?as_q=client+server&... is to look for pages with words "client" and "server"
    http://...?...&as_oq=client+server&... is to look for pages with words "client" or "server"
    So the small "o" mkes the difference and is interpreted at server side.

  • Newbie question - import jpeg convert to objects

    I have a manuscript in pen and ink.  It uses two cartoon characters and contains bubble text and drawings.  I had the content scanned and converted to a pdf file.  This was then converted to jpeg files, one for each page.  I want to edit these files in Illustrator by creating objects from the images on the page.  I have not been able to see how to do this.  First, is there a way to do this?  Second, if you could point me in the right direction it would be really helpful.    

    try Live Trace. and then try each
    preset. you will see this when you import a raster image I believe.
    You can then expand to seperate all objects.
    Curt

  • Import statement question

    what's the difference between
    import java.util.Vector;
    and
    import java.util.*;
    is there any difference in bytecode generated? or time takes to compile?
    what's the best practice?

    Yes there is a best practice, it's the one you mentioned. Use the more specific import statement. If you're only using one or two classes from a package, explicitly name them in the import statements. That way somebody else reading your code (which includes yourself, six months later) can immediately get a better understanding of your code.
    If this rule is followed, and you see this as the first line of a source file:
    import java.util.StringTokenizer;
    then you know the StringTokenizer is being used. But if you saw this:
    import java.util.*;
    you wouldn't know which one is being used until you're deep in the code.
    Knowing right away whether a class is tokening a string, versus say using collections, makes it a lot easier to read.
    You should only use the whole-package include if you're importing a really big part of the package. For example:
    import java.awt.*;
    is probably OK because it's relatively unlikely a person will use only a couple classes from that package.

  • Some questions on import statements.

    When I see
    import java.awt.*
    import java.awt.event.*
    am I on track interpreting this to mean that you want to be able to use any of the classes found in package java.awt?
    why would import java.awt.event.* be necessary if event is a class in the java.awt.* package you're importing in the second import statement up above?
    does * mean like a "wildcard" which allows you to utilize
    anything that is part of java.awt?

    It allows you to use any of the classes in that directory, but not any classes in sub-directories of that directory.

  • Question about import statements

    Why is it that I must have the import statement on the
    same frame
    and same layer
    as the AS code that utilizes the Class that I am importing?
    At least that is how it appears.

    Because that is how it works.
    Remember, import doesn't actually "import" anything. It is
    just a shortcut so you don't have to type the whole package name
    every time you use the coded in your example.
    It is actually kind of nice when you come back to code later
    or if you open somebody else's code (that you have to update or
    change) and to see at the top, "Oh, this bit of code has a reliance
    on class blah.blah.Yadda." In a way it kind of helps enforce a bit
    of good coding practice.

  • Import statement and directory structure

    First of all, sorry for such a long post, I believe part of it is because I am unsure of the concept of importing in Java. Secondly, Thanks to anyone who can ultimately enlighten me to the concept of import. I did ask this question before in the "erorr and error handling" forum, and the people who have helped me there did a great job. But, I believe I require a little more clarification and thus have decided to post here.
    Anyhow, my question..
    Could someone explain to me the concept of the import statement, or direct me to a webpage with sort of explanation for newbies? For some reason, I am having a hard time grasping the concept.
    As I understand it, the import statement in Java, is very similar to the namespace keyword in C. That is to say, import doesn't actually "import" any source code, the way that the #include statement does in C.
    So I suppose what my question is, say I have a java class file like below:
    //filename: sentence.java
    //located: c:\school\csc365
    package csc365;
    class sentence
    //some variables here..
    //some constructor here..
    //some methods here..
    And some sample program like the one below which implements the above..
    //filename: test.java
    //located: c:\school\csc365
    import csc365.*;
    import java.io.*;
    class test.java
    //creates some sentence object
    //uses the object's methods
    //some other things.
    As I understand it, the test.java file should not compile because the csc365 package is not in the correct directory. (assuming of course, the classpath is like c:\school\csc365;c:\school )
    But, ... where then should the sentence.java be located? In a subdirectory of c:\school called csc365 (i.e c:\school\csc365\) ?
    And thus that would mean the test.java file could be located anywhere on the hard drive?
    I suppose, I just need a little clarification on the correlation between a package's "name" (i.e package csc365; ) and its corresponding directory's name, and also how the javac compiler searches the classpath for java classes.
    ..So, theoretically if I were to set the classpath to look in every conceivable directory(provided the directory names were all unique) of the harddrive, then I could compile a test.java anywhere?
    As a note: I have been able to get the test.java file to compile, by leaving out the import statement in the test.java file, and also leaving out the package statement for the sentence class, but I assume this is because the files are defaulted to the same package?

    Hi Mary,
    No, import isn't analogous to C++ namespace - Java package is closer to the namespace mark.
    import is just a convenience for the programmer. You can go your whole Java career without ever writing an import statement if you wish. All that means is that you'll have to type out the fully-resolved class name every time you want to use a class that's in a package other than java.lang. Example:
    // NOTE: No import statements
    public class Family
       // NOTE: fully-resolved class names
       private java.util.List children = new java.util.ArrayList();
    }If you use the import statement, you can save yourself from typing:
    import java.util.ArrayList;
    import java.util.List;
    public class Family
       // NOTE: fully-resolved class names
       private List children = new ArrayList();
    }import isn't the same as class loader. It does not bring in any source code at all.
    import comes into play when you're compiling or running your code. Java will check to make sure that any "shorthand" class names you give it live in one of the packages you've imported. If it can't find a matching fully-resolved class name, it'll give you a message like "Symbol not found" or something like that.
    I arrange Java source in a directory structure that matches the package structure in the .class files.
    If I've got a Java source file like this:
    package foo.bar;
    public class Baz
       public static void main(String [] args)
            Baz baz = new Baz();
            System.out.println(baz);
       public String toString()
           return "I am a Baz";
    }I'll store it in a directory structure like this:
    root
    +---classes
    +---src
          +---foo
               +---bar
                    +---Baz.javaWhen I compile, I go to root and compile by typing this:
    javac -d classes foo/bar/*.javaI can run the code from root by typing:
    java -classpath classes foo.bar.BazI hope this wasn't patronizing or beneath you. I don't mean to be insulting. - MOD

  • Import statement is not working

    hi everybody,
    I have a directory under which I have a number of sub-directories. Lets call this directory "parent_directory". under this directory I have another directory called "child_1". Under "child_1" I have another subdirectory called "child_2". Now I have a code in child_2 that has the following statement:
    import program_1;
    //this is a program present in the parent directory. lets call it
    //program_1.java
    when I am compiling I am getting an error saying:
    program_2.java:28: '.' expected
    import program_1;
    ^
    1 error
    program_2.java is the program present in child_2 in which I have included the import statement.
    If I change the ";" to "." then again error appears as the import statement only needs the name of the class and doesnot need the extension.
    I will be very grateful to you if you could please suggest me a way around this.

    This questions belongs in the "New to Java" forum ...
    sigh
    Anyways, import works on package names with trailing * or full qualified class names, e.g.import mypackage1.*; // imports all classes in mypackage1
    import mypackage2.MyClass2; // imports MyClass2 from mypackage2So instead of import program_1; you need to do
    1. ensure that program_1 is in some package
    2. ensure that your directory structure mirrors your package structure (same names!)
    3. ensure that your CLASSPATH is either not set at all or points to the parent dir of your topmost package
    Example:
    Directory structure:C:\tmp\java\top\
    C:\tmp\java\top\MyClass1.java
    C:\tmp\java\top\bottom\
    C:\tmp\java\top\bottom\MyClass2.java
    CLASSPATH=".;<java install dir>\jre\lib\rt.jar;C:\tmp\java"Source for MyClass1.java:package top;
    public class MyClass1 {
    }Source for MyClass2.java:package top.bottom;
    import top.MyClass1;
    public class MyClass2 {
      private MyClass1 myClass1;
    }

  • Unused packages in import statement

    Guyz,
    Can anyone throw some light on this ?
    Does using a lot of unused packages in import statement of a jsp affects its performance in terms of page loading ?
    Thanks.

    I have just found the answer for my question in another forum.
    Please visit:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=15&t=000240
    Thanks.

  • Confused about CLASSPATH and how java handles import statements...

    Hello,
    I must admit I don't get it. I read the articles about setting CLASSPATH etc. but I still wonder:
    If you use an import statement, what does the compiler do? I.e. where does it look for the specified classes? I find it confusing because I see in different locations different .jar files:
    C:\jdk1.3.1_03\lib\dt.jar
    C:\jdk1.3.1_03\lib\htmlconvertor.jar
    C:\jdk1.3.1_03\lib\tools.jar
    and also
    C:\jdk1.3.1_03\jre\lib\i18n.jar
    C:\jdk1.3.1_03\jre\lib\rt.jar
    C:\jdk1.3.1_03\jre\lib\jaws.jar
    C:\jdk1.3.1_03\jre\lib\sunrassign.jar
    Can someone explain me what the purpose is of these files?
    And why do I have the same contents in
    C:\Program Files\JavaSoft\JRE\1.3.1_03\lib
    and in
    C:\jdk1.3.1_03\jre\lib
    Why is that?
    Thanks for answering my questions!
    -mike

    Thanx for the answers, but I still wonder, everyone
    here says I need to set the classpath, but I don't.Probably because your classes are already in the class path. The compiler/jvm also look for classes by themselves not just in jar files, when just a directory is supplied in the class path. And a period (".") is a valid directory.
    Programs importing different classes compile with no
    problem. So what's up with that?
    Presumably you are referring to your own code - because they are in the class path.
    Second, I still don't understand why the runtime needs
    the .jar files. The runtime uses classes, like String, that have to come from somewhere.
    This would also mean that end-users
    need to set the classpath to the .jar files in their
    JRE directory to be able to run programs that import
    classes from these .jars. But this is not true, right?No it is true. The end-users will have to set the class path. There are variations on this which make it seem like no class path is set. For instance applets in a browser are java but the end-user does not need to set a class path. That is because the browser knows how to download classes/jars and how to set it up so it uses them. (Actually it uses a class loader, but that is probably more information that you need.)
    Because if I make some nice classes myself and import
    them, how can I expect my end-user to install these
    classes and make a classpath for them?That would be between you and you end-user.
    First installation is not part of java. For installation you will have to find something outside of java to accomplish the goal.
    Additionally how the class path gets set is OS specific. Java does not deal with that. You will also have to find some way to deal with this (most likely part of the installation.)
    There are also variations on this. For example the browser example I gave above. Or using the ext directory. Or creating an executable jar. Or simply setting the class path.
    In my understanding it should only be needed in the JDK, not
    in the JRE. True or am I mistaken?Mistaken. The class path is needed in the JRE as well. You will need to set it.

  • What is import statement for ?

    Hi all,
    Sorry for asking a silly question. Since it is a new to java forum I am asking this.
    What is happening when an import statement is triggered at compile time and at runtime.
    What is the difference/advantages/disadvantages between importing an entire package and importing required classes only.
    Is there any size limit on the generated class file.
    rgds
    Antony Paul

    looks like we are both beguinners
    i just received a newsletter from sun and in it has this
    MONITORING CLASS LOADING AND GARBAGE COLLECTION
    Have you ever wondered what classes are loaded when you launch an application or from where the classes are loaded? Have you ever wondered when garbage collection runs or how long it takes? The java command line tool offers several different command line options that you can use to get answers to those questions.
    You might already be familiar with a number of command line options available with the java command line tool, such as -cp, -Xms, and -Xmx. The -cp option is used for specifying the classpath. The -Xms and -Xmx options are used to specify the heap size. For example, instead of setting the CLASSPATH environment variable, you can use the -cp option to tell the system to look in a specific directory for necessary class files:
    java -cp ExampleDir MyExample
    Here, the system will look in the ExampleDir subdirectory for the MyExample.class file and anything else needed besides the system classes. The ExampleDir in the command line tells the system to look only in the ExampleDir directory (assume that it's the parent directory). If MyExample.class is located in the current working directory, the system would not find it.
    Two less frequently used command line features report on class loading and garbage collection. The -verbose:class option reports when a class is loaded into the Java virtual machine and from where it came. For instance, if you use the -verbose:class option when loading the SwingSet2 demo that comes with the J2SE 1.4.2 SDK, you get a report on the many different classes that are loaded as part of the demo, such the following two:
    java -verbose:class -jar
    C:\j2sdk1.4.2\demo\jfc\SwingSet2\SwingSet2.jar
    [Loaded FilePreviewer]
    [Loaded javax.swing.plaf.TableUI from
         C:\j2sdk1.4.2\jre\lib\rt.jar]
    The first line indicates that the class came from the main JAR for the demo (assuming it was started with java -jar SwingSet2.jar). The second line indicates that the TableUI class was loaded from the rt.jar file that comes with the runtime located in the c:\j2sdk1.4.2\jre directory. (From there, the rt.jar file is located in the lib subdirectory.) Different implementations of the Java platform can have different formats here. The only requirement is that -verbose:class displays messages as classes get loaded and unloaded.
    Let's see when classes are loaded, and how many classes are needed for the following simple program:
    public class Sample {
    public static void main(String args[]) {
    System.out.println("Hello, World");
    Compile the Sample class. Then run it with the -verbose:class option enabled:
    java -verbose:class Sample
    When you run the command, you'll see that this simple program requires the opening of five jar files (such as rt.jar) and the loading of almost 250 classes.
    To see an example of a class unloading message, try the -verbose:class command line option with the RunItReload class shown in the August 19, 2003 Tech Tip titled Unloading and Reloading Classes.
    The -verbose:gc option reports on each garbage collection event. This includes the time for garbage collection to run, and the before and after heap sizes. This is demonstrated in the following lines:
    [GC 27872K->26296K(42216K), 0.0069590 secs]
    [GC 28973K->26455K(42216K), 0.0036812 secs]
    [GC 29134K->26474K(42216K), 0.0016388 secs]
    [GC 29117K->26487K(42216K), 0.0008859 secs]
    [GC 29134K->26498K(42216K), 0.0009197 secs]
    [GC 29180K->26479K(42216K), 0.0008711 secs]
    [GC 29149K->26484K(42216K), 0.0008716 secs]
    Like the output for -verbose:class, there is no requirement for output format, and it is subject to change without notice. The "GC" at the beginning indicates what kind of collection occurred. The number before the "->" is the heap occupancy before the collection. The number after the "->" is the heap occupancy after the collection. The number in parentheses is the currently allocated size of the heap. The seconds are the duration of the collection.
    This information can be useful in debugging. For example, it could help you determine if garbage collection happened at a critical point in time, and might have caused a program to crash. This sometimes happens when mixing Java and C/C++ code with JNI, especially when there is an underlying bug on the C/C++ code side.
    If you're ever curious about why it takes so long for an application to start, or if garbage collection in the middle of an operation appears to cause a problem, be sure to try out these command line options.
    hope it helps

  • Using Import Statement

    Hi,
    I understand that in order to access the methods of a different class, I can "import" it. Here is my question though:
    Where am I importing it from? I mean, surely if I am importing a class from e.g. the Java.util package, doesn't this package need to be on my computer somewhere?
    And also, if I make a .jar file of my application for use on another computer and the files contain import statements, doesn't the other computer need to have these packages on their machine?
    I know this seems like a silly question but it's bothering me!
    GF

    Yep, you can unzip them to see inside. The package name unzips into a directory structure and the Class name is a file. So java.util.HashMap will unzip into a directory java/util and have a file called HashMap.class in it.
    You can usually download the source code for these classes also.

Maybe you are looking for