import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RunEclipse {
private static String picFolder = "mysplash";
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
makeFolder(picFolder);
String runString = "eclipse.exe -showsplash ";
runString += picFolder;
runString += "\\";
runString += getShowPictureName(picFolder);
Runtime rt = Runtime.getRuntime();
rt.exec(runString);
}
private static void makeFolder(String folder) {
File file = new File(folder);
if (!file.exists()) {
file.mkdir();
}
}
/**
* @param args
*/
private static String getShowPictureName(String filePath) {
int picCount = 0;
List<String> picList = new ArrayList<String>();
String strRun = "";
File file = new File(filePath);
if (file.isDirectory()) {
String[] filelist = file.list();
for (int i = 0; i < filelist.length; i++) {
if (filelist[i].toLowerCase().endsWith(".bmp")) {
picCount++;
picList.add(filelist[i]);
}
}
if (picCount > 0) {
Random rand = new Random();
int index = rand.nextInt(picCount);
strRun = filelist[index];
}
}
return strRun;
}
}
修改Eclipse启动图片
最新推荐文章于 2020-11-10 09:23:39 发布