Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

JApplet URL load ImageIcon

Thread view: 
courtney.schatzman@gmail.com - 08 Aug 2006 21:57 GMT
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?
Andrew Thompson - 08 Aug 2006 23:59 GMT
..
> 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.
courtney.schatzman@gmail.com - 12 Aug 2006 00:11 GMT
Yeah that compiles.
Could I then you use this class in a classLoader to load image?

Thanks,
cschatz

> ..
> > on compilation error msg:
[quoted text clipped - 15 lines]
>
> Andrew T.
Andrew Thompson - 12 Aug 2006 04:04 GMT
Pleasre refrain from top-posting.  See further text 'in-line'.

> > ..
> > > on compilation error msg:
> > >
> > > ImageApp.java:38: cannot find symbol
> > > symbol  : class URL
....
> > Does this compile for you?
> >
[quoted text clipped - 5 lines]
> > }
> > </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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.