[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No VM02 at KFest?



In article 
<c58ebea6-cc99-48ee-a0d4-a4870eae25ec@s24g2000pri.googlegroups.com>,
 DaveSchmenk <dschmenk@gmail.com> wrote:

> On Jul 22, 9:51 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> > In article
> > <f585a368-ca9f-4396-a18d-b9f646347...@b4g2000pra.googlegroups.com>,
[...]
> > Oddly, if I put both classes in a subdirectory, Main runs, but the 
> > vm looks for Answer in the root directory.
> 
> This has to do with the way Java saves the class name and the way 
> VM02 searches for classes.  VM02 doesn't have a concept of CLASSPATH 
> except from where vm02 was started.  The easiest way around this is 
> to use packages for your projects.  In your case, put the .java files 
> in a subdirectory /Users/Shared/vm02/src/answer and use
> 
> package answer;
> 
> at the beginning of your .java files.  Insert the files into the 
> answer directory in the ProDOS image file instead of the bin 
> directory.  Now everything will line up with the directories and live 
> nicely off the main vm02 directory.  You can easily use classes in 
> other packages with an import statement.  You can see where I use the 
> recommended reverse URL naming scheme for local packages with the CUI 
> class (org/vm02/cui then importing org.vm02.cui.*).

Dave: Thanks for confirming this.

> If the class generated class name is too long for ProDOS, just
> truncate it when importing into the ProDOS image.  If the unique part
> of the filenames come after the truncation part, you will have to
> shorten the base name of the class.  Sorry, I just couldn't find an
> easy way around this.

Using javap to examine the class file, I can see the fully qualified 
class name that the classloader sees. Would less than 16 bytes per 
component be OK?

$ javap ./src/org/vm02/cui/cui
Compiled from "cui.java"
public class org.vm02.cui.cui extends java.lang.Object{
    public static final int INPUT_UNKNOWN;
    ...

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>