Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem using javac: cannot find symbol(method)

 
Rob Sweeny
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I've been able to compile my supporting class file FloatNumber, but not my main class, MainFloatNumber.

CODE:





DIRECTORY HIERARCHY:

C:\code\src\com\scjaexam\tutorial
C:\code\src\com\scjaexam\tutorial\floatnumbers
C:\code\classes\com\scjaexam\tutorial
C:\code\classes\com\scjaexam\tutorial\floatnumbers

JAVAC:

c:\code>javac -d classes c:\code\src\com\scjaexam\tutorial\floatnumbers\FloatNumber.java
___compiles, and puts class file in correct location
___C:\code\classes\com\scjaexam\tutorial\floatnumbers\FloatNumber.class

c:\code>javac -d classes -cp classes c:\code\src\com\scjaexam\tutorial\MainFloatNumber.java

c:\code\src\com\scjaexam\tutorial\MainFloatNumber.java:7: cannot find symbol
symbol : method FloatNumber(float)
location: class com.scjaexam.tutorial.MainFloatNumber
FloatNumber value = FloatNumber(1f);


Any help would be appreciated.
Rob
 
Henry Wong
author
Marshal
Pie
Posts: 21112
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If you want to instantiate an object, you should use the "new" operator.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic