This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
I have following line in a jsp page from an open source project:
<html:option value="micg">µg</html:option>
When I compile it using maven following code is generated:
_jspx_th_html_005foption_005f9.setValue("micg");
int _jspx_eval_html_005foption_005f9 = _jspx_th_html_005foption_005f9.doStartTag();
if (_jspx_eval_html_005foption_005f9 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_html_005foption_005f9 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_html_005foption_005f9.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_html_005foption_005f9.doInitBody();
}
do {
out.write('Â');
out.write('µ');
out.write('g');
int evalDoAfterBody = _jspx_th_html_005foption_005f9.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_html_005foption_005f9 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
This is causing following error in compiling generated java file:
[javac] Compiling 1375 source files
[javac] warning: [options] bootstrap class path not set in conjunction
with -source 1.5
[javac] D:\src\WriteScript_jsp.java:2310: error: unclosed character literal
[javac] out.write('Â');
[javac] ^
[javac] D:\src\WriteScript_jsp.java:2310: error: illegal character: \8218
[javac] out.write('Â');
[javac] ^
[javac] D:\src\WriteScript_jsp.java:2310: error: unclosed character literal
[javac] out.write('Â');
[javac] ^
[javac] D:\src\WriteScript_jsp.java:2311: error: unclosed character literal
[javac] out.write('µ');
[javac] ^
[javac] D:\src\WriteScript_jsp.java:2311: error: ';' expected
[javac] out.write('µ');
[javac] ^
[javac] D:\src\WriteScript_jsp.java:2311: error: unclosed character literal
[javac] out.write('µ');
[javac] ^
[javac] 6 errors
Please help me how to remove this error :( I am on Windows 7 64-bit and JDK version 1.7.
The presence of the  in the generated Java source indicates that you've saved the JSP source code as ISO-8859-x instead of UTF-8 (or that JSP parser is reading it as ISO-8859-x instead of UTF-8 which is unlikely). Check/reconfigure your source code editor and make sure that it saves the JSP source code as UTF-8.
An alternative to ensuring you have -encoding correct everywhere, as suggested by other responders, is to not use non-lower-ASCII characters in your file. This can be acomplished with the \u escape, for example, by writing:
out.write('\u006c');
..instead of:
out.write('Â');
Nowhere near as pretty or convenient, but much easier to get to work in large teams, especially if you only have Scary Foreign Moon Language Characters in limited locations in your applications, as most development teams who deal with this kind of thing do.
Related
I just found this tool, MatJuice, which could save me days or even weeks of development, but it doesn't compile.
Although I don't know anything about Java, it doesn't look so hairy: the two errors are both located in the same file, in the same function, and the functionality looks generic (findParent), so maybe a Java programmer will know what it is about on the instant.
A breaking issue has been posted here more than a year ago and it doesn't seem the authors are willing to correct it. That is why I am asking here.
Bellow are the two errors :
[javac] /home/geoffrey/mclab-core/languages/Natlab/src/natlab/utils/NodeFinder.java:62: error: cannot find symbol
[javac] .filter(n -> clazz.isInstance(n) || n.getParent() == null)
[javac] ^
[javac] symbol: method getParent()
[javac] location: variable n of type Object
[javac] /home/geoffrey/mclab-core/languages/Natlab/src/natlab/utils/NodeFinder.java:66: error: incompatible types: Object cannot be converted to T
[javac] .orElse(null);
[javac] ^
[javac] where T is a type-variable:
[javac] T extends Object declared in method <T>findParent(Class<T>,ASTNode<?>)
Bellow is the related piece of code (the errors occur on line 3 and 7 in this extract)
public static <T> T findParent(Class<T> clazz, ASTNode<?> node) {
return Stream.iterate(node, ASTNode::getParent)
.filter(n -> clazz.isInstance(n) || n.getParent() == null)
.findFirst()
.filter(clazz::isInstance)
.map(clazz::cast)
.orElse(null);
}
The complete file is here (there are helpful comments in the file) along with the rest of the repo.
I tried to give it a go myself but with zero knowledge of Java, it is just too abstract for me to debug.
These errors are come out because of compiler doesn't know what ast.ASTNode is. There is no such class in the project. But there is Natlab.gen target from ant build file:
mclab-core/languages/Natlab/build.xml
Try to run Natlab.gen target and the directory gen (that contains necessary package ast.ASTNode) will be generated inside Natlab directory. This should fix compilation errors.
I'm using Mac OS X, my ant, java dependency satisfied the minimum requirement. When I build the source code by
ant build
I got the error like:
[echo] apache-cassandra: /Users/taiyuanz/git/cassandra-trunk/build.xml
[javac] Compiling 890 source files to /Users/taiyuanz/git/cassandra-trunk/build/classes/main
[javac] Note: Processing compiler hints annotations
[javac] warning: Supported source version 'RELEASE_6' from annotation processor 'org.openjdk.jmh.generators.BenchmarkProcessor' less than -source '1.8'
[javac] /Users/taiyuanz/git/cassandra-trunk/src/java/org/apache/cassandra/db/partitions/AbstractBTreePartition.java:33: error: reference to Row is ambiguous
[javac] public abstract class AbstractBTreePartition implements Partition, Iterable<Row>
[javac] ^
[javac] both interface org.apache.cassandra.db.rows.Row in org.apache.cassandra.db.rows and class org.apache.cassandra.db.Row in org.apache.cassandra.db match
[javac] /Users/taiyuanz/git/cassandra-trunk/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java:72: error: reference to Row is ambiguous
[javac] private BTree.Builder<Row> rowBuilder;
[javac] ^
[javac] both interface org.apache.cassandra.db.rows.Row in org.apache.cassandra.db.rows and class org.apache.cassandra.db.Row in org.apache.cassandra.db match
[javac] /Users/taiyuanz/git/cassandra-trunk/src/java/org/apache/cassandra/db/partitions/PartitionUpdate.java:164: error: reference to Row is ambiguous
[javac] public static PartitionUpdate singleRowUpdate(CFMetaData metadata, DecoratedKey key, Row row)
.......
All because of the same problem - ambiguity due to the Row class. How can one solve this?
It looks like you have source code from pre-3.0 and post-3.0 Cassandra in your source tree. I would run:
git clean -xfd
To see if that fixes it. Otherwise, delete the repository and start again with a clean clone.
I am getting this error while smartbuilding my module named in.pispl.bankslipmodue and java package name in.pispl.bankslipmodule.ad_actionButton and class named ManualProcessActionHandler:
/opt/OpenbravoERP-3.0/openbravo-erp/srcAD/org/openbravo/erpCommon/ad_actionButton/ActionButtonJava_Responser.java:5294: cannot find symbol
[javac] symbol : method execute(org.openbravo.scheduling.ProcessBundle)
[javac] location: class in.pispl.bankslipmodule.ad_actionButton.ManualProcessActionHandler
[javac] new in.pispl.bankslipmodule.ad_actionButton.ManualProcessActionHandler().execute(pb);
This question already has an answer here:
Play 2.2.1 Java: Whats the equivalent of #before filters from play 1.X?
(1 answer)
Closed 8 years ago.
I am trying to use #Before interceptor in my controller
#Before(only = {"save" })
static void parseParams() {
String[] jobcategories = params.getAll("jobcategories");
for (int i = 0; i < jobcategories.length; i++) {
params.put("jobcategories[" + i + "].id", jobcategories[i]);
}
System.out.print(jobcategories);
}
but it gives me compile time error
C:\myapp\app\controllers\JobAdController.java:57: error: cannot find symbol
#Before(only={"save"})
^
symbol: class Before
location: class JobAdController
C:\myapp\app\controllers\JobAdController.java:59: error: cannot find symbol
String[] jobcategories = params.getAll("jobcategories");
^
symbol: variable params
location: class JobAdController
C:\myapp\app\controllers\JobAdController.java:61: error: cannot find symbol
params.put("jobcategories["+i+"].id",jobcategories[i]);
^
symbol: variable params
location: class JobAdController
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
(compile:compile) javac returned nonzero exit code
Total time: 30 s, completed Nov 20, 2014 1:05:18 PM
What am I missing?
You CAN'T find it as it's from Play 1.x API #Before and other interceptors are NOT available in Play 2.x - they are replaced by Action Composition
#See similar topic
Note: Do not use documentation of Play 1.x for Play 2.x at all. In most areas they are totally different.
I'm trying to build a ROM for Android and everything is going smooth, but then i added Proximity Wake feature from CM and got this error:
packages/apps/Settings/src/com/android/settings/DisplaySettings.java:148: cannot find symbol symbol :
variable advancedPrefs location: class com.android.settings.DisplaySettings
advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE)); ^
packages/apps/Settings/src/com/android/settings/DisplaySettings.java:149: cannot find symbol symbol :
variable PROXIMITY_ON_WAKE location: class android.provider.Settings.System
Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1);
^ Note: Some input files use or override a deprecated API. Note: Recompile
with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
when i open up the file i find this lines:
advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE));
Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1);
The error states that it cannot find a symbol, what is wrong?