zno2

删除恼人注释

当用jd-gui.exe 反编译jar保存成java文件之后,会有许多注释,如下:

/*  1:   */ import java.io.File;
/*  2:   */ import java.io.IOException;
/*  3:   */ import java.io.PrintStream;
/*  4:   */ import java.util.Collection;
/*  5:   */ import org.apache.commons.io.FileUtils;
/*  6:   */ 
/*  7:   */ public class TTTT
/*  8:   */ {
/*  9:   */   public static void main(String[] args1)
/* 10:   */     throws IOException
/* 11:   */   {
/* 12:10 */     File dir = new File("E:/test");
/* 13:   */     
/* 14:   */ 
/* 15:13 */     System.out.println("Start1:\n");
/* 16:   */     String canonicalPath;
/* 17:14 */     if (dir.exists())
/* 18:   */     {
/* 19:15 */       Collection<File> files = FileUtils.listFiles(dir, new String[] { "java" }, true);
/* 20:16 */       for (File file : files)
/* 21:   */       {
/* 22:17 */         canonicalPath = file.getCanonicalPath();
/* 23:18 */         System.out.println(canonicalPath);
/* 24:   */       }
/* 25:   */     }
/* 26:22 */     System.out.println("Start2:\n");
/* 27:23 */     if (dir.exists())
/* 28:   */     {
/* 29:24 */       File[] files = dir.listFiles();
/* 30:   */       File[] arrayOfFile1;
/* 31:25 */       canonicalPath = (arrayOfFile1 = files).length;
/* 32:25 */       for (String str1 = 0; str1 < canonicalPath; str1++)
/* 33:   */       {
/* 34:25 */         File file = arrayOfFile1[str1];
/* 35:26 */         if (file.getName().endsWith(".java"))
/* 36:   */         {
/* 37:27 */           String canonicalPath = file.getCanonicalPath();
/* 38:28 */           System.out.println(canonicalPath);
/* 39:   */         }
/* 40:   */       }
/* 41:   */     }
/* 42:   */   }
/* 43:   */ }



/* Location:           F:\e\workspaceMF_PLO_flex\z-test\target\z-test-0.0.1-SNAPSHOT.jar

 * Qualified Name:     TTTT

 * JD-Core Version:    0.7.0.1

 */

 

如何快速删除它们呢?

这里有两种办法。

办法一:

在eclipse中使用正则表达式匹配,批量替换。

/\*[^/*]*\*/

 

方法二:

在eclipse中使用块选择模式(Block Selection Mode)

快捷键是Alt+Shift+A

块删除即可

posted on 2023-06-01 17:06  zno2  阅读(10)  评论(0编辑  收藏  举报

导航