Eclipse Engineering, migration from Linux (Ubuntu) to Windows __linux

Source: Internet
Author: User

Recently, due to the need for work, a previously written Java project needs to be transferred to Linux to run. The system environment is as follows:

Ide:eclipse
linux:ubuntu8.04
Windows:xp

The main steps are as follows:

1 Migration Engineering Code
First, I moved the workspace containing the full project code under XP to Ubuntu.
Note: Windows-enabled eclipse must be turned off during the move;
Directory workspace under the Engineering directory. Metadata also must move together;
Then, install eclipse under Ubuntu:

sudo apt-get install eclipse

Next, open the project file in Ubuntu, file->new->project-> java-> Java preject, select:

Youuser is the user folder in your home directory, Workspace is copied from Windows, MyProject is my engineering directory.
Finally, add the required external package:
Right-click on the project root (the diagram below is a screenshot under Windows, but the Ubuntu interface is similar), select Properties (or Alt-enter):


Find "Java build Path", select the libraries tag, and "Add External JARs ..." In the dot below to choose an external package to import.
At this point, the entire project has been added, you can run a try.

2 Eclipse garbled problem
After running, you will find that the Chinese comments in eclipse are all garbled. At this point, you are in Windows and Ubuntu under the eclipse in the Alt+enter, look inside resources in the "Text file encoding" to know what the problem, the original Windows using the default encoding is GBK, And Ubuntu is the UTF-8. So, if you want to see the Chinese annotation and output in the Java project written in Windows in Ubuntu, you need to set the encoding in Ubuntu to GBK. However, we found that there is no coding format in Ubuntu that we need: GBK, which is not in the "Text file Encoding" other Drop-down menu.
My solution is to type "GBK" directly into the text box in the dropdown box behind the other, and then click Apply, and I find that the Chinese annotation in the code is displayed correctly. It should be noted here that do not randomly choose other coding format, otherwise it will lead to the content of the source code becomes more confusing, Strictly said has been wrong, naturally, and then do my way to do will not get the correct results, at this time should be copied from Windows under a code to come, Then follow the steps above to do it again.

3 What to do if you call a class in the external jar package in your Java code.
When initializing a virtual machine, we use "-djava.class.path=", which is to specify a third-party external jar package. In the following settings, I set the current code path and the three jar packets under the path: Nekohtml.jar,xercesimpl.jar,htmlparser.jar. My setup is as follows:

options[1].optionstring = "-djava.class.path=.:nekohtml.jar:xercesimpl.jar:htmlparser.jar";

Note: They are separated by a colon ":" (before, I was induced by http://public0821.javaeye.com/blog/423941 this article, always using a semicolon ";", resulting in "Find class failed" and cannot find the three external package error)

At this point, the entire code migration work is complete. Good luck!
(I will collect information about this question in: http://download.csdn.net/source/2241229)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.