Java development under JNode
With the advent of the r/w ext2 file system implementation and a charva based simple text editor we are closer than ever to being able to write, compile and run Java programs inside JNode.
There is a free Java to bytecode compiler, kjc ( See) that could be used for this purpose. What we still need is a shell command that is able to start up a java program much like the java command does on other operating systems, starts up the specified class using the specified classpath, runtime properties and program arguments. The initial (not isolate based version of this) could work like any shell command does at the moment.
For a start I tried to modify current java command so that it wold use the current working directory as the classpath. First I tried with the URLClssloader but this method results in security exceptions before getting the the class that actually should be loaded. The I wrote a small classloader that finds the class data in the CWD and uses as parent classloader the current context class loader of the current thread. In this way the kjc begins to start up but ratehr early in the process I get an other error. The a certain point the kjc instantiates a class from the gnu.getopt package that on its turns tries to load the resource files of kjc (the messages of this compiler are localised for sever languages). However this resource file cannot be found. I also implemented the findResource method of my tinny class loader but later I noticed that in this case JNode does not use it for loading the required resource. The instantiation (the code that implements the new operation) somehow is under the hood of an other classloader and the resource cannot be found.
At the moment I have no idea how to get around this.
I just tried it with latest version of JNode and my class loader gets a security exception before loading any classes:
Permission "(java.lang.RuntimePermission createClassLoader)" not granted due to org.jnode.shell.JavaCommand$JCClassLoader
Sometimes it would be useful if the security could be disabled or if some code could have all permissions easily. I need some advice on this too.
With the modified java command the class that is to be run always is loaded by a new classloader. Is this enough for getting in recompiled at each start by JNode? If not how can I reinforce the recompilation of the newly loaded classes? This would be necessary for seeing the effects of my changes on the class between runs.
The possibility of developing in JNode could be useful from the day it is available. The testing, fixing, ( writing? ) of shell commands, applications like charvabsh and ping and many others that will come in the future could be done without restarting JNode. That would make a difference for the developers, wouldn't it?
In my opinion this looks like a reasonable short term goal that could probably be reached in a relatively short time especially of we could make unified effort for that.
Making easier the development of JNode could attract always more people to work on it.
Levente
- Login to post comments