debugging=runs fine normally=fails
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: debugging=runs fine normally=fails

  1. #1
    Join Date
    Jun 2008
    Posts
    32

    debugging=runs fine normally=fails

    I have a java program that seems to work okay when I'm debugging it or running it from the Eclipse IDE. But when I export it into a jar file and run it through a jnlp it hangs at a certain step.

    I'm not exactly sure but I think the problem might be a step when I'm converting a file into a text file.

    Code:
    private File INPUT;
    	private JTextArea innerTextArea;
    
    	    protected boolean rangeArgsProvided = false;
        
         Converter(File INPUT, JTextArea innerTextArea) { 
             //initialize 
        	 this.INPUT = INPUT;
             this.innerTextArea = innerTextArea;
    
         }
        
    @Override
    public File doInBackground() {//replaces doWork
      	File convertedBAM = new File("convertedFile.txt");
    	int convertstepcounter=0, convertstepcounter2=0;
    I'm not specifying any specific location to get or put the file convertedFile.txt in. Its just a variable that will take the converted information and then pass on in a later step and not be used anymore. Is there a possible problem with this or is the hanging likely due to something else?



    PS the jar runs from the Local Settings/Temp Folder in windows. Someone else made it that way.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: debugging=runs fine normally=fails

    It's probably a security manager issue, check out this article http://www.techrepublic.com/article/...andbox/5035300
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Jun 2008
    Posts
    32

    Re: debugging=runs fine normally=fails

    Quote Originally Posted by keang View Post
    It's probably a security manager issue, check out this article http://www.techrepublic.com/article/...andbox/5035300
    I signed my jars and they've run before...

    It 'crashes' as shown below...I put in text statements to pinpoint the position. Can't dig deeper without a lot of extra trouble because doing so would be going into a jar library file.

    INPUT is a file chosen by the user using a file browser.


    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);//crashes here
    publish( 2 );
        final SAMFileReader reader = new SAMFileReader(INPUT);//or here if above line is disabled. 
    publish ( 3 );

  4. #4
    Join Date
    Jun 2008
    Posts
    32

    Re: debugging=runs fine normally=fails

    I also set all permission in the jnlp file and it doesn't help

  5. #5
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: debugging=runs fine normally=fails

    It could be throwing an exception that you're not aware of. You could try putting throw new Exception("see if I can see this"); after publish( 1 ). If you don't see that exception then the problem is that you're not setup so that you can see exceptions when thrown from that piece of code.

  6. #6
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: debugging=runs fine normally=fails

    ...thinking about it, that might not help. Assuming your 'publish' method simply wraps System.out.println. Why not just post an SSCCE?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center