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

Import Problems

 
Sunil Chandurkar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two folders with classes under the C:\Java folder.
C:\Java\Fava\Hi.java and C:\Java\Mava\Tester.java.
Tester.java has the statement
import package Fava.*;

When i try to javac Mava\Tester.java i get an error saying
<identifier expected>
import ^ package Fava.*;

How should I change the classpath under system variables to solve this problem?

Please Advise.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the word 'package'. It's not needed
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code has a syntax error, that's why you got the compilation error. It should be

Since you need to import the class from Fava package, you need to specify the classpath, e.g.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code has a syntax error, that's why you got the compilation error. It should be

Since you need to import the class from Fava package, you need to specify the classpath, e.g.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic