Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: My Jar File Crashing Windows 7

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry My Jar File Crashing Windows 7

    I am a little bit confused. I created an executable jar file from a program I made. My program is around 100K in size, 57K when converted to jar.

    The issue is I sent my program to a couple of friends who were using Windows 7. I made my program using Windows XP, and I made it in Notepad.

    My friends downloaded the program online. They opened it. My first friend, seconds after running my program, had her computer freeze. When she turned it back on Windows wouldn't start and we ended up having to do a system restore.

    My second friend, the program worked fine, but the issue was that when she closed it... she tried going to her Downloads folder, only to find that she could no longer access it. The error message was: "This file does not have a program associated with it for performing this action. Please install a program, or if one is already installed, create an association in the Default Programs control panel".

    I scanned my program with an antivirus and it came out clean.

    I went over my program and checked to see the most "dangerous" operations I could find, which turned out to be simply writing bytes from a file and also reading bytes from a file (a file with a custom extension).

    There was also an invokeLater call. But that's about the most "dangerous" stuff I could find. The rest of my program was basically manipulating my custom classes... working with my Swing GUI components, among other things.

    I am copy pasting the code of the program that executes when the program starts. When it ends it basically saves a bunch of bytes into the same file.

    I don't think I want to paste my whole program or even paste all of the operations that my program does, because it is pretty long and I honestly have no clue why it would cause Windows to crash, or to cause an error (like the Downloads folder one).

    The worst part about this is that I don't really have a computer I can test this error on. It has just happened to two of my friends, I feel hesitant to send it to more lest similar stuff happen.

    Also, I sent this program to a friend using Windows XP and nothing bad happened. Another friend using Windows Vista opened it and ran it fine, without anything bad happening as well.

    If you have any idea what may be going on please let me know. Also... if you have any idea HOW TO GO ABOUT SOLVING THIS please let me know as well... Since right now I am pretty much stuck in "Wow, I can't give this program away anymore unless I fix this issue. But I can't fix this issue because I don't have my own Windows 7 computer that I can test this stuff on."

    Here are some code snippets which is what I remotely assumed could cause a problem, even though I don't know why it should. Also, if you think that manipulating Swing objects or manipulating class variables of custom made classes, or some parsing operations, could cause problems, let me know and I will post some snippets.

    Much help would be appreciated.

    SwingUtilities.invokeLater(new Runnable() {
     
    				public void run() {
    						textarea[index].setCaretPosition(textarea[index].getDocument().getLength());
     
    					}
     
    				});
     
     
    		}



    File file = new File("data.ni1");
     
    		try{
    				boolean success = file.createNewFile();
     
    			}
    			catch(IOException e){}
    File fileToLoad = file;
     
    		byte[] bytes = new byte[1];
     
    		try{
    			InputStream in = new FileInputStream(fileToLoad);
     
    			in.read(bytes);
    			in.close();
     
    		} catch(IOException e){}
     
    //I modify the byte array by subtracting a number from each byte)
    		for(int i = 0; i<bytes.length; i++){
    			bytes[i] = (byte)(bytes[i] - 100);
     
    		}
     
    //I convert the result to UTF 16 string
    String contents = new String(bytes, "UTF-16"));

    Also, if this info helps at all, I downloaded an antivirus and ran a full scan on my system shortly after this happened. It detected 14 spyware files on my computer (in my cookies). However, my jar file itself was still scanned as clean. Of course, I created the jar file before I ran the antivirus so I don't know if remaking the jar file from the same class files would make any difference?
    Last edited by PrinceSendai; January 19th, 2011 at 03:06 PM.


Similar Threads

  1. Problem running .jar in Windows 7
    By SpiceProgrammer in forum Java Theory & Questions
    Replies: 3
    Last Post: December 21st, 2011, 01:28 AM
  2. [SOLVED] Windows Cmd Prompt streams
    By helloworld922 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: November 24th, 2010, 10:00 PM
  3. GUI JAR Image 'tearing' in Windows
    By croe in forum AWT / Java Swing
    Replies: 6
    Last Post: July 3rd, 2010, 07:06 PM
  4. Stream with servlet in windows media
    By migalvcon in forum Java Servlet
    Replies: 0
    Last Post: May 19th, 2010, 05:03 AM
  5. Overlapping windows? in a Jframe?
    By chronoz13 in forum AWT / Java Swing
    Replies: 6
    Last Post: November 21st, 2009, 12:01 PM

Tags for this Thread