Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java with maven error: illegal character: \8220

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi im using java 7 for my code, i use eclipse mars and maven 3.3.1 and glassfish 3, my problem is the next, i was trying to add the dependencies for generate qr code in my project, adding this by maven, but i cant do it, so i was reading on internet, i read that maven change from use http to https, so i did the next

i delete the maven folder and create it again

and add this -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2. in the default vm arguments in the configuration for run my project , the jdk is jdk1.7.0_79

when i run the code i get this errors

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project comun: Compilation failure: Compilation

[12,21] error: illegal character: \8220

[12,22] error: '}' expected

[18] error: class, interface, or enum expected



This is the java class where the code is throwing the errors





Note: This code works before i the delete the maven folder, this project works with java 7 i never update it and i works with it all the time, i check the code and i doesnt find errors.
Staff note (Ron McLeod):

Line 16 before it was corrected:
SOLICITUD_DE_AMPLIACION_DE_PERIODO(284L),

 
Creator of Enthuware JWS+ V6
Posts: 3348
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is with the last enum value, that should end with a semicolon
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Frits Walraven wrote:The problem is with the last enum value, that should end with a semicolon




sorry my fault, i made the correction, but i get the same errors
 
Saloon Keeper
Posts: 6530
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange. I can compile the code as it appears now without any errors.

i get the same errors


That would be even stranger after you corrected the issue with the semicolon - at least that error message should be gone.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Strange. I can compile the code as it appears now without any errors.

i get the same errors


That would be even stranger after you corrected the issue with the semicolon - at least that error message should be gone.



yes i get the error [12,21] error: illegal character: \8220

i dont know if maybe the error could be org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile, because its said failed to execute goal
 
Tim Moores
Saloon Keeper
Posts: 6530
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you do not get "the same errors" as you said, but you still get that one error. OK, that's better. But it has nothing to do with Maven, which is simply telling you that it can't compile the source code.

Did you tell Maven that your source code has Unicode characters in it? I believe the default is to assume that it does not, so the character in line 12 could be a problem. So start by removing that character and see what happens.
 
Marshal
Posts: 69894
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I thought, there is something familiar about that error message, but I am not used to seeing \8220. So, I thought, let's find out what 8220 means, so I tried the following on JShell:-

jshell> System.out.printf("%#06x%n", 8220);
0x201c
$1 ==> java.io.PrintStream@26a1ab54

The important part is 0x201c. You can now look that up on a Unicode chart, but I recognise the number, which I use all the time. This is \u201c: “ I think somebody has used a word processor or similar for editing code and it has changed " to “ automatically. Change that quote back to " (=\u0022) and all should be well.

If you get an error about \8221, that represents \u201d: ” and both the cause and solution are similar.
 
Tim Moores
Saloon Keeper
Posts: 6530
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:I think somebody has used a word processor or similar for editing code and it has changed " to “ automatically.


That's indeed a classic gotcha to watch out for, but the source code contains no single or double quotes at all.
 
Campbell Ritchie
Marshal
Posts: 69894
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use that Unicode in HTML tags on the Ranch every hour, so I recognised 201c immediately. The quotes are obviously in some other code; how far can you get without writing a String literal with quotes?
 
Tim Moores
Saloon Keeper
Posts: 6530
160
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm going by what Mike said, which is that the error happened in the same class as the other, now corrected one. Given that line 12 is the one with the Unicode character, that seems worth investigating.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:Well, I'm going by what Mike said, which is that the error happened in the same class as the other, now corrected one. Given that line 12 is the one with the Unicode character, that seems worth investigating.



i use the debug at the moment of compile the code, in effect i get the error of the character but in the bottom i get the next

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project nsjp-comun: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more


that refers a dependency of maven
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

that refers a dependency of maven


No, it does not. That's Maven telling you a compilation error occurred.

Have you followed up on the advice about the Unicode character?
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:

that refers a dependency of maven


No, it does not. That's Maven telling you a compilation error occurred.

Have you followed up on the advice about the Unicode character?



change the configuration of the editor, eclipse mars, im searching how to make the change
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i check the configuration of eclipse mars and the text file encoding is UTF-8
 
Campbell Ritchie
Marshal
Posts: 69894
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:. . . line 12 is the one with the Unicode character . . .

The 21st character in that line is Ó (=\u00d3 =\211). How can that cause any problems?
 
Saloon Keeper
Posts: 12165
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you set the project.build.sourceEncoding property in your Maven POM, and does it match the encoding of your source files?
 
Stephan van Hulst
Saloon Keeper
Posts: 12165
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:How can that cause any problems?


Simple. If the compiler is configured to use a different encoding than what the source files use, you get these kinds of problems. It's good to explicitly set the encoding of the compiler to UTF-8 in Maven:
 
Campbell Ritchie
Marshal
Posts: 69894
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah!
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Have you set the project.build.sourceEncoding property in your Maven POM, and does it match the encoding of your source files?




