First, the problem description: MyEclipse directly using the BEA\JDK142_04 JVM environment, the project log is always played 8 hours slower than the system time, and then directly using System.out.println (new Java.util.Date ()); It really is 8 hours slower than the system in the lower right corner.
Second, the problem-solving solution:
1. Set time zone---before taking the date >>>
TimeZone TZ = Timezone.gettimezone ("etc/gmt-8");
Timezone.setdefault (TZ);
This method is suitable for a single rapid acquisition of system local time
2. Set java command Parameters
Java-duser.timezone=asia/jerusalem datetest
3, set the default time zone for the JVM is East eight (Beijing time)--->>>
in the following four directories (BEA\JDK142_11\JRE\LIB\ZI\ETC, Bea\jdk142_11\jre\lib\zi, bea\jrockit81sp6_142_10\jre\lib\zi\etc, Bea\jrockit81sp6_142_10\jre\lib\zi) find GMT file Bak backup, Then duplicate a copy of GMT-8 and rename it to GMT, copy it, rerun the Java program problem to solve.