Android Fileread dont read my file but it works on IntelliJ

I need some help with my Anagramm-create app for android in Android-Studio. I intended to get the words from a text file, probably .txt . My problem at the moment is, that the app use the catch block of my Scanner instead of reading the file. If I open it with IntelliJ it works without a problem.

It would be very nice, if somebody can give me a advice to solve the first word problem(class 2).(low priority)

Class 1:

public class library {

private static String[] words = {"Aaaa"};

library() {
    try (Scanner s = new Scanner(new File(System.getProperty("user.dir") + ("/words.txt")))) {
        String[] array = {"AALBESTAND"};
        while (s.hasNext()) {
            array = Arrays.copyOf(array, array.length + 1); //create new array from old array and allocate one more element
            array[array.length - 1] =;
            words = array;
    } catch (FileNotFoundException e) {
        words = Arrays.copyOf(words,words.length+1);

Class 2:

public class words extends AppCompatActivity {

protected void onCreate(Bundle savedInstanceState) {
    final library library = new library();

     * Declaration

    final Button button_check = (Button) findViewById(;
    final Button button_next = (Button) findViewById(;
    final TextView textView = (TextView) findViewById(;
    final RadioButton radioButton1 = (RadioButton) findViewById(;
    final RadioButton radioButton2 = (RadioButton) findViewById(;
    final RadioButton radioButton3 = (RadioButton) findViewById(;
    final RadioButton radioButton4 = (RadioButton) findViewById(;
    final RadioButton radioButton5 = (RadioButton) findViewById(;
    String[] alphabet = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "O", "P", "R", "S", "T", "U"}; // necessary for the first word dont know why

    radioButton1.setText(String.valueOf(alphabet[(int) (Math.random() * 19)]));    // necessary for the first word
    radioButton2.setText(String.valueOf(alphabet[(int) (Math.random() * 19)]));    // necessary for the first word
    radioButton3.setText(String.valueOf(alphabet[(int) (Math.random() * 19)]));    // necessary for the first word
    radioButton4.setText(String.valueOf(alphabet[(int) (Math.random() * 19)]));    // necessary for the first word

     *  new word and reset the buttons and text colour
     *  without using check

    button_next.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            radioButton1.setChecked(false);                 //reset buttons
            radioButton2.setChecked(false);                 //reset buttons
            radioButton3.setChecked(false);                 //reset buttons
            radioButton4.setChecked(false);                 //reset buttons
            radioButton5.setChecked(false);                 //reset buttons

            radioButton1.setTextColor(Color.BLACK);         //textColour = black
            radioButton2.setTextColor(Color.BLACK);         //textColour = black
            radioButton3.setTextColor(Color.BLACK);         //textColour = black
            radioButton4.setTextColor(Color.BLACK);         //textColour = black
            radioButton5.setTextColor(Color.BLACK);         //textColour = black

            textView.clearComposingText();                  //delete old word
            String random = library.randomize();            //create new word
            textView.setText(library.getWord());            //insert new word
            textView.setText(random);                       //dont know why i needed this one, but i am sure i needed it

             * check if the text of multiple choice answers are the same
             * had problems without try catch
            try {
                String rb1 = createValue(random), rb2 = createValue(random), rb3 = createValue(random), rb4 = createValue(random);
                while (rb2.equals(rb1)) rb2 = createValue(random);
                while ((rb3.equals(rb1)) ^ (rb3.equals(rb2))) rb3 = createValue(random);
                while ((rb4.equals(rb1)) ^ (rb4.equals(rb2)) ^ (rb4.equals(rb3)))
                    rb4 = createValue(random);
            } catch (Exception e) {
 * @param word is the searched word
 * @return a letter of the word task
private String createValue(String word) {
    return String.valueOf(word.charAt((int) (word.length() * Math.random())));