Bug 199247 - printf function compilation problem
Summary: printf function compilation problem
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2007-08-08 09:14 EDT by Prasad Fernando CLA
Modified: 2007-12-20 06:48 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prasad Fernando CLA 2007-08-08 09:14:45 EDT
Build ID: 3.3.0

Steps To Reproduce:
1.System.out.printf("%d items at $%.2f each.%n", count, price);
2.
public class PrintfDemo
{
	public static void main(String[] args)
	{
		String aString = "abc";
		System.out.printf("%s %n", aString);
	}
}


These codes runs fine on all other platforms but gives a compilation porblem in eclipse.


More information:
Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
	The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int, double)
	The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double)
	The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, double)
Comment 1 Darin Wright CLA 2007-08-08 09:42:37 EDT
Are you building and running against different JRE's? What JRE is on your build path, and what JRE is on your runtime classpath?
Comment 2 Frederic Fusier CLA 2007-08-08 10:29:50 EDT
Surely a problem of compliance. printf is implemented on PrintStream only since JRE 1.5, so set the project/workspace compliance at level 1.5 at least and your problem should disappear.

Please reopen in case this was not the reason of your problem, thanks
Comment 3 Frederic Fusier CLA 2007-08-08 10:34:31 EDT
Not sure to have been 100% clear... Of course, you also should change the project's JRE accordingly (ie. select at least a 1.5 one...)
Comment 4 Frederic Fusier CLA 2007-12-20 06:48:55 EST
Verified for 3.4M1