| Author |
Can't compile my class
|
Mathias Nilsson
Ranch Hand
Joined: Oct 13, 2003
Posts: 107
|
|
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!
|
SCJP2 , MCP( 70-229 ) , Preparing For SCWDC
|
 |
Mathias Nilsson
Ranch Hand
Joined: Oct 13, 2003
Posts: 107
|
|
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
Joined: Jul 08, 2003
Posts: 24061
|
|
|
"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.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Mathias Nilsson
Ranch Hand
Joined: Oct 13, 2003
Posts: 107
|
|
|
Thanks!
|
 |
 |
|
|
subject: Can't compile my class
|
|
|