<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

this is the default configuration in the pom, i think there is not problem of the encoding, may be is problem of the maven dependencies
 
Stephan van Hulst
Saloon Keeper
Posts: 12165
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So do you still get the same problem?

Can you please run a small Java program that prints Charset.defaultCharset().name()?
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:So do you still get the same problem?

Can you please run a small Java program that prints Charset.defaultCharset().name()?



i cant make the clean install of the code, because the error that i mention up
 
Stephan van Hulst
Saloon Keeper
Posts: 12165
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant, just run a simple separate Java program. All you need to do is compile and run the following code:
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:I meant, just run a simple separate Java program. All you need to do is compile and run the following code:



ok i run the code and throw the next windows-1252
 
Stephan van Hulst
Saloon Keeper
Posts: 12165
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay now please post your POM so we can try to reproduce the problem.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Okay now please post your POM so we can try to reproduce the problem.



ok, this is my pom part 1


 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

mike salazar wrote:

Stephan van Hulst wrote:Okay now please post your POM so we can try to reproduce the problem.



pom part 2

 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maven wrote:[12,21] error: illegal character: \8220



I could speculate that the error referred to the character at position 21 in line 12. Could be wrong but let's go with that for a while. Line 12 is



That character "Ó" might not quite be at position 21 but it makes me say "Hmmmm". Now sure, it's a perfectly good character to be in a Java identifier and it compiles correctly. It might be mangled if maven used the wrong encoding to read the code, but even so the chances of it being mangled into the left slanted quote mark are basically zero. And then why would the compiler be looking for a closing brace at that position? So instead I am speculating that those error messages actually referred to some other code.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Maven wrote:[12,21] error: illegal character: \8220



I could speculate that the error referred to the character at position 21 in line 12. Could be wrong but let's go with that for a while. Line 12 is



That character "Ó" might not quite be at position 21 but it makes me say "Hmmmm". Now sure, it's a perfectly good character to be in a Java identifier and it compiles correctly. It might be mangled if maven used the wrong encoding to read the code, but even so the chances of it being mangled into the left slanted quote mark are basically zero. And then why would the compiler be looking for a closing brace at that position? So instead I am speculating that those error messages actually referred to some other code.




sorry it doesnt copy that line, only copy one part the complete code in the line 12 is this

           APROBACIÓN_DE_ACUERDO_REPARATORIO_INMEDIATO_Y_EXTINCIÓN_DE_LA_ACCIÓN_PENAL(21549L),
 
Stephan van Hulst
Saloon Keeper
Posts: 12165
258
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you haven't given us the exact original source code?

Please show us the original, we need to be able to reproduce your problem.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:So you haven't given us the exact original source code?

Please show us the original, we need to be able to reproduce your problem.




part 1


 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
part 2

 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


errors

[119,21] error: illegal character: \8220

[119,22] error: '}' expected

[294,12] error: class, interface, or enum expected
 
Marshal
Posts: 3156
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there more details for the error messages?  Is there any specific reference to the Actividades class?
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:Are there more details for the error messages?  Is there any specific reference to the Actividades class?



No
 
Ron McLeod
Marshal
Posts: 3156
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

mike salazar wrote:

Ron McLeod wrote:Are there more details for the error messages?  Is there any specific reference to the Actividades class?



No


No to both questions?

So if the Actividades class is mot mentioned, why assume that the problem is related to the source code for that class?

As mentioned earlier, it looks a lot like a character being used somewhere rather than a " character.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

mike salazar wrote:

Ron McLeod wrote:Are there more details for the error messages?  Is there any specific reference to the Actividades class?



No


No to both questions?

So if the Actividades class is mot mentioned, why assume that the problem is related to the source code for that class?

As mentioned earlier, it looks a lot like a character being used somewhere rather than a " character.



oh sorry i didnt put attention in the question, yes the error mention the class actividades, the 3 errors, the code have so many classes, but is the unique class mention in the errors
 
Sheriff
Posts: 7660
522
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mike salazar, please don't edit old post(s) by trying to amend changes possibly pointed out within the thread. In these type of situations better is to create a new post with addessed points implemented, otherwise it becomes very difficult to follow what is going on, plus some people posts would may look nonsensical as if they were pointing out to a non existing things.

I have declined your recent edits to an initial post of this thread.
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:mike salazar, please don't edit old post(s) by trying to amend changes possibly pointed out within the thread. In these type of situations better is to create a new post with addessed points implemented, otherwise it becomes very difficult to follow what is going on, plus some people posts would may look nonsensical as if they were pointing out to a non existing things.

I have declined your recent edits to an initial post of this thread.



ok, i will make a new post with the correct code and the implementations
 
mike salazar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i watch the text file encoding of eclipse mars, and its cp1252 not UTF-8, i change UTF-8 and bring errors in another files, but not in Actividades
 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic