Java source program compilation and execution issues

Source: Internet
Author: User

When writing Java programs, encountered the problem of compilation does not pass:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/76/41/wKioL1ZN-S6BqxuIAAA6y8lBz9U338.png "title=" 2015-11-20_002836.png "alt=" Wkiol1zn-s6bqxuiaaa6y8lbz9u338.png "/>

The error message displays GBK, which may be caused by a problem with the character set:


An option-encoding Utf-8 was specified for the Java command before the compilation was successful ^_^

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/76/41/wKioL1ZN-ffi6pTzAAAgbEZC3PY836.png "title=" 2015-11-20_003102.png "alt=" Wkiol1zn-ffi6ptzaaagbezc3py836.png "/>

However, when you execute with the Javac command, you encounter a problem that causes the execution to fail:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/76/41/wKioL1ZN-m_yEtN_AAAoICh8k5c353.png "title=" 2015-11-20_003424.png "alt=" Wkiol1zn-m_yetn_aaaoich8k5c353.png "/>

Package lee;/** *description: *<br> website: <a href= "http://www.123.org" >123</a> *<br>copyright (C ), 2001-2015, XR *<br>this program was protected by copyright laws. *<br>program Name: *<br>date: * @author XR * @version 1.0*/public class javadoctest{public static VO ID Main (string[] args) {System.out.println ("hello,world!");}}

Comment out the following code, and the compilation and execution of the source files are successful.

Package Lee;

Would that be the reason, I think of the solution, looking for Niang asked, the answer is surprisingly consistent: CLASSPATH environment variable problem, but the CLASSPATH variable from JDK 1.5 no longer set. Finally found the answer on a forum:

The Java package name must be entered in the parent directory. Class name

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/76/42/wKiom1ZN_EOy2MaAAAAgTuy4sAk532.png "title=" 2015-11-20_004342.png "alt=" Wkiom1zn_eoy2maaaaagtuy4sak532.png "/>

Finally, Kung Fu is not a conscientious, problem solved.

This article is from the "Technical Station" blog, please be sure to keep this source http://4667095.blog.51cto.com/4657095/1714878

Java source program compilation and execution issues

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.