Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » System.out.printf in Eclipse 3.2 with java 6
System.out.printf in Eclipse 3.2 with java 6 [message #197745] Sun, 04 March 2007 17:05 Go to next message
Eclipse UserFriend
Originally posted by: mathew4152.yahoo.com

The following code compiles fine on command line. However, eclipse gives
an error saying : The method Printf( String, Object[] ) in the PrintStream
is not applicable for the arguments ( String, String ).
Can anybody tell me what am I missing with eclipse?


public class TestA {

public static void main(String[] args) {

String a = "Testing";
System.out.printf("%s\n", a);
}
}
Re: System.out.printf in Eclipse 3.2 with java 6 [message #197753 is a reply to message #197745] Sun, 04 March 2007 18:44 Go to previous messageGo to next message
Charlie Kelly is currently offline Charlie KellyFriend
Messages: 276
Registered: July 2009
Senior Member
Hi,

Look under Preferences->Java->Installed JREs
and ensure that you are compiling with a jre that supports printf

Charlie


G Mathew wrote:
> The following code compiles fine on command line. However, eclipse gives
> an error saying : The method Printf( String, Object[] ) in the
> PrintStream is not applicable for the arguments ( String, String ).
> Can anybody tell me what am I missing with eclipse?
>
>
> public class TestA {
>
> public static void main(String[] args) {
>
> String a = "Testing";
> System.out.printf("%s\n", a);
> }
> }
>
Re: System.out.printf in Eclipse 3.2 with java 6 [message #197769 is a reply to message #197753] Sun, 04 March 2007 19:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mathew4152.yahoo.com

I have only Java 6 installed and that is the only jre seen from eclipse.
It is the same jre that I can compile and run command line with. But,
eclipse is giving trouble. Again, I have only java 6 installed.
Re: System.out.printf in Eclipse 3.2 with java 6 [message #197777 is a reply to message #197745] Sun, 04 March 2007 21:13 Go to previous messageGo to next message
Paul A. Rubin is currently offline Paul A. RubinFriend
Messages: 188
Registered: July 2009
Senior Member
G Mathew wrote:
> The following code compiles fine on command line. However, eclipse gives
> an error saying : The method Printf( String, Object[] ) in the
> PrintStream is not applicable for the arguments ( String, String ).
> Can anybody tell me what am I missing with eclipse?
>
>
> public class TestA {
>
> public static void main(String[] args) {
>
> String a = "Testing";
> System.out.printf("%s\n", a);
> }
> }
>

It compiles and runs fine for me (Eclipse 3.2.1, Java 6, Win XP). Did
you try cleaning the project (Project -> Clean...)?

/Paul
Re: System.out.printf in Eclipse 3.2 with java 6 [message #197785 is a reply to message #197769] Sun, 04 March 2007 21:22 Go to previous message
Eclipse UserFriend
Originally posted by: mathew4152.yahoo.com

I found the answer. The eclipse "Compiler Compliance" by default is set to
1.4. I had to change it to 6.
Previous Topic:Visual Editor and RCP appliacions
Next Topic:Display fixed point numbers
Goto Forum:
  


Current Time: Fri Apr 26 14:56:41 GMT 2024

Powered by FUDForum. Page generated in 0.08653 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top