IDE=runs Jar File=hangs

This topic is 1904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

A program runs fine through the Eclipse IDE but hangs when run through a Jar and JNLP. The Jar has been signed and I've run similar jars through the same process. The problem occurs as shown below using txt msgs to track. INPUT is a file chosen by the user with a file browser. The functions that take INPUT are in jar libraries so I can't get any deeper without massively rearranging the code.

 selectedFile = jfileChooser.getSelectedFile(); final FileConversion task = new FileConversion(selectedFile, txtArea); //Conversion Function FileConversion(File INPUT, JTextArea innerTextArea) { //initialize this.INPUT = INPUT; this.innerTextArea = innerTextArea; } @Override public File doInBackground() { File convertedFile = new File("convertedFile.txt"); int convertstepcounter=0, convertstepcounter2=0; publish( 1 ); IoUtil.assertFileIsReadable(INPUT);//hangs here publish( 2 ); final SAMFileReader reader = new SAMFileReader(INPUT);//or here if above line is disabled. publish ( 3 ); 

Share on other sites
Do you have provided the required permissions on the JNLP descriptor ? Seems like a sandbox permission problem to me. Try running with <all-permissions/> first to pinpoint if it's indeed a security problem.

Share on other sites

Do you have provided the required permissions on the JNLP descriptor ? Seems like a sandbox permission problem to me. Try running with <all-permissions/> first to pinpoint if it's indeed a security problem.

All permissions is already set in the jnlp

Share on other sites
Try to put a try catch block(catching Throwable) encapsulating the method call, this block should call ex.printStackTrace(), sometimes a RuntimeError can lurk and unwind the entire stack.

P.S. Does anything get printed on the Webstart console ?

Share on other sites

Try to put a try catch block(catching Throwable) encapsulating the method call, this block should call ex.printStackTrace(), sometimes a RuntimeError can lurk and unwind the entire stack.

P.S. Does anything get printed on the Webstart console ?

Thanks for your help so far I tried

 try{ publish( 1 ); IoUtil.assertFileIsReadable(INPUT); publish( 2 ); } catch(Throwable ex) { ex.printStackTrace(); } 

in the code posted and I get the same as before...the '1' prints out and then nothing happens. meanwhile its happily chugging on the IDE with the exact same code. I don't know exactly what you mean by the webstart console. After the prompts its just the program thats running.

Share on other sites
Hmmm to turn the console on type on the prompt javaws -viewer, on the last tab there's a node which is called java console. Turn it on and see if something pop on it.

You can also try turning the debugger on the webstart application by using the Java's remote debugging facility. I never had to used it, but I know it is feasible.

Share on other sites

Hmmm to turn the console on type on the prompt javaws -viewer, on the last tab there's a node which is called java console. Turn it on and see if something pop on it.

You can also try turning the debugger on the webstart application by using the Java's remote debugging facility. I never had to used it, but I know it is feasible.

Aite, looks like we have a something here finally...

 java.lang.NoClassDefFoundError: net/sf/picard/io/IoUtil 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) Caused by: java.lang.ClassNotFoundException: net.sf.picard.io.IoUtil at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader\$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) 

I have the relevant jars packed into my jar file I open the net/sf/picard/io/ directory in the jar and I see the classes they're whining about so I don't know why they can't be detected. Edited by Jarwulf

Share on other sites
It's all packed in one jar ?

Share on other sites

It's all packed in one jar ?

Yeah, the supposedly missing classes run fine from the same jar in the IDE so I dunno why it can't detect them anymore once the files are exported in one big jar. Maybe its the manifest file? But I can't tell from the documentation what I'm doing wrong since it autogenerates during the jar export. Edited by Jarwulf

Share on other sites
I've decided it would be easier to simply reference the jars from the jnlp file. It seems to work alright...thanks for your help.

Share on other sites
No problem man, glad to help. Referencing multiples jars on the JNLP is easier and it's best at production level, because the JavaWS will only download jars which have been changed (ok, you could use the jardiff protocol, but it's TCO is higher, as you'd need a servlet container and it's harder to setup).