What does a "Cannot find symbol" compilation error mean?

Please explain the following about the "Cannot find symbol" error: What does this error mean? What things can cause this error? How does the programmer go about fixing this error? This question is designed to be a comprehensive question about "cannot find symbol" compilation errors in Java. 1. What does a "Cannot find symbol" error mean? Firstly, it is a

“找不到符号”编译错误是什么意思?

请解释以下关于“无法找到符号”错误: 这个错误是什么意思? 什么事情会导致这个错误? 程序员如何去解决这个错误? 这个问题被设计成一个关于Java中“无法找到符号”编译错误的综合性问题。 1.“无法找到符号”错误是什么意思? 首先,这是一个编译错误1。 这意味着您的Java源代码中存在问题,或者您编译的方式存在问题。 您的Java源代码包含以下内容: 关键词:像true , false , class , while等等。 文字:

Unfortunately MyApp has stopped. How can I solve this?

I am developing an application, and everytime I run it, I get the message: Unfortunately, MyApp has stopped. What can I do to solve this? About this question - obviously inspired by What is a stack trace, and how can I use it to debug my application errors?, there are lots of questions stating that their application has crashed, without any further detail. This question aims to instruct no

不幸的是,MyApp已经停止。 我该如何解决这个问题?

我正在开发一个应用程序,每次运行它时,都会收到以下消息: 不幸的是,MyApp已经停止。 我能做些什么来解决这个问题? 关于这个问题 - 明显受到什么是堆栈跟踪的启发,以及如何使用它来调试我的应用程序错误?,有很多问题说明他们的应用程序崩溃了,没有任何进一步的细节。 这个问题旨在指导新手Android程序员如何自己尝试解决他们的问题,或者提出正确的问题。 这个答案描述了检索堆栈跟踪的过程。 已经有堆栈跟踪

file: "no main manifest attribute"

