public static void main(String[] args) {
args[0] = "derp";
args[1] = "herp";
args[2] = "lerp";
if (args.length < 1) {
System.out.println("what?");
System.exit(-1);
}Twitter twitter = new TwitterFactory().getInstance();
try {
Query query = new Query(args[0]);
QueryResult result;
do {
result = twitter.search(query);
List<Status> tweets = result.getTweets();
for (Status tweet : tweets) {
System.out.println("@" + tweet.getUser().getScreenName() + " - " + tweet.getText());
}
} while ((query = result.nextQuery()) != null);
System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
System.out.println("Failed to search tweets: " + te.getMessage());
System.exit(-1);
}
내가 그나마이 오류가 알고 받고있는 이유 .. 스레드 "주요"java.lang.ArrayIndexOutOfBoundsException의자바 오류 : java.lang.ArrayIndexOutOfBoundsException : 0
예외 : twitter4j.examples에서 0 . search.SearchTweets.main (SearchTweets.java:34)
어떤 매개 변수를 전달 했습니까? – Reimeus
아마 명령 행 인자를 제공하지 않았을 것입니다. 그래서'args'는 길이가 0입니다 ... 존재하지 않는 배열 요소에 값을 저장할 수 없습니다. –