Problems fixed during system migration to linux

Source: Internet
Author: User
Some problems fixed during system migration to linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. Several problems encountered during project migration from windows to linux:

1. Path Name:

In windows, the path separator is \, and in linux is/. in the program, you need to use System. getProperty ("file. separator") to obtain the path separator in the environment where the program is located.

2. date conversion:

After obtaining the date value in yyyy-MM-dd format from the form, you need to convert the date type to the date type using DateFormat. getDateInstance (). the date converter obtained when parse (value) is default (default date/time formatters) and cannot be used in linux. The solution is to explicitly specify the converter format:

New SimpleDateFormat ("yyyy-MM-dd"). parse (value)

3. How to obtain the number of bytes:

The getBytes () method of the String class uses the default character of the platform. in linux and windows, the same String gets the byte []. getBytes (String charsetName) should be used) the method uses charsetName to explicitly specify the character set, such as UTF-8 ".

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.