如何解决MyEclipse过期问题
当我们启动 MyEclipse 的时候,可能会出现弹框提示,大意是提示您所使用的 MyEclipse 将在一个月内过期,之后这个月的每一天你第一次启动 MyEclipse 的时候都会出现这个提示。那么这个问题改图和解决呢?
1 查看Subscriber信息
打开MyEclipse之后,暂时忽略过期信息,点击工具栏上 MyEclipse -> Subscription Information 可以查看到订阅者(subscriber名字),一般默认为 administrator,还可以查看到当前的序列号(subscription code)XXXXX-XXXXXX-XXXXXXXXXXXX19950 类似的。我们现在所需要的就是将subscriber的值取出来或者记住。如我的就是 administrator。
2 编写代码,生成新的序列号
新建一个带main方法的类,这个完整的类的代码如下:
public class MyEclipseGen {
private static final String LL = "Decompiling this copyrighted software is a violation "
+ "of both your license agreement and the Digital Millenium Copyright Act of 1998 "
+ "(http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the "
+ "DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for "
+ "a first offense. Think about it; pay for a license, avoid prosecution, and feel "
+ "better about yourself.";
public String getSerial(String userId, String licenseNum) {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.add(1, 3);
cal.add(6, -1);
java.text.NumberFormat nf = new java.text.DecimalFormat("000");
licenseNum = nf.format(Integer.valueOf(licenseNum));
String verTime = new StringBuilder("-").append(
new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))
.append("0").toString();
String type = "YE3MP-";
String need = new StringBuilder(userId.substring(0, 1)).append(type)
.append("300").append(licenseNum).append(verTime).toString();
String dx = new StringBuilder(need).append(LL).append(userId)
.toString();
int suf = this.decode(dx);
String code = new StringBuilder(need).append(String.valueOf(suf))
.toString();
return this.change(code);
}
private int decode(String s) {
int i;
char[] ac;
int j;
int k;
i = 0;
ac = s.toCharArray();
j = 0;
k = ac.length;
while (j < k) {
i = (31 * i) + ac[j];
j++;
}
return Math.abs(i);
}
private String change(String s) {
byte[] abyte0;
char[] ac;
int i;
int k;
int j;
abyte0 = s.getBytes();
ac = new char[s.length()];
i = 0;
k = abyte0.length;
while (i < k) {
j = abyte0[i];
if ((j >= 48) && (j <= 57)) {
j = (((j - 48) + 5) % 10) + 48;
} else if ((j >= 65) && (j <= 90)) {
j = (((j - 65) + 13) % 26) + 65;
} else if ((j >= 97) && (j <= 122)) {
j = (((j - 97) + 13) % 26) + 97;
}
ac[i] = (char) j;
i++;
}
return String.valueOf(ac);
}
public MyEclipseGen() {
super();
}
public static void main(String[] args) {
try {
System.out.println("please input register name:");
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String userId = null;
userId = reader.readLine();
MyEclipseGen myeclipsegen = new MyEclipseGen();
String res = myeclipsegen.getSerial(userId, "0");
System.out.println("Serial:" + res);
reader.readLine();
} catch (IOException ex) {
}
}
}
直接运行这个类,在控制台上会提示输入注册名(please input register name),此时我们只需将步骤1中的订阅者的值输入,然后回车就可以了,就会打印出一个新的序列号(Serial)来。
3 取出序列号,更新订阅信息
取出步骤2中的序列号,再打开订阅信息,修改下面的序列号(subscription code),将新生成的序列号填入,然后点击右下方的 finish 就完成了,本序列号的有效期是3年。
备注:我们也可以通过 Subscription Information 查看我们的 MyEclipse 什么时候到期,其中 Subscription expiration date 包含的就是到期时间。