Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't compile my class

 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers!
I have I problem that hasn't been a problem before. I got it after formatting my Harddrive.
I have compiled a test file like this.
Blocker.java

When I try to use it in my FBMain file I get a compile error.

When I remove the import Blocker; statement it works. I can't use the Blocker class in my FBMain class. Here is my PATH and classpath in Windows 2000

My files are located in F:\Edge Soft\Work\java\
Please help!
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ehhh...
I created a new directory "test" under my java catalouge. I put package test in my Blocker file. I used import test.Blocker; instead and it worked??? Why? Anyone?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"import ClassName" is illegal as per the JLS: you can't import names out of the default package. Older JDK compilers allowed this anyway, but now the rule is being enforced. Presumably when you reformatted, you upgraded your JDK version.
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic