Alessandro Lacava’s Blog

Google
 

June 20, 2006

Using proguard obfuscator through the Wireless Toolkit

Filed under: Computer, Java, Java ME — alessandrolacava @ 10:53 pm

When you develop an application you might want to protect your code. A good way to accomplish this is using obfuscation. Proguard is a good open-source tool you can use for this purpose. To use it through the Wireless Toolkit (WTK), after downloading Proguard, you need to tell the WTK where it can find the obfuscator. You can do that by editing the file ktools.properties that you can find under %WTK%\wtklib\Windows, where %WTK% is the root directory of the Wireless Toolkit. Basically, you just need to add the two following lines to the aforementioned file: obfuscator.runner.class.name: proguard.wtk.ProGuardObfuscator
obfuscator.runner.classpath: proguard_path
where proguard_path is the absolute path to the proguard.jar file that you can find under the lib directory of proguard’s home folder. So the proguard_path will be (under a Windows system) something like: C:\\Programs\\proguard\\lib\\proguard.jar. After that, creating obfuscated code using the WTK is as easy as selecting Project->Package->Create Obfuscated Package from the WTK menu


How to play a .wav file in a mobile phone that supports J2ME

Filed under: Computer, Java, Java ME — alessandrolacava @ 10:33 pm

Reproducing a .wav file using a mobile phone is very easy. The following snippet of code is an example:

JAVA:
  1. import javax.microedition.media.*;
  2. import java.io.*;
  3. [...]
  4. try
  5. {
  6. InputStream is = getClass().getResourceAsStream(“audio.wav);
  7. Player player = Manager.createPlayer(is, “audio/X-wav”);
  8. Player.start();
  9. }
  10. catch(...)


Next Page »