Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NIO and UTF-8 Exception  RSS feed

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whilst using NIO to read a small text file, I have come across an exception with the following message : input length = 1


When the program is run through Netbeans 7.4 on java 7 update 51 there is no exception.

It only appears when the program is run on the standalone JRE same version as above.

I have searched the internet and not been able to find a solution.


I am using charset UTF-8

 
Stephan van Hulst
Saloon Keeper
Posts: 7821
142
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should change the code on line 43.

But seriously, posting your code would help.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code runs as intended when run through the JRE provided with NetBeans. Java 7 Update 51
It throws exception when run on standalone JRE same version as above.
I have the exact same method instead using IO and it does not throw any exception.

 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And can we have the stack trace as well?
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to find the solution which consists of a minor change to the charset.

The method now runs as intended through NetBeans or through standalone JRE.

Thank you for your attention in this matter Roel De Nijs.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!