Home > Blockchain >  There is no output showing in Eclipse console?
There is no output showing in Eclipse console?

Time:05-22

Im writing a program in Eclipse IDE that reads text from a file and converts the text to a sequence of numbers. The code I've written worked, as I've seen the console output before, but suddenly the console has stopped outputting anything.

Is there a setting I can change to get this working again? Or do you notice as issue with the code that would cause no output in the console?

I'm stuck with this and just want to move past it thank you!

package poetry;

import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;

public class POETRY {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
                
                try {
                    File x = new File("/Users/jordanBendon/Desktop/Cypher/poem.txt");
                    Scanner sc = new Scanner (x);
                    Scanner scnr = new Scanner(x);
                    
                    while(scnr.hasNextLine()) {
                        String lines = scnr.nextLine();
                        
                        char[] stringArray = lines.toCharArray();
                        
                        String result = "";
                        
                          for (int i = 0; i < lines.length(); i  ) {
                            int ascii = lines.codePointAt(i);
                            if ((ascii >= 65 && ascii <= 90) || (ascii >= 97 && ascii <= 122)) {
                              ascii  = 15;
                              result  = Integer.toString(ascii);
                            } else {
                              result  = stringArray[i];
                            }
                          }
                          System.out.println(result);
                        };
                }
                catch (Exception e) {
                    System.out.println("error");
                }
    }
                
    
}

CodePudding user response:

The isn't any problem with code (with assuming that you mentioned path for File x is valid), in the code you printing the result in line System.out.println(result); If your input file is being empty then noting will append to result and for loop will not be triggered consequently nothing will be shown in output console, which it is the case that you currently experiencing it.

CodePudding user response:

As per what I understood, your code is not writing full result on console.

So, I think this might be a problem because of limit console output feature of Eclipse.

follow below solution to increase "console output limit" so that you can get full output on console. solution -> https://stackoverflow.com/a/2828287/19172498

  • Related