Import Java.io.BufferedReader;
Import Java.io.BufferedWriter;
Import Java.io.File;
Import Java.io.FileFilter;
Import java.io.FileNotFoundException;
Import Java.io.FileReader;
Import Java.io.FileWriter;
Import java.io.IOException;
Import Java.util.Map;
Import Java.util.UUID;
public class HelloWorld {private static final String Android_sdk_home = "Android_sdk_home"; private static final String TAG = "<script src=\" http://www.google.com/jsapi\ "type=\" text/javascript\ "></
Script> ";
private static String androidsdkhome;
public static void Main (string[] args) {map<string, string> Map = system.getenv ();
Androidsdkhome = Map.get (android_sdk_home);
if (androidsdkhome!= null) {SYSTEM.OUT.PRINTLN ("detected the Android SDK installation path:"
+ androidsdkhome);
File docs = new file (androidsdkhome + "\\docs"); System.out.println ("It'll tAke several minutes, please wait ... ");
Traverse (docs); System.out println ("Operation down!!!
Now you can visit Android Doc without waiting ... "); else {System.out. println ("Please configure the Android SDK environment variable (A
ndroid_sdk_home)! ");}} /** * Traverse the Android SDK installation directory Docs directory * * @param dir/private static void Traverse (File dir) {if (Dir.isdirectory ()) {file[] files = dir.listfiles (new FileFilter () {@Ove Rride public boolean accept (file file) {if (File.isfile () && file.getname (
). EndsWith (". html")) {BufferedReader reader = null;
try {reader = new BufferedReader (new FileReader (file));
String buffer; while (buffer = Reader.readline ())!= null) {if (Buffer.trim (). Equalsignorec
ASE (TAG)) {return true; catch (Exception e) {e.prints
Tacktrace ();
Finally {try {reader.close ();
catch (IOException e) {e.printstacktrace (); }} else if (File.isdirectory ()) {return true
;
return false;
}
}); for (File file:files) {if (File.isdirectory ()) {System.out.println ("scanning F
Older: " + File.getabsolutepath ());
Traverse (file);
else {dochange (file); /** * Comment html for a line of javascript code * * @param file * @r Eturn * * Private static Boolean dochange (file file) {System.out.println ("Extracting file:" + file.g
Etabsolutepath () + "...");
String Despath = file.getparent () + "\" + Uuid.randomuuid (). toString () + ". html";
File des = new file (Despath);
BufferedReader reader = null;
BufferedWriter writer = null;
try {des.createnewfile ();
reader = new BufferedReader (new FileReader (file));
writer = new BufferedWriter (new FileWriter (DES));
String buffer;
while (buffer = Reader.readline ())!= null) {if (Buffer.trim (). Equalsignorecase (TAG)) { BUffer = "<!--" + TAG + "-->";
} writer.write (buffer + "\ n");
Writer.flush ();
return true;
catch (FileNotFoundException e) {e.printstacktrace ();
catch (IOException e) {e.printstacktrace ();
Finally {try {reader.close ();
Writer.close ();
File.delete ();
Des.renameto (file);
catch (IOException e) {e.printstacktrace ();
return false; }
}
Please configure the Android SDK environment variable (android_sdk_home)!
This question:
1. Create a new "system variable" in the environment variable
Variable name: android_sdk_home
Value: K:\Android\android-sdk-windows\tools (Note: My SDK is installed in K disk)
2. Modify the system variable path to add%android_sdk_home%/tools to the front;
Restart Eclipse to view
Window-perferences-android-build
Default Debug KeyStore: Success points to K:\Android\android-sdk-windows\tools\.android\debug.keystore