aspose file tools*
The moose likes Java in General and the fly likes URGENT !!! This is So Weird Problem! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "URGENT !!! This is So Weird Problem!" Watch "URGENT !!! This is So Weird Problem!" New topic
Author

URGENT !!! This is So Weird Problem!

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi folks;
i could not understand this. this is what i have:

C:\RnD javac java\ThisIsMyInterface.java
compiles fine.
C:\RnD javac java\TestIn.java
gives me the following error:

but, i tried taking out package from both and compiled, it works just fine. i could not figure it out why? could please someone tell me what's going on here with package?
thanks.
[ November 12, 2002: Message edited by: Himal Chuli ]

Himal
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Compile from one more directory level up, and make sure your compilation classpath is the current directory; that should solve the problem.
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hey Michael,
i did as you mentiond. i did the follwoing
CLASSPATH=C:\RnD\java
C:\RnD\java javac TestIn.java
gives me the same problem. i still don't know why. please help me.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Oops; not quite what I meant: you want to run the compiler and set the classpath so that "you" are not part of the classpath itself.
If C:\RnD\java is the full path to your code, then do this:

That should do it.
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi Michael,
i did as you told me to do, it seems like it's working but it did not generate any .class files at all. it didn't throw any error though. can you tell me why?
also why the way i was doing is not working?
thanks.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Hm. I'm not sure what to tell you.
I recreated these files on my system, just to make sure I wasn't thinking wrongly. I put the two source files in /var/tmp/RnD/java on my system. Then I ran javac from the /var/tmp directory.
No problems, and the class files ended up in /var/tmp/RnD/java as I expected.
The reason for doing it this way: the compiler's working directory appears "above" where the code is in the file system, so it looks down from where it is to locate and store files. From this vantage point the package qualifier is unambiguous: "from here (/var/tmp), first find RnD/, then find java/ under that, and the files in question should be here."
If the compiler works from somewhere inside the actual classpath (like in the RnD directory or folder), it looks down two levels from where it is and can't resolve location correctly.
Search for the ThisIsMyInterface.class file -- it should be somewhere. Tell us where you found it too.
saager mhatre
Ranch Hand

Joined: Dec 20, 2000
Posts: 61
Another point worth noting is that compiling with package declarations usually requires you to specify the compilation destination using the -d flag of the javac tool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URGENT !!! This is So Weird Problem!