E
E
Evgeny Petryaev2019-11-06 16:18:06
Java
Evgeny Petryaev, 2019-11-06 16:18:06

runtime error in java?

Example.java

package example;

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.time.LocalDate;
import java.time.ZoneId;
import org.apache.commons.codec.digest.DigestUtils;
import java.util.*;
public class Example {
    public static void main(String[] args) throws Exception {
........................................................................
    GeneratePlaylist g = new GeneratePlaylist();
        g.LoadFromFiles();
    }
}

and GeneratePlaylist.java
package Example;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author User
 */
public class GeneratePlaylist {
    
        public Map<Float, String> music,talk;
        public GeneratePlaylist()
        {
            music = new HashMap<Float, String>();
            talk = new HashMap<Float, String>();
        }
        public void LoadFromFiles()
        {
            try {
            File file = new File("C:\\Users\\User\\source\\repos\\Project1\\Project1\\playlist2.m3u8");
            //создаем объект FileReader для объекта File
            FileReader fr = new FileReader(file);
            //создаем BufferedReader с существующего FileReader для построчного считывания
            BufferedReader reader = new BufferedReader(fr);
            // считаем сначала первую строку
            String str="";
            float length=(float) 0.0;
            String line = reader.readLine();
            while (line != null) {
                str = line;
                line = reader.readLine();
                length = Float.parseFloat(line);
                music.put(length,str);
                System.out.print(line+"\n"+length);
                // считываем остальные строки в цикле
                line = reader.readLine();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        }
}

and I get the error Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: example.GeneratePlaylist
at example.Example.main(Example.java:69)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Евгений Петряев, 2019-11-06
@Gremlin92

Решил заменой большой буквы E на маленькую в package example in GeneratePlaylist.java

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question