Solved

Making & Running Pure Java Applications

Posted on 1998-07-29
4
166 Views
Last Modified: 2013-11-23
Hi there!,
Let me write you a little preface:
We want to migrate the major of our Microsoft client plataforms to X-Windows  subsystem (just PCs with Linux) , and we have to re-write all the frontend Apps (now in Borland Pascal For Windows) into X-Windows, there are 2 options (by now):
      1) Make a framework for the GUI(to X-Windows and MS-Windows) who maps the "painting" calls into the target plataform, in C++ language.
      2) Make the client Apps directly in JAVA.

I prefer the second way,  because of the support, portability and so on.

I got the jdk1.1.6 for Linux but when I make an Application (now a day I am writing the Apps just with vi, sure I will look for a good EDI) the Interpreter (java or jre) takes 22Mb size in memory! (Is there a super malloc for the bytecode?, what is this?), I know that is the JVM and so on, but is there other way to run the Apps?, I have seen J++, Turbo J, etc., what Is all about?.
The frontend machines are i486-DX33 8Mb running MS-Windows 3.11 and our Apps, and will migrate to Linux with X-Windows, but
      If a simple program takes 22Mb size, the linux box will freeze with our 20 frontend Apps!

These frontend Apps needs our network  binary protocol, Is there any problem to implement a class in Java just for read binary structs from the sockets (I think not, but you?)

Best regards,
0
Comment
Question by:Trickle
4 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1228884
22 Mb sounds a bit excessive for JVM. Are you sure it is not your program? Or maybe your measurement is incorrect. A few megs, maybe, but not 22.
0
 
LVL 16

Expert Comment

by:imladris
ID: 1228885
So far, we have required over 20 Meg to get our PC with Linux and X-Windows to run. We've got a substantial application by now (over 1 Meg in classes) but even with that we had been expecting to be able to fit into 8 Meg or at least 16. Unfortunately, so far, it does not seem possible. It is apparently this travesty that Personal Java is intending to address.

0
 

Author Comment

by:Trickle
ID: 1228886
I mean, I wrote a sample standalone Applet with a Frame and 2 buttons:
 - DummyDlg.java
 - Compiled with "javac DummyDlg.java": Ok applet compiled.
 - Run with the interpreter in the jdk-1.1.6 "java DummyDlg.class": Ok applet running.
 - Run the command "ps aux" and the result for the task is:
   !!SIZE=23648 (Virtual image size; size of text+data+stack)
   RSS=3400   (Resident set size; kilobytes of program in memory)

And that is what I mean, the SIZE of the interpreter running the applet. I thought that it was a malloc of the maximum needed size you know working virtual space, but I don't know :-(
 
0
 
LVL 3

Accepted Solution

by:
mjenkins earned 200 total points
ID: 1228887
> I prefer the second way,  because of the support, portability
> and so on.

Excellent choice IMHO.

> I got the jdk1.1.6 for Linux but when I make an Application
> (now a day I am writing the Apps just with vi, sure I will look
> for a good EDI) the
> Interpreter (java or jre) takes 22Mb size in memory! (Is there
> a super malloc for the bytecode?, what is this?),

Actually, what happens is that the JVM allocates all the memory
it needs for it's base "engine" and then allocates an additional
"heap" area in which to run your classes. There are defaults for
the heap and stack size which can be adjusted using command line
arguments (see the java documentation for the runtime).

> I know that is the JVM and so on, but is there other way to
> run the Apps?,

On the linux platform you really don't have a choice but to run
the JVM. Even the "kernel support" for java classes is just
another way to start up the JVM.

> I have seen J++, Turbo J, etc., what Is all about?.

None of these options is available for Linux.

> The frontend machines are i486-DX33 8Mb running MS-Windows 3.11
> and our Apps, and will migrate to Linux with X-Windows, but
> If a simple program takes 22Mb size, the linux box will freeze
> with our 20 frontend Apps!

First of all, don't be as concerned about memory usage on Linux
as you were on MS Windows. Linux makes very good use of it's
real and virtual memory space. You'd be suprised at how many
"large" applications I run concurrently with no problem at all.

That being said, here is a strategy that you may find useful:
When you start the java runtime with

java com.we.our.MyClass

the Java runtime gets loaded as does MyClass, and then MyClass.main( args ) is called.

One thing I've done in the past is to create a little class
starter class who's job it is to run other classes. I other
words, I have a class called ControlPanel which is used to
call MyClass1.main(args) and MyClass2.main(args) and
MyClass3.main(args) and so forth...

So you end up running many Java "applications" in a single
JVM. There is a caveat, of course. All of the applications will
share a common GUI thread and GUI event queue. You must make
sure that your applications are well behaved and
event-thread-safe.

> These frontend Apps needs our network  binary protocol, Is
> there any problem to implement a class in Java just for read
> binary structs from the sockets (I think not, but you?)

It's easy enough to open a DataInputStream, but you must take
care of any data conversions that are necessary.

I hope this helps.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now