去年安装了myeclipse8.5,也不知道上次注册多长时间了,近几天不能用了,注册码过期了,经常会弹出如下的提示对话框:
相当的恶心。从网上搜了很多注册码都不成功,今天看到一篇文章,自己获取注册码。
步骤:
1.在myeclipse中新建一个java project
2.在src目录下建立一个名为MyEclipseGen的类
3.将下面的代码复制到该类中,并运行。
[html]viewplaincopyprint?
1.importjava.io.*;
2.
3.publicclassMyEclipseGen{
4.privatestaticfinalStringLL="DecompilingthiscopyrightedsoftwareisaviolationofbothyourlicenseagreementandtheDigitalMilleniumCopyrightActof1998(http://www.loc.gov/copyright/legislation/dmca.pdf).Undersection1204oftheDMCA,penaltiesrangeuptoa$500,000fineoruptofiveyearsimprisonmentforafirstoffense.Thinkaboutit;payforalicense,avoidprosecution,andfeelbetteraboutyourself.";
5.
6.publicStringgetSerial(StringuserId,StringlicenseNum){
7.java.util.Calendarcal=java.util.Calendar.getInstance();
8.cal.add(1,3);
9.cal.add(6,-1);
10.java.text.NumberFormatnf=newjava.text.DecimalFormat("000");
11.licenseNum=nf.format(Integer.valueOf(licenseNum));
12.StringverTime=newStringBuilder("-").append(
13.newjava.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))
14..append("0").toString();Stringtype="YE3MP-";
15.Stringneed=newStringBuilder(userId.substring(0,1)).append(type)
16..append("300").append(licenseNum).append(verTime).toString();
17.Stringdx=newStringBuilder(need).append(LL).append(userId)
18..toString();
19.intsuf=this.decode(dx);
20.Stringcode=newStringBuilder(need).append(String.valueOf(suf))
21..toString();
22.returnthis.change(code);}
23.privateintdecode(Strings){
24.inti;
25.char[]ac;
26.intj;
27.intk;
28.i=0;
29.ac=s.toCharArray();
30.j=0;
31.k=ac.length;
32.while(j<k){
33.i=(31*i)+ac[j];
34.j++;}
35.returnMath.abs(i);
36.}
37.privateStringchange(Strings){
38.byte[]abyte0;
39.char[]ac;
40.inti;
41.intk;
42.intj;
43.abyte0=s.getBytes();
44.ac=newchar[s.length()];
45.i=0;
46.k=abyte0.length;
47.while(i<k){
48.j=abyte0[i];
49.if((j>=48)&&(j<=57)){
50.j=(((j-48)+5)%10)+48;
51.}elseif((j>=65)&&(j<=90)){
52.j=(((j-65)+13)%26)+65;
53.}elseif((j>=97)&&(j<=122)){
54.j=(((j-97)+13)%26)+97;
55.}
56.ac[i]=(char)j;
57.i++;
58.}
59.returnString.valueOf(ac);
60.}
61.publicMyEclipseGen(){
62.super();
63.}
64.
65.publicstaticvoidmain(String[]args){
66.try{
67.System.out.println("pleaseinputregistername:");
68.BufferedReaderreader=newBufferedReader(newInputStreamReader(
69.System.in));
70.StringuserId=null;
71.userId=reader.readLine();
72.MyEclipseGenmyeclipsegen=newMyEclipseGen();
73.Stringres=myeclipsegen.getSerial(userId,"20");
74.System.out.println("Serial:"+res);
75.reader.readLine();
76.}catch(IOExceptionex){
77.}
78.}
79.}
4.按照提示输入注册名(自己随便输入即可),然后会自动产生注册码
5.打开“MyEclipse”----“subscriptioninformation”对话框,输入刚才产生的注册码和用户名即可。