aspose file tools*
The moose likes Beginning Java and the fly likes printf() :: :banghead: Strange Output on one Arcitecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "printf() :: :banghead: Strange Output on one Arcitecture" Watch "printf() :: :banghead: Strange Output on one Arcitecture" New topic
Author

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

Rinav Gangar
Greenhorn

Joined: Feb 26, 2008
Posts: 5
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!


Thanks And Regards<br />Rinav Gangar
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14270
    
  21

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rinav Gangar
Greenhorn

Joined: Feb 26, 2008
Posts: 5
^^^
its Some weired unreadable characters!

its like when we open an exe file in a text editor
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Rinav Gangar
Greenhorn

Joined: Feb 26, 2008
Posts: 5
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

Joined: Nov 08, 2007
Posts: 457
have you tried it with a Java5 JVM?

I would be suspect of the Java6 install on your computer.


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
syed mashadi
Greenhorn

Joined: Jun 06, 2008
Posts: 8
Asslam o alikum
Try to installed updated java version, and than try again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: printf() :: :banghead: Strange Output on one Arcitecture