Linux version: 2.6
When I used eclipse to develop a program, I found that Chinese characters were garbled and Baidu and Google. As a result, Baidu did not find a solution for half a day, but Google came out. Baidu is really good enough.
Okay, let's go straight into the question. Chinese garbled solutions:
1: windows --> preferences --> General --> workspace --> select other in text file encoding and select GBK. If no GBK is entered, click "Apply"
2: windows --> preferences --> General --> content types --> click Text in the right window and select Java source file. In default encoding [at the bottom of the window, if not, drag the slider to the drop-down menu to view the result. Enter GBK and click OK.
Additional reading:
During Ubuntu installation, Java of the GNU version will be installed at the same time, just like in most Linux releases. This Java is too practical, especially for developers, it is not very useful. Installing Sun Java in Ubuntu is very easy. Step 1:
Sudo apt-Get install sun-java5-jdk
After the installation is complete, select the default Java:
Sudo Update-alternatives -- config Java
Then configure the environment variable:
Sudo Vim/etc/environment
Add the following two lines:
Classpath =/usr/lib/JVM/Java-1.5.0-sun/lib
Java_home =/usr/lib/JVM/Java-1.5.0-sun
Save and exit.
Install and configure eclipse. Installation is simple:
Sudo apt-Get install eclipse
Although the newly installed Java has become the default JVM of the system, eclipse does not use the JVM set by Update-alternative to start itself. Instead, it uses the previous GNU Java. GNU Java is an implementation of 1.4.2, and its performance is far inferior to that of sun. To enable eclipse to start with Sun Java, we need to continue the configuration. First, set Sun Java to the default JDK:
Sudo Update-Java-alternatives-s Java-1.5.0-sun
Then edit the JVM configuration file:
Sudo Vim/etc/JVM
Convert
/Usr/lib/JVM/Java-1.5.0-sun
This line moves to the top of the configuration block. Because eclipse ignores Ubuntu's general Java settings (which looks like a bug), we need to edit the java_home file of Eclipse:
Sudo Vim/etc/Eclipse/java_home
As above
/Usr/lib/JVM/Java-1.5.0-sun
This line moves to the top of the file.
After all the installation and configuration are completed, the Java Development Platform of Ubuntu is basically complete.
Eclipse JVM memory Parameters
Eclipse startup parameters:-vmargs-xms256m-xmx512m
1. The eclipse encoding cannot be changed to GBK.
Solution:
Gedit/var/lib/locales/supported. d/ZH
Add this line:
Zh_cn.gbk GBK
After saving the file and starting eclipse, you can change the encoding to GBK. However, you still need to enter the file manually and cannot select it.
2. Saving Chinese files in eclipse as garbled characters
Solution:
Window --> preferences --> General --> content types --> specify an encoding type for the required file, such as GBK.
3. The. properties file is saved as garbled characters.
Solution:
Download and install the properties editor plug-in, which can be downloaded from here:
Http://propedit.sourceforge.jp