How to Make a HelloWorldable KVM 1.0.2
by VC++ 6.0

1. unzip j2me_cldc-1_0_2-fcs-winunix.zip
2.1. mkdir j2me_cldc\tools\jcc\classes
2.2. j2me_cldc\tools\jcc\src>
javac -d ..\classes *.java components\*.java jcc\*.java runtime\*.java text\*.java util\*.java vm\*.java
2.3. zip j2me_cldc\bin\common\api\classes to j2me_cldc\tools\jcc\classes.zip, excluding:
com/sun/cldc/io/NetworkConnectionBase.class
com/sun/cldc/io/j2me/comm/*
com/sun/cldc/io/j2me/datagram/*
com/sun/cldc/io/j2me/events/*
com/sun/cldc/io/j2me/resource/*
com/sun/cldc/io/j2me/serversocket/*
com/sun/cldc/io/j2me/socket/*
2.4. j2me_cldc\tools\jcc>
java -cp classes JavaCodeCompact -nq -arch KVM_Native -o nativeFunctionTableWin.c classes.zip
3.1. mkdir kvm
3.2. copy j2me_cldc\kvm\VmCommon j2me_cldc\kvm\VmExtra j2me_cldc\kvm\VmWin to kvm
3.3. copy nativeFunctionTableWin.c to j2me_cldc\kvm\VmWin\src
4. build KVM by Microsoft Visual C++
  • File:New:Win32ConsoleApplication:ProjectName
    KVM
  • Project:AddToProject:Files
    cache.c class.c collector.c execute.c fields.c frame.c garbage.c global.c
    hashtable.c interpret.c loader.c log.c native.c nativeCore.c pool.c
    profiling.c property.c stackmap.c StartJVM.c thread.c verifier.c
    fakeStaticMemory.c inflate.c jar.c loaderFile.c main.c
    runtime_md.c runtime2_md.c
    nativeFunctionTableWin.c
  • Project:Settings:C/C++:Preprocessor:AdditionalIncludeDirectories
    .\VmCommon\h;.\VmExtra\h;.\VmWin\h
  • Project:Settings:C/C++:Preprocessor:PreprocessorDefinitions
    NOGUI, ROMIZING=0, USE_DEBUG_COLLECTOR=0, INCLUDE_ALL_CLASSES=0, ENABLE_JAVA_DEBUGGER=0
  • Project:Settings:C/C++:CodeGeneration:UseRunTimeLibrary
    Debug Multithreaded
  • Build:RebuildAll
5.1. mkdir kvm\test
5.2. move classes.zip from j2me_cldc\tools\jcc to kvm\test
5.3. edit & javac HelloWorld.java in kvm\test
5.4. execute/debug HelloWorld by Microsoft Visual C++
  • Project:Setting:Debug:General:WorkingDirectory
    test
  • Project:Setting:Debug:General:ProgramArguments
    -classpath classes.zip;. HelloWorld
  • Build:StartDebug:
    ...