Posted by: sn00p
Java Experts.... - 14/09/2016 07:44
Hi Guys,
Got a bit of a strange issue here that for the life of me I cannot solve, everything I have read seems to point to me doing the right thing, but I always get the same error.
I have written my own JVM for use on our product, I have this working pretty well, I still have a few bits to finish up, but it's looking good.
Now I'm trying to create some native classes to allow access to hardware & peripherals on our product, so I need to create packages, and for the life of me I cannot get them to work.
I am on OS X El Capitan with the latest JDK that I downloaded from oracle.
And for example, I have the following structure:
in test.java I have at the top
and in mike.java I have
I generated the class files using:
and that created the folder structure and placed the mike.class in the appropriate folder, all great so far....
But when I come to compile test.java I get:
if I try (which I believe is wrong anyway, but seeing as nothing else was working it seemed worth a try):
I get the same error, no matter what I do it always thinks that it cannot see the kestrel folder. I've spent hours reading the net and looking at examples and they appear to be doing the same as me and they apparently work.
Any idea what I am doing wrong? Am I misunderstanding something?
Got a bit of a strange issue here that for the life of me I cannot solve, everything I have read seems to point to me doing the right thing, but I always get the same error.
I have written my own JVM for use on our product, I have this working pretty well, I still have a few bits to finish up, but it's looking good.
Now I'm trying to create some native classes to allow access to hardware & peripherals on our product, so I need to create packages, and for the life of me I cannot get them to work.
I am on OS X El Capitan with the latest JDK that I downloaded from oracle.
And for example, I have the following structure:
Code:
test.java [sdk] [src] [fred] [bob] mike.java [classes] [fred] [bob] mike.class
in test.java I have at the top
Code:
import fred.bob;
and in mike.java I have
Code:
package fred.bob;
I generated the class files using:
Code:
javac -d sdk/classes sdk/src/fred/bob/mike.java
and that created the folder structure and placed the mike.class in the appropriate folder, all great so far....
But when I come to compile test.java I get:
Code:
javac -cp .:./sdk/classes test.java test.java:6: error: package fred does not exist import fred.bob; ^ 1 error
if I try (which I believe is wrong anyway, but seeing as nothing else was working it seemed worth a try):
Code:
javac -cp .:./sdk/src test.java
I get the same error, no matter what I do it always thinks that it cannot see the kestrel folder. I've spent hours reading the net and looking at examples and they appear to be doing the same as me and they apparently work.
Any idea what I am doing wrong? Am I misunderstanding something?