Planetary Nomenclature
Review
You have posted one method for review, but that method has multiple responsibilities.
Good code follows the &quot;Single Responsibility Principle&quot;. Your method does the following things:

it creates a random number generator
it generates a random number
it opens and reads data from a file and then closes it.
it generates another random number
it opens and reads data from another file, and then closes it.
it generates yet another random number
then another
it builds a string value from a number of components.
sets the value of the name field to this string

That is a lot of things happening in one method.
Additionally, your code has a number of magic numbers: 300 star names, 11 Greek letters, 1000 random values, and 4 letters. Each of these values are coded as magic numbers.
The File names are 'magic' too.
In that list, I can see the following bad practices:

two repeated items - selecting a random string from a file

a set method (setName) that does not take a value to set (setters should take a value, not generate a value)

You create a new Random instance each time

you repeatedly open/read/close multiple files.

you throw an IOException on a method which does not have a particularly IO-sounding name.


The above things should all be resolved.....
Alternative
Create a class that generates the names for you. Consider this class:
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Random;


public class PlanetaryGenerator {
    
    private static final class RandomLine {
        private final List&lt;String&gt; lines;
        private final Random random = new Random();

        public RandomLine(String filename) throws IOException {
            this.lines = Files.readAllLines(Paths.get(filename), StandardCharsets.UTF_8);
        }
        
        public String getRandom() {
            return lines.get(random.nextInt(lines.size()));
        }
        
    }

    private static final String[] SUFFIXES = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;};

    private static final int MAXNUMBER = 1000;
    
    private final RandomLine stars;
    private final RandomLine greekletters;
    private final Random random;
    
    public PlanetaryGenerator(String starsfile, String greekfile) throws IOException {
        this.stars = new RandomLine(starsfile);
        this.greekletters = new RandomLine(greekfile);
        this.random = new Random();
    }

    public String generateName() {
        String prefix = stars.getRandom();
        String greek = greekletters.getRandom();
        int number = random.nextInt(MAXNUMBER);
        String suffix = SUFFIXES[random.nextInt(SUFFIXES.length)];

        // append to class name
        return String.format(&quot;%s %s-$d%s&quot;, prefix, greek, number, suffix);

    }
}

Then, in your existing code you can create a single instance of this, and just call it when you need a new name:
static PlanetaryGenerator ....


// get a new name:
String name = generator.generateName();