Miscellaneous I
pip
Q: Is it possible to create a Jar file that is not unjarable?
Or only unjarable on a certain domain/server? Is the jar.exe JDK specific (I don t
believe so)? Was I just asleep at the command line and imagining the whole thing?
Answer: You could conceivably encrypt a jar with a password, but you wouldn t be
able to start the application from that jar. You could have another jar that actually
knows how to decrypt it and creates its own decrypting class loader. Of course your
startup jar could be hacked allowing someone to figure out how to decrypt the jar. So
once again, you can slow down the process and make it more painful but you can t
make it impossible.
To make this workable it would probably be a lot easier to encrypt the files within the
jar rather than the jar itself, since you need random access to the jar file, but only
sequential access to the files within. It is more difficult to write a good random access
encryption scheme. This would allow you to unjar the files, but the files would be
unintelligible. You might also apply a cipher to the file names in the jar so someone
would not know whether a file was a class or a resource file.
Dale King
Q: How does the system find the path to JDK 1.2 after I type in "java version"?
I installed the jdk1.2 on a NT system, also VisualCafe4.1 with jdk1.3 was installed on
the same system. After typing in "java version" in a DOS window, I always see
java.exe 1.2 is invoked even though I couldn t find the path to JDK 1.2 from the
system environment parameters. How does the system find the path to JDK 1.2 after
I type in "java version"?
The reason I ask this question because I want to invoke jdk1.3 under a DOS window
without uninstall jdk1.2. I did add a path to jdk1.3 in system environment and reboot
the system, but JDK 1.2 s java.exe was still invoked after typing in "java version" in a
DOS window.
Answer: Because when the JDK install kit placed the two programs java.exe and
javaw.exe in the WINDIR and that s in the PATH. And these programs read the
registry to find the JDK/JRE.
If you placed jdk1.3\bin in the PATH before WINDIR, you should be fine. From your
description, I guess you didn t, so you re still getting jdk1.2. Or you can directly
execute jdk1.3\bin\java.exe which will work.
Another trick I use to swap JDK s in an out is to place the directory named java\bin
into the PATH and just rename the desired JDK to java, like this:
c:\>dir j*
Volume in drive C has no label
Volume Serial Number is 07CF 0B17
Directory of C:\
JDK12~1 2 03 19 00 1:57a jdk1.2.2
JDK13~1 0 12 21 00 1:42a jdk1.3.0
JDK11~1 8 06 16 00 2:29p jdk1.1.8
file:///F|/a_jsite/350_tips/miscellaneous I.htm (8 of 10) [2001 07 08 11:24:56]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved