Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Miscellaneous I<br />
In the future you also have the option of compiling your Swing classes to native code<br />
(viewed as a venerable evil by some some, but a practical solution by others) or<br />
performing other oprtimisation tricks that will see your GUI apps not only looking<br />
great and being cross-platform, but also performing well.<br />
It's what we call in the trade a no-brainer. Time to get Swinging young chap.<br />
-pip<br />
Q: Is it possible to create a Jar file that is not unjarable?<br />
Or only unjarable on a certain domain/server? Is the jar.exe JDK-specific (I don't<br />
believe so)? Was I just asleep at the command line and imagining the whole thing?<br />
Answer: You could conceivably encrypt a jar with a password, but you wouldn't be<br />
able to start the application from that jar. You could have another jar that actually<br />
knows how to decrypt it and creates its own decrypting class loader. Of course your<br />
startup jar could be hacked allowing someone to figure out how to decrypt the jar. So<br />
once again, you can slow down the process and make it more painful but you can't<br />
make it impossible.<br />
To make this workable it would probably be a lot easier to encrypt the files within the<br />
jar rather than the jar itself, since you need random access to the jar file, but only<br />
sequential access to the files within. It is more difficult to write a good random access<br />
encryption scheme. This would allow you to unjar the files, but the files would be<br />
unintelligible. You might also apply a cipher to the file names in the jar so someone<br />
would not know whether a file was a class or a resource file.<br />
--<br />
Dale King<br />
Q: How does the system find the path to JDK 1.2 after I type in "java -version"?<br />
I installed the jdk1.2 on a NT system, also VisualCafe4.1 with jdk1.3 was installed on<br />
the same system. After typing in "java -version" in a DOS window, I always see<br />
java.exe 1.2 is invoked even though I couldn't find the path to JDK 1.2 from the<br />
system environment parameters. How does the system find the path to JDK 1.2 after<br />
I type in "java -version"?<br />
The reason I ask this question because I want to invoke jdk1.3 under a DOS window<br />
without uninstall jdk1.2. I did add a path to jdk1.3 in system environment and reboot<br />
the system, but JDK 1.2's java.exe was still invoked after typing in "java -version" in a<br />
DOS window.<br />
Answer: Because when the JDK install kit placed the two programs java.exe and<br />
javaw.exe in the WINDIR and that's in the PATH. And these programs read the<br />
registry to find the JDK/JRE.<br />
If you placed jdk1.3\bin in the PATH before WINDIR, you should be fine. From your<br />
description, I guess you didn't, so you're still getting jdk1.2. Or you can directly<br />
execute jdk1.3\bin\java.exe which will work.<br />
Another trick I use to swap JDK's in an out is to place the directory named java\bin<br />
into the PATH and just rename the desired JDK to java, like this:<br />
c:\>dir j*<br />
Volume in drive C has no label<br />
file:///F|/350_t/350_tips/miscellaneous-I.htm (8 of 11) [2002-02-27 21:18:44]