I would like to change the default Java icon (the design of the cup). I used the code below in the constructors of JFrames of my system and it worked only when I run the system in Netbeans, but when I generate the executable can not start my program!  setIconImage(Toolkit.getDefaultToolkit().createImage(getClass().getResource("/ICONES/add.png")));
I'm using NetBeans, trying to change the familiar Java coffee cup icon to a png file that I have saved in a resources directory in the jar file.  I've found many different web pages that claim they have a solution, but so far none of them work.  Here's what I have at the moment (leaving out the try-catch block):  URL url = new URL("com/xyz/resources/camera.png"); Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.createImage(url); getFrame().setIconImage(img);   The class that contains this code is in the com.xyz package, if that makes any difference.  That class also extends JFrame.  This code is throwing a MalformedUrlException on the first line.  Anyone have a solution that works?
What countries allow me to pass their borders visa-free?  Am I allowed to visit and work in EU and Schengen countries? calculating mean of a random variable raised to a power Table fixed header and scrollable body Recurrence Inequality Define sequence ${a_n}$ as follows: $a_1 = \frac {1}{2}, 2ka_k = (2k-3)a_{k-1}.$  Show that for any natural number $n, \sum_{k=1}^{n} a_k &lt;1$ (No calculus is allowed).  I'm really just stuck on the right way to approach this. It is sufficient to show that $\sum_{k=1}^{\infty} a_k &lt;1,$ but this isn't a series I am familiar with. I tried defining a partial sum series $b_n$ such that $b_n = \sum_{k=n}^{\infty} a_k,$ but that didn't help to find a non-trivial relationship. Creating lots of random cuts on a surface Here's an image of a cube with lots of edges added. It was created using knife tool and lots of clicking:    What would be the best way to randomly generate such cuts with less effort...? Return matched elements' attribute ar array using jQuery What is "function*" in JavaScript? Singular to plural noun Many nouns that end in ‑f are made plural by changing the ‑f to ‑v‑ and adding ‑es.  +----------+-----------+ | Singular |   Plural  | +----------+-----------+ |  half    |  halves   | |  leaf    |  leaves   | |  shelf   |  shelves  | +----------+-----------+     But some nouns that end in ‑f are made plural simply by adding ‑s.  +----------+-----------+ | Singular |   Plural  | +----------+-----------+ |  chief   |  chiefs   | |  roof    |  roofs    | |  cliff   |  cliffs   | +----------+-----------+   Some nouns that end in ‑f can be made plural in two ways, either by adding ‑s or ‑ves:   +----------+--------------------+ | Singular |      Plural        | +----------+--------------------+ |  scarf   |  scarfs or scarves | |  hoof    |  hoofs or hooves   | |  dwarf   |  dwarfs or dwarves | |  wharf   |  wharfs or wharves | +----------+--------------------+   Now my question is how to determine whether to use only ‑s or to change the ‑f to ‑v‑ and add ‑es? Being an early adopter and using 11.04 daily builds I sometimes meet a situation when some packages require earlier versions of other packages than those I have installed. Usually newer (but refused) versions of needed packages provide all the functionality of their older versions.  If I use dpkg -i --force-depends-version to install dependent packages everything works fine, I've never seen a problem.  Instead of manually downloading and installing every package, can I just make the system pretend there is a specific package version installed when there is a newer? Or is there a --force-depends-version key equivalent for apt-get? display only 3 foreach result per row How to find hydrogen wave-functions? I have found the hydrogen wave functions and would now like to calculate the function that describes the orbitals so that I can plot this function and see how they look.  I don't know how I can do that and it is crazy how I cannot find anything on the subject on the internet as if there was no relation between the wave functions and the orbitals.  Could you please tell me what I need to do to get a function $r(\theta,\phi)$ out of my wave functions $\psi(r,\theta,\phi)$. I am looking for shapefiles or a list of suburb names for Melbourne and Canberra. I have ABS shapefiles, but I need to filter that to end up with only metropolitan suburbs.  My shapefile has codes in it for  - I just need to know which suburbs belong to the metros. Is it possible for a system to have negative potential energy? With respect to both gravity and electromagnetism, to the best of my understanding potential energy is added or subtracted from a system based on the distance between two objects such as charged or massive objects.  Would this then imply that when oppositely charged objects or two massive objects are brought together within a small enough radius that the drop in potential energy would be greater than the combined mass of the two objects making the net mass/energy of the system negative? Solving $f(x+y) = f(x)f(y)f(xy)$ No continuous function switches $\mathbb{Q}$ and the irrationals Why didn't Elizabeth get cursed? In Pirates of the Caribbean, whoever has the Aztec gold gets cursed.  But Elizabeth had the gold coin with her which Bootstrap gave to his son Will before he was tied to a cannon and dropped to the ocean floor.  Barbossa states that they were cursed because of Aztec gold.  Also in the fight between Jack and Barbossa, Jack takes a gold coin and he was also cursed.  Why didn't Elizabeth get affected? Or was she also cursed and nobody noticed? New "[tag:" syntax interferes with Markdown links Links in [link text][number] format don't work properly if they follow a tag using the new [tag:tagName] format. Here's the result of [tag:python] [gold badge page][1]:      [gold badge page]   Putting the tag inside the link is worse. Here's the result of [[meta-tag:bug] some text][2], where [2] is google.com:        The part of the link outside the tag just disappears silently.  EDIT: To be more precise, the entire link to [2] disappears. The markup that is produced contains (invalid) nested anchor tags, as shown here from Firefox's "View Source":  &lt;a href="http://google.com" rel="nofollow"&gt;&lt;a href="/questions/tagged/bug" class="post-tag required-tag" title="show questions tagged 'bug'" rel="tag"&gt;bug&lt;/a&gt; some text&lt;/a&gt;   So the tag is still a link, but it is a link to the tag page, which is the behavior it would have if the link to [2] didn't exist at all. The user's desired behavior in this case is... ambiguous, to be charitable.  EDIT 2: I briefly included markup from Firebug here, but it turned out to be irrelevant. It has now been removed to improve readability. See  if you're interested. Central Moments of Symmetric Distributions I am trying to show that the central moment of a symmetric distribution:     $${\bf f}_x{\bf (a+x)} = {\bf f}_x{\bf(a-x)}$$ is zero for odd numbers. So for instance the third central moment $${\bf E[(X-u)^3] = 0}.$$ I started by trying to show that $${\bf E[(X-u)^3] = E[X^3] -3uE[X^2] + 3u^2E[X] - u^3}.$$ I am not sure where to go from here, any suggestions? Is there a better way to go about proving this? Let $d=GCD(n^2+5,n^3-5n^2+6n)$ show that $d|630$ Prove that $\frac{x_1}{1+x_2+x_3+\ldots+x_n}+\frac{x_2}{1+x_1+x_3+\ldots+x_n}+\ldots+\frac{x_n}{1+x_1+x_2+\ldots+x_{n-1}}\ge\frac{n}{2n-1}$. If $x_1,x_2,\ldots,x_n&gt;0$ and $x_1+x_2+\ldots+x_n=1$, prove that $$\frac{x_1}{1+x_2+x_3+\ldots+x_n} + \frac{x_2}{1+x_1+x_3+\ldots+x_n} +\ldots + \frac{x_n}{1+x_1+x_2+\ldots +x_{n-1}} \ge \frac {n}{2n-1}$$  This can easily be simplified: $$\frac{x_1}{2-x_1} + \frac{x_2}{2-x_2} +\ldots + \frac{x_n}{2-x_n} \ge \frac {n}{2n-1}$$  I could try using the Cauchy-Schwarz inequality: $$\frac{x_1}{2-x_1} + \frac{x_2}{2-x_2} +\ldots + \frac{x_n}{2-x_n} = \frac{x_1^2}{2x_1-x_1^2} + \frac{x_2^2}{2x_2-x_2^2} +\ldots + \frac{x_n^2}{2x_n-x_n^2} \ge \frac{(x_1+x_2+\ldots+x_n)^2}{2(x_1+x_2+\ldots+x_n)-(x_1^2+x_2^2+\ldots+x_n^2)}=\frac{1}{2-(x_1^2+x_2^2+\ldots+x_n^2)}=\frac{n}{2n-(x_1^2+x_2^2+\ldots+x_n^2)n}$$  It's left to prove that $$(x_1^2+x_2^2+\ldots+x_n^2)n \ge 1$$ or $$(x_1^2+x_2^2+\ldots+x_n^2)n=1$$I can continue using the Cauchy-Schwarz inequality again: $$(x_1^2+x_2^2+\ldots+x_n^2)n=(x_1^2+x_2^2+\ldots+x_n^2)(1+1+\ldots+1)\ge(x_1+x_2+\ldots+x_n)^2=1$$ So I've proved it myself. (I've shown this proof after editing, I didn't post the question with the solution in the details. I found the proof a while after putting the question here).