"Ed's Compiled Java Library" is a library of classes written in C+ which mimic various
Java classes. The aim is to be able to write, test, and debug a non-GUI program in Java, and
then convert the Java source code into C++ source code. The C++ code is then compiled to
native binary.
Threads won't be implemented as long as I can write applications without needing
threads. For example, Threads are often used to handle socket connections in multi-user
servers. However, non-blocking sockets can be used to produce a non-threaded server.
Garbage Collection is not needed. When all references to an object go out of
scope, the memory allocated for that object's data is automagically deleted. Thus, the
system cleans up constantly, and the system uses less memory at any give time. Programs
runs smoother, a feature important in "real time" devices.
Object classes and hierarchy will mimic Java as much as needed.
The "Object" class is the root object, and all other classes inherit from it.
A GUI won't be implemented until I learn to use XWindows under Linux. The main
target is the server world. However, Java GUI's *can* use compiled C++ code via a number
of ways.
1 - Using JNI, a Java program can use C++ classes.
2 - One can "connect" a C++ program's stdin and stdout with Java's IO fairly easily. For
example, a C++ program which get it's input from the keyboard via cin, and sends it's output to
the screen via cout can instead be "hooked into" a Java program, where the Java program sends
stdin data to the C++ program, and reads back stdout data from the C++ program, such as:
... some java code ...
Process myProcess = Runtime.getRunTime().exec ("myCppProgram");
InputStream myIS = myProcess.getInputStream ();
OutputStream myOS = myProcess.getOutputStream ();
BufferedReader myBR = new BufferedReader (new InputStreamReader (myIS));
BufferedWriter myBW = new BufferedWriter (new OutputStreamWriter (myOS));
myBW.write("help\n"); // read by the C++ program's cin call
myBW.flush(); // flush the buffers to play it safe
String myString = myBR.readLine(); // gets this from the C++ program's cout call
int iStringLen = 0; // C++ program sends multi-line responses, last line is empty.
if (myString != null)
iStringLen = myString.length();
while ((myString != null) && (iStringLen > 0)) {
System.out.println (myString); // display a response line on-screen
myString = myBR.readLine(); // look for more lines
iStringLen = myString.length(); // see if C++ is done sending lines.
}
... more java code ...