I have installed an application, when I try to run it (it's an executable jar) nothing happens. When I run it from the commandline with: java -jar "app.jar" I get the following message: no main manifest attribute, in "app.jar" Normally, if I had created the program myself, I would have added a main class attribute to the manifest file. But in this case, since the

文件:“无主清单属性”

我已经安装了一个应用程序,当我尝试运行它时(它是一个可执行的jar)没有任何反应。 当我从命令行运行它时: java -jar“app.jar” 我收到以下消息: 没有主要的清单属性,在“app.jar” 通常,如果我自己创建了程序,我会向清单文件添加一个主类属性。 但在这种情况下,由于该文件来自应用程序,所以我无法做到这一点。 我也尝试提取jar来查看是否可以找到主类,但是有很多类,并且它们都没有名称中的“main”这个词。

What exactly is Apache Camel?

I don't understand what exactly Camel does. If you could give in 101 words an introduction to Camel: What exactly is it? How does it interact with an application written in Java? Is it something that goes together with the server? Is it an independent program? Please explain what Camel is. If you have 5 to 10 minutes, I generally recommend people to read this Integration with Ap

Apache Camel究竟是什么?

我不明白骆驼究竟做了什么。 如果你可以用101个字给骆驼介绍一下: 究竟是什么? 它如何与用Java编写的应用程序进行交互? 这是否与服务器一起使用? 它是一个独立的程序吗? 请解释骆驼是什么。 如果你有5到10分钟的时间,我通常会建议人们阅读Jonathan Anstey与Apache Camel的集成。 这是一篇写得很好的文章,对骆驼的一些概念进行了简要的介绍和概述,并用代码示例实现了一个用例。 乔纳森在其中写道: Apa

Error: Could not find or load main class

This question already has an answer here: What does “Could not find or load main class” mean? 39 answers You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder then add . to your classpath. Note that the windows classpath separator is a semi-colon ie ; If the class is in a package package thepackagename; public class TheClassN

错误:无法找到或加载主类

这个问题在这里已经有了答案: “无法找到或加载主类”是什么意思? 39个答案 您必须确保将.class文件的位置添加到类路径中。 所以,如果它在当前文件夹中,然后添加. 到你的类路径。 请注意,Windows类路径分隔符是一个分号,即; 如果班级在一个包里 package thepackagename; public class TheClassName { public static final void main(String[] cmd_lineParams) { System.out.println("Hello World!"); }

Why can't Tomcat find SMTPTransport(Session, URLName)?

We've got a web application that sends mail. For some reason, an installation of it has decided that it can't find the constructor for SMTPTransport that takes (Session,URLName) arguments. Relevant bits of the stack trace: javax.mail.NoSuchProviderException: Provider class does not have a constructor(Session, URLName): protocol=smtp; type=javax.mail.Provider$Type@1dedf78; class=com.s

为什么Tomcat无法找到SMTPTransport(Session,URLName)?

我们有一个发送邮件的Web应用程序。 出于某种原因,它的安装已经决定它找不到使用(Session,URLName)参数的SMTPTransport的构造函数。 堆栈跟踪的相关位: javax.mail.NoSuchProviderException: Provider class does not have a constructor(Session, URLName): protocol=smtp; type=javax.mail.Provider$Type@1dedf78; class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc at javax.mail.Sessi

OpenID Architecture for Java

I'm trying to understand the concept and benefits of implementing OpenID in your project. And, since I'm a Java developer, I'm more or less equally interested in understanding its main Java implementation, openid4java . My understanding is that OpenID is a standard for provisioning decentralized IDs in a uniform way. Now, if that is totally (or even slightly) incorrect, please cor

面向Java的OpenID体系结构

我试图理解在你的项目中实现OpenID的概念和好处。 而且,由于我是Java开发人员,因此我对理解其主要Java实现openid4java或多或少都有同样的兴趣。 我的理解是,OpenID是以统一的方式提供分散ID的标准。 现在,如果这完全(或者甚至稍微)不正确,请纠正我! 假设我仍然走上正轨,我发现各种各样或组织都在使用OpenID,比如MySpace,他们通过匹配http://www.myspace.com/username的URL标识每个用户。 那么OpenID如何作为

How do I get a platform

How do I get a platform-dependent newline in Java? I can't use "n" everywhere. In addition to the line.separator property, if you are using java 1.5 or later and the String.format (or other formatting methods) you can use %n as in Calendar c = ...; String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY%n", c); //Note `%n` at end of line ^^

我如何获得平台

如何在Java中获得依赖于平台的换行符? 我无法在任何地方使用"n" 。 除了line.separator属性之外,如果使用java 1.5或更高版本以及String.format (或其他格式化方法),则可以使用%n Calendar c = ...; String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY%n", c); //Note `%n` at end of line ^^ String s2 = String.format("Use %%n as a platform independent n

Java, Calculate the number of days between two dates

This question already has an answer here: Calculating the difference between two Java date instances 43 answers Well to start with, you should only deal with them as strings when you have to. Most of the time you should work with them in a data type which actually describes the data you're working with. I would recommend that you use Joda Time, which is a much better API than Date / Ca

Java,计算两个日期之间的天数

这个问题在这里已经有了答案: 计算两个Java日期实例之间的差异43个答案 首先,你应该只在必要时将它们作为字符串处理。 大多数情况下,您应该使用实际描述您正在使用的数据的数据类型与他们一起工作。 我建议你使用Joda Time,这是一个比Date / Calendar更好的API。 听起来你应该在这种情况下使用LocalDate类型。 然后你可以使用: int days = Days.daysBetween(date1, date2).getDays(); 试试这个代码 Calenda

How to persist an entity from an non

I am trying to extend an entity into a non-entity which is used to fill the superclass's fields. The problem is that when I try to save it Hibernate throws a MappingException. This is because even though I cast ReportParser to Report, the runtime instance is still a ReportParser so Hibernate complains that it is an unknown entity. @Entity @Table(name = "TB_Reports") public class Report {

如何坚持一个非实体

我试图将一个实体扩展到一个用于填充超类字段的非实体。 问题是,当我尝试保存它时,Hibernate会抛出一个MappingException。 这是因为即使我将ReportParser投影到Report,运行时实例仍然是ReportParser,因此Hibernate抱怨它是未知的实体。 @Entity @Table(name = "TB_Reports") public class Report { Long id; String name; String value; @Id @GeneratedValue @Column(name = "cReportID") public Lo