JApplet URL load ImageIcon

Discussion in 'Java' started by courtney.schatzman@gmail.com, Aug 8, 2006.

  1. Guest

    Hey there, I am new to Java/swing. I have a question on URL exceptions.

    on compilation error msg:

    ImageApp.java:38: cannot find symbol
    symbol : class URL
    location: class ImageApp
    icon = new ImageIcon(new URL("http://aeolus/work/screen.gif"));

    I have the appropriate imports e.i. java.net.URL. I am compiling with
    '-source 1.4' flag.
    The ref. matterial I am using is from java sun SE 1.4.2. I am out of
    ideas as how to
    resolve this exception. Could someone give me an indication on how to
    solve this?
     
    , Aug 8, 2006
    #1
    1. Advertising

  2. wrote:
    ...
    > on compilation error msg:
    >
    > ImageApp.java:38: cannot find symbol
    > symbol : class URL
    > location: class ImageApp
    > icon = new ImageIcon(new URL("http://aeolus/work/screen.gif"));


    Does this compile for you?

    <sscce>
    class URLImport {
    public static void main(String[] args) {
    java.net.URL url;
    }
    }
    </sscce>

    Andrew T.
     
    Andrew Thompson, Aug 8, 2006
    #2
    1. Advertising

  3. Guest

    Yeah that compiles.
    Could I then you use this class in a classLoader to load image?

    Thanks,
    cschatz


    Andrew Thompson wrote:
    > wrote:
    > ..
    > > on compilation error msg:
    > >
    > > ImageApp.java:38: cannot find symbol
    > > symbol : class URL
    > > location: class ImageApp
    > > icon = new ImageIcon(new URL("http://aeolus/work/screen.gif"));

    >
    > Does this compile for you?
    >
    > <sscce>
    > class URLImport {
    > public static void main(String[] args) {
    > java.net.URL url;
    > }
    > }
    > </sscce>
    >
    > Andrew T.
     
    , Aug 12, 2006
    #3
  4. wrote:

    Pleasre refrain from top-posting. See further text 'in-line'.

    > Andrew Thompson wrote:
    > > wrote:
    > > ..
    > > > on compilation error msg:
    > > >
    > > > ImageApp.java:38: cannot find symbol
    > > > symbol : class URL

    .....
    > > Does this compile for you?
    > >
    > > <sscce>
    > > class URLImport {
    > > public static void main(String[] args) {
    > > java.net.URL url;
    > > }
    > > }
    > > </sscce>

    ...
    > Yeah that compiles.
    > Could I then you use this class in a classLoader to load image?


    This code is simply a test. It proves that java.net.URL
    is available on the classpath of the default VM that your
    system is using to compile. It also contradicts the earliest
    statements you made.

    '....on compilation error msg:
    ....cannot find symbol
    symbol : class URL
    .......
    I have the appropriate imports e.i. java.net.URL'

    If the code you originally were referring to, had the
    import (or a fully qualified class name, as I did in the
    example) - it should compile without the 'cannot find symbol'
    message.

    If you cannot fix it from the hints so far, I suggest you
    produce an SSCCE* of code that will not compile, it
    should be less than 30 lines to express a problem like
    this.

    I'll give you odds of 40% that you will be able to spot the
    mistake in the process of making an SSCCE. If not, post
    the SSCCE here and answers should follow quickly.

    * <http://www.physci.org/codes/sscce/>

    HTH

    Andrew T.
     
    Andrew Thompson, Aug 12, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. terry

    JTable ImageIcon

    terry, Aug 5, 2003, in forum: Java
    Replies:
    2
    Views:
    4,088
    Roedy Green
    Aug 6, 2003
  2. Cheok Yan Cheng

    ImageIcon.paintIcon wont work in JApplet

    Cheok Yan Cheng, Aug 13, 2003, in forum: Java
    Replies:
    0
    Views:
    1,770
    Cheok Yan Cheng
    Aug 13, 2003
  3. Phil...

    How to close ImageIcon file

    Phil..., Oct 9, 2003, in forum: Java
    Replies:
    1
    Views:
    508
    William Brogden
    Oct 9, 2003
  4. David

    SplitPanel and ImageIcon

    David, Oct 16, 2003, in forum: Java
    Replies:
    2
    Views:
    489
  5. Paul Lee

    Can't load image into JApplet

    Paul Lee, May 11, 2004, in forum: Java
    Replies:
    1
    Views:
    4,702
    Andrew Thompson
    May 11, 2004
Loading...

Share This Page