Carles Gasques wrote:
Could you attach a stack trace of the error?
This is the line it messes up on only when run as jar:
Error:
java.io.FileNotFoundException: Key.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.util.Scanner.<init>(Unknown Source)
at com.joelchristophel.Key.getKey(Key.java:19)
at com.joelchristophel.Key.<clinit>(Key.java:11)
at com.joelchristophel.Encryptor.<clinit>(Encryptor.java:18)
at com.joelchristophel.EncryptionPanel$3.doInBackground(EncryptionPanel.
java:229)
at com.joelchristophel.EncryptionPanel$3.doInBackground(EncryptionPanel.
java:1)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
EDIT: I solved the problem by instead using this line: