error when running java swing application from console I'm working in a Java Swing application and I'm facing a strange error when running the app outside my IDE (i.e. in pre-production). BTW, I'm using Netbeans 8.2.  The application connects to a database and takes the configuration properties from a connection.properties file located in src/main/resources, which, of course, are packaged in the root directory inside the jar.  I am able to compile the application and run it from Netbeans with no problem: The properties are loaded, the connection to the DB is done and the data is being read and updated according to the business logic and so on.  The problem comes when I try to run my app from the console. From there I run  java -jar myapp-1.0.jar   And get the following error  ago 01, 2017 8:41:25 PM ar.edu.unt.jdbc.GestorJdbc loadPropertiesFromFile SEVERE: File not found java.io.FileNotFoundException: file:/path/to/my/app/target/myapp-1.0.jar!/connection.properties (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:138) at ar.edu.unt.jdbc.JdbcManager.loadPropertiesFromFile(JdbcManager.java:216) ... etc   However, the file actually exists. The code from the method is as follows:  public class JdbcManager {      static final String JDBC_DRIVER_PROPERTY = "jdbc.driver";     static final String JDBC_URL_PROPERTY = "jdbc.url";     static final String JDBC_USER_PROPERTY = "jdbc.username";     static final String JDBC_PASSWORD_PROPERTY = "jdbc.password";     String PROPERTIES_FILE_PATH = "connection.properties";      private static final Logger LOGGER = Logger.getLogger(JdbcManager.class.getName());      // This method is being called with PROPERTIES_FILE_PATH as a parameter     // from another method in the same class     Properties loadPropertiesFromFile(String configFilePath) {         ClassLoader classLoader = getClass().getClassLoader();         File configFile = new File(classLoader.getResource(configFilePath).getFile());         Properties properties = new Properties();         try {             properties.load(new FileInputStream(configFile));             LOGGER.log(Level.INFO, "Properties loaded: {0}", properties);         } catch (FileNotFoundException ex) {             LOGGER.log(Level.SEVERE, "File not found", ex);         } catch (IOException ex) {             LOGGER.log(Level.SEVERE, "Error reading file", ex);         }          return properties;     } }   As I said, from Netbeans the file is read correctly. What am I doing wrong here? Thanks in advance for your answers.
Java Swing: Displaying images from within a Jar When running a Java app from eclipse my ImageIcon shows up just fine.  But after creating a jar the path to the image obviously gets screwed up.  Is there a way to extract an image from the jar at runtime so I can then open it up?  Or, is there a better way to do this?  I'd like to distribute a single jar file if possible.
What is the "Wanna Cry" ransomware's possible impact on Linux users? It's just come to light that there's a $300 ransom you have to pay because ransomware targeting Microsoft Windows has encrypted your data. What steps do Linux users need to protect from this if for example they are using wine?  This ransomware is widely reported to be based on a tool developed by the NSA to hack into computers. The NSA tool was used by a hacker group called the Shadow Brokers. The code can be found in .  Microsoft released a patch (MS17-010) against this vulnerability on March 14, 2017. The mass infection is reported to have begun spreading on April 14th. This is discussed .  As I haven't booted Windows 8.1 in 6 to 8 weeks, can I apply this patch from Ubuntu without booting Windows first? (After research it may be possible ClamAV could report the vulnerability from the Linux side looking into Windows partition but it's unlikely it could apply the patch. The best method would be to reboot into Windows and apply patch MS17-010.)  Individuals and small companies who subscribe to Microsoft Automatic Updates are uninfected. Larger organizations who delay apply patches as they are tested against organization intranets are more likely to be infected.  On May 13, 2017, Microsoft took the extraordinary step of releasing a patch for Windows XP which has been unsupported for 3 years.  No word if wine is doing anything about a security update. It was reported in a comment below that Linux can be infected too when users run .  An  registered a domain name that acted as a kill-switch to the ransomware. I presume the non-existent domain was used by the hackers on their private intranet so they didn't infect themselves.  Next time they will be smarter so don't rely on this current kill-switch. Installing the Microsoft patch, which prevents exploiting a vulnerability in the SMBv1 protocol, is the best method.  On May 14, 2017 Red Hat Linux said they are not affected by "Wanna Cry" ransomware. This might mislead Ubuntu users along with Red Hat, CentOS, ArchLinux and Fedora users. Red Hat supports wine which answers below confirm can be effected. In essence Ubuntu and other Linux distro users googling this issue might be mislead by the Red Hat Linux Support answer .  May 15, 2017 Update. Over the last 48 hours Microsoft released patches called KB4012598 for  to protect against "Wanna Cry" ransomware. These Windows versions are no longer on automatic updates. Although I applied security update MS17-010 on my Windows 8.1 platform yesterday, my old Vista Laptop still needs patch KB4012598 downloaded and manually applied.       Moderator note: This question is not off topic - it asks about whether or not any Linux users need to do any steps for protecting against the risk.      It is perfectly on topic here, because it's relevant to Linux (which Ubuntu is), and it's also relevant for Ubuntu users running Wine or similar compatibility layers, or even VMs on their Ubuntu Linux machines. Inform users of certain tags on the existence of a new SE-2.0 site and offer to automatically post the question there instead Take for example  both at SO and SU. Now that there's , (new) users asking a LaTeX question should at least be informed that there is a new Stack Exchange site dedicated to TeX and thus increases their chance of an answer. This should happen before the question is actually posted and ideally offer the option to post the question directly there instead (without the need to copy-paste).  LaTeX is just an example, there's also , ,  etc., and it is obvious that this can only be decided on a case-by-case basis which is why I certainly do not suggest migrating questions automatically when these tags are used. But informing users of that possibility would probably help the SE network in general. Finite group for which $|\{x:x^m=e\}|\leq m$ for all $m$ is cyclic. Let $G$ be a finite group. For each positive integer $m$, if $x^{m}=e$ has at most $m$ solutions in $G$, $G$ is cyclic.   What I have thought is that $n=\sum_{d\mid n}\phi(d)$ can be used to solve this and showing that $|G|$ order element in $G$ exists is enough. Receiving commandline input while listening for connections in Python Cheap/free tool to view/convert Canon CR2 RAW format photo files on Windows? Are there integral solutions to the equation $x^2+y^2-z^2=1$? What is the most bizarre thing you have seen done with TeX I think the questions says it all! :)  By TeX, I mean any derivative of TeX as long as the code is clearly a derivative of TeX, i.e. that it could belong on TeX.SX (and not pure Lua for example).  I'll give two answers myself so you see what I mean. I want to insert text at the top of an already existing file. How can I achieve this. I tried echo and tee but was not successful.  I was trying to insert repo line at the top of sources.list file from terminal.  Note  I need an one line quick solution, because another answer's method was known to me already Constants of integration in integration by parts Cellcolor overwrites partial horizontal lines (\cline) So I need to make a colored table with multirows, together with the use of partial horizontal lines. I used \cline which does not work: the \cellcolor-command overwrites the line.  told me to change it to \hhline which will not be overwritten by \cellcolor. Instead, \hhline overwrites the color.  To make it more clear:  Without color:  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow}  \begin{document}    \begin{tabular}{|c|c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \cline{2-2}  % or \hhline{|~|-|}      &amp; 137\\ \cline{2-2}  % or \hhline{|~|-|}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}     With color: Using \cline  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow}  \begin{document}    \begin{tabular}{|&gt;{\columncolor{red}}c|&gt;{\columncolor{blue}}c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \cline{2-2}      &amp; 137\\ \cline{2-2}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}    Makes the lines in the right column disappear.  Using \hhline  \documentclass{article}  \usepackage{colortbl} \usepackage{multirow} \usepackage{hhline}  \begin{document}    \begin{tabular}{|&gt;{\columncolor{red}}c|&gt;{\columncolor{blue}}c|}     \hline     \bfseries ColumnOne &amp; \bfseries ColumnTwo\\ \hline     First data &amp; 932\\ \hline      &amp; 239\\ \hhline{|~|-|}      &amp; 137\\ \hhline{|~|-|}     \multirow{-3}{*}{More data} &amp; 319\\ \hline     Last data &amp; 132\\ \hline   \end{tabular}  \end{document}    Creates white lines on the left column.  Is there any possible way on how to resolve this? GParted won't let me edit a partition How to change/rewrite the lost password url? I used iThemes Security (formerly Better WP Security) hide back-end functionality to change the login url to /signin however clicking the lost password link /wp-login.php?action=lostpassword now generate a 404  Manually going to /signin?action=lostpassword works.  I came across the following code below which is suppose to make the change to however after some testing it doesn't seem to work  //******************************************************* //Function to change to lost password url //******************************************************** add_filter('site_url',  'wplogin_filter', 10, 3); function wplogin_filter( $url, $path, $orig_scheme ){     $old  = array( "/(wp-login\.php)/");     $new  = array( "signin/"); //this can be change to login or whatever or may remain there     return preg_replace( $old, $new, $url, 1); }   add to .htaccess  RewriteRule ^signin$ wp-login.php   How can i modify the above code in order to change the url for the lost password? Is casting the same thing as converting? In Jesse Liberty's Learning C# book, he says "Objects of one type can be converted into objects of another type. This is called casting."  If you investigate the IL generated from the code below, you can clearly see that the casted assignment isn't doing the same thing as the converted assignment. In the former, you can see the boxing/unboxing occurring; in the latter you can see a call to a convert method.   I know in the end it may be just a silly  semantic difference--but is casting just another word for converting. I don't mean to be snarky, but I'm not interested in anyone's gut feeling on this--opinions don't count here! Can anyone point to a definitive reference that confirms or denies if casting and converting are the same thing?      object x;     int y;      x = 4;      y = ( int )x;      y = Convert.ToInt32( x );   Thank you  rp  Note added after Matt's comment about explicit/implicit:  I don't think implicit/explicit is the difference. In the code I posted, the change is explicit in both cases. An implicit conversion is what occurs when you assign a short to an int.  Note to Sklivvz:  I wanted confirmation that my suspicion of the looseness of Jesse Liberty's (otherwise usually lucid and clear) language was correct. I thought that Jesse Liberty was being a little loose with his language. I understand that casting is routed in object hierarchy--i.e., you can't cast from an integer to a string but you could cast from custom exception derived from System.Exception to a System.Exception.   It's interesting, though, that when you do try to cast from an int to a string the compiler tells you that it couldn't "convert" the value. Maybe Jesse is more correct than I thought! Using crontab to execute script every minute and another every 24 hours Roll a 6-sided die until the total $\geq M$. Mean amount by which $M$ is exceeded? Here is the question:  You roll a fair 6-sided dice iteratively until the sum of the dice rolls is greater than or equal to M. What is the mean and standard deviation of the sum minus M when M=300?  Should I write a code to answer these kind of questions?  Please give me some hints on that. thanks! Apply the latest Service Pack and Cumulative Update How do I boot Windows 8 into Safe Mode? I have Windows 8 Enterprise x64. It's installed a virtual machine. After trying to update VMWare's guest extension it black screened. After resetting it, now the virtual machine won't boot. It just says "automatic repair couldn't repair your PC"   Everything I do ends with an error or it coming back to this screen. If I go to Troubleshoot > Advanced Options > Start up settings and then go to Safe Mode, all it will do is say "preparing automatic repair" and then "diagnosing your PC" and then will come straight back to the "automatic repair couldn't repair your PC" screen. It's as if it doesn't even attempt to go into safe made.   Is there anything else I can do before I reformat? I am trying to ask a question on SE, have some mock data in Excel I've copied, and am simply trying to paste in to my question.  I've done this before dozens of times, but suddenly am having this issue.  However, when I do so, I get prompted to upload an image. (This happens with Ctrl + V and also right click --> Paste):    Am I overlooking something?  Edit: Playing around, I can copy from Firefox/browsers and Word, and paste in to the box as usual. Excel seems to be the only one giving the issue so far.  Edit2:  are still having this issue. It seems that OTP encryption is unbreakable. I have read some articles (Wikipedia, Blogpost, etc.), but I could not find any information about how they are used.  If I wanted to create a messenger service, how would I distribute the OTP keys? Both the sender and the receiver need this key before the message is sent, right?   And how do I make sure no one else gets these keys? How to get the native version of Spotify running? A while ago Spotify (the streaming music service) came out with a preview for Linux of their client.  So what should I do?