This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

printf() :: :banghead: Strange Output on one Arcitecture

 
Rinav Gangar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was playing with java and got stuck with this printf method




This Program Compliled well (Intel core 2duo HP Lappy installed Java 1.6 u6 ), but gave strange output!
but,
When i took the compiled class file and ran it on different Lappy (Turion X2 Compaq) It ran Perfect.
I tried it with 4 - 5 PCS with dirrerent Processor (AMD and Intel) and OS (Solaris, Ubuntu, Vista, Xp) all worked Well.

Now why this particular code not working on this Lappy???
I reinstalled Java but same result!

Need some serious help!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the garbage output look like? Can you copy and paste it here?

Note: Use %n instead of \n in the formatting string to make it output a platform-dependent newline.
 
Rinav Gangar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
^^^
its Some weired unreadable characters!

its like when we open an exe file in a text editor
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like the Java installation on the "lappy" (you don't really say that out loud, do you?) is using a default locale/script/character encoding that the Windows console isn't configured for -- for example, a Hindi-localized copy of Windows, and a Japanese JDK.
 
Rinav Gangar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really don't have a clue!

are you trying to say that Java is using some Locale which is installed on laptop???

then may be its not! I am not Sure!

how is locale related with this printf() and console formated output related to each other
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried it with a Java5 JVM?

I would be suspect of the Java6 install on your computer.
 
syed mashadi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Asslam o alikum
Try to installed updated java version, and than try again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic