Re: [Jamvm-general] Proof Of Concept : an alternative to OpenJDK
Brought to you by:
rlougher
From: Xerxes R. <xe...@za...> - 2013-06-05 10:58:43
|
2013-06-03 23:41, johann Sorel skrev: > Hello Hi Johann! > > I would like some advices from some peoples working on JamVM : > > I have been working for several months now on a public domain general purpose library (think of it as a replacement to the ClassPath lib). The projet is going pretty well and is starting to be self sufficient. (for those interested : https://bitbucket.org/Eclesia/un/wiki/Home) > > Now I would like to make a Proof Of Concept that my project can live on it's own without the JVM APIs and classes. Basicly I would like to obtain a draft of VM using JamVM as "kernel" and my project as the main library. You can use the jamvm libjvm.so standalone in combination with your own projects class library > > - Can JamVM be used without ClassPath/OpenJDK ? yes create your own jvm launcher using the "JNI Invocation Interface" I recommend you to take a look at Chapter 7 (page 83) of the "The Java™ Native Interface Programmer’s Guide and Specification" book http://web.archive.org/web/20120905183616/http://java.sun.com/docs/books/jni/download/jni.pdf > - Will I need to code some JNI for low level operations ? > or are they provided ? (Streams,Sockets,...) You need to implement all classes you need like a ClassLoader, String, Object and Class class. And you need to use JNI to do low level operations. > > If you think it is possible : where should I start ? > > Thanks > > Johann Sorel jamvm libjvm finds the JRE classes relative to the libjvm.so thus the folder layout is important. You may setup a project structure like this: jamvmMini$ find . . ./compile.sh ./jre ./jre/classes/java/lang/Object.java <-- you will have to provide your own implementation of all java/lang classes ./jre/classes/java/lang/String.java ./jre/classes/java/lang/Class.java ./jre/classes/java/lang/ClassLoader.java ./jre/classes/java/lang/... ./jre/lib/jvm/jamvm/libjvm.so <- jamvm built using instructions from: http://draenog.blogspot.se/2011/02/openjdkjamvm-git-repository.html ./Prog.java <- the main application to run ./myJVM.c <- example code from "Chapter 7 (page 83) of the "The Java™ Native Interface Programmer’s Guide and Specification" book" ./run.sh jamvmMini$ cat compile.sh #compile launcher gcc myJVM.c -ljvm -L./jre/lib/jvm/jamvm/ #compile java.lang classes cd jre/classes javac java/lang/*.java cd ../../ #compile application javac Prog.java #compile jamvm launcher gcc myJVM.c -o jamvm-launcher -ljvm -L./jre/lib/jvm/jamvm/ jamvmMini$ cat run.sh #run launcher LD_LIBRARY_PATH=./jre/lib/jvm/jamvm/ ./jamvm-launcher Cheers Xerxes |