Like the tile, my Java application does not work, as it works great when developing on Eclipse.
I have finished creating and testing my application on Eclipse. It works fine as I expected. I needed to deploy it as a running jar so that my client could not use it in their system. I made it a running bank by exporting it to Eclipse. When I run the runnable jar, the application starts working normally for a while and stops when reading the file. I had no problems with this code on Eclipse.
The original snippet, which does not seem to work, is as follows.
sfis = new SmbFileInputStream(sFile); in = new BufferedInputStream(sfis); byte buf[] = new byte[(int)sFile.length()]; int pos = 0; int size = 10; int temp; while((size=in.read(buf, pos, size)) > 0){ pos += size; temp = buf.length - pos; if(temp < 10){ size = temp; } }
In Eclipse, this does not cause any problems. It reads data perfectly from the SMB connection and shuts down. But from the jar application, it seems to stop reading from the input stream inside the while loop at some point. This is a very strange case that I have never experienced before. And I can not find a solution for this.
Is it because of my code or jar file that may be incorrectly made by Eclipse?
---------- Additional Information -------------------
With a lot of help from Edmondo1984, I find out where the jar program stops. When it goes to the input stream from SmbFile, a new jcifs.util.transport.Transport stream is created, and the stream is simply blocked, and the application creates another jcifs.util.transport.Transport file, etc. By creating an 8 or 9 jcifs.util.transport.Transport stream, it gets stuck and does nothing.
Same code, same jcifs library. But it works differently between running on Eclipse and the local computer as an executable jar. I have no idea why this is happening.