Miscellaneous I
Answer: Spawn a thread that knows about the parent Window, and every X
milliseconds, executes the toFront () command of that window. Just remember to
execute it using SwingUtilities.invokeLater (), and don t
let your users launch two apps, unless you enjoy screen lockup.
Can a java application be run of a CD without installing anything (i.e. runtime, etc)
on the target computer?
I would like to put my application and hand it out as a demo, but I want to make it
easy to view.
Answer1: by 
Dale King
  The JRE was made so that it didn t need to be "installed".
What I did in one case was to simply put the JRE into a jre folder in the same
directory as my application then invoke it from that directory using:
jre\bin\jre.exe  cp MyJar.java MyClass
That was for JDK1.1 and you have to modify it slightly for Java 2. But this did not
require any installation of environment variables to be set up. The JRE was smart
enough to know how to get to its system classes relative to where the jre.exe file was
located.
Answer2: you could try a Java to native compiler.
 I would like to know whether it is possible to test the memory, so as to avoid the
OutOfMemoryError or whether it is possible to increase the amount of memory in the
JRM.
Answer: You can get the total and available memory used by the VM by making two
calls from the Runtime class:
   Runtime runtime = Runtime.getRuntime();
   long free = runtime.freeMemory(); //the available memory
   long total = runtime.totalMemory(); // the total for the JVM
The amount returned be totalMemory() isn t that useful unless you specify how much
memory your program will have from the beginning (if you don t, the JVM will just
keep grabbing more until you run out). 
You can set the initial and maximum memory from the command line:
java  Xms64m  Xmx64m name.of.Application
This will start your appplication with 64 megs initial and maximum memory.
  
Corey Wineman
What needs to be done to reduce size of a jar file? What optimization techniques
to use on classes inside the jar file? What tools if any?
Answer: A JAR file is a ZIP archive. You can influence its size by choosing the
degree of compression you want to have. This is usually defined by a value between
0 (no compression) and 9 (maximum compression). Although JAR tool does not list a
 9 switch, you might want to create compressed JARs with any ZIP tool like Winzip or
the free Info ZIP zip command line tool. 
The amount of reduction you get totally depends on the nature of your data. 
Note that if you use compression in your JAR file, loading goes slower (classes must
be decompressed).
Q: Is there any way to run code after the VM has been instructed to exit?
file:///F|/a_jsite/350_tips/miscellaneous I.htm (4 of 10) [2001 07 08 11:24:56]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved