Fun at work!

Archive for the ‘Java’ Category

Red5 restart failed after upgrading

After upgrading Red5 v.1.0.1 to Red5 v.1.0.5 on CentOS 6.6, starting the service displays OK status but stopping failed. In fact, starting was not successful, thus stopping fails. The main reason it that the latest version requires Java 8 to make it run. After upgrading Java, restarting Red5 works well.

 

 

Advertisements
Link

Repost: How to Sign a JAR File

Repost: How to Sign a JAR File

When JAR files need to be downloaded as part of a Java applet or Webstart deployment it is best to digitally sign the JAR files.

Signing with a Test Certificate

1. Make sure that you have a Java SDK keytool and jarsigner in your path. These tools are located in the Java SDK bin directory.

2. Create a new key in a new keystore as follows:

  keytool -genkey -keystore myKeystore -alias myself

You will be prompted for information regarding the new key, such as password, name, etc. This will create the myKeystore file on disk.

3. Then create a self-signed test certificate as follows:

  keytool -selfcert -alias myself -keystore myKeystore

This will prompt you for a password. Generating the certificate may take a few minutes.

4. Check to make sure that everything is okay. To list the contents of the keystore, use this command:

  keytool -list -keystore myKeystore

It should list something like:

  Keystore type: jks
  Keystore provider: SUN

  Your keystore contains 1 entry:
  myself, Tue Jan 23 19:29:32 PST 2001, keyEntry,
  Certificate fingerprint (MD5):
  C2:E9:BF:F9:D3:DF:4C:8F:3C:5F:22:9E:AF:0B:42:9D

5. Finally, sign the JAR file with the test certificate as follows:

  jarsigner -keystore myKeystore test.jar myself

6. Repeat these steps for all your JAR files.

Note that a self-signed test certificate should only be used for internal testing, since it does not guarantee the identity of the user and therefore cannot be trusted. A trustworthy certificate can be obtained from a certificate authority, such as VeriSign orThawte, and should be used when the application is put into production

Make sure you add the following tag to your .jnlp file:

  <security>
    <all-permissions/>
  </security>

How to install Apache ANT on Windows 7?

Apache Ant is a Java library and command-line tool that help building software. Here’s how to install Apache ANT on Windows 7.

1. Download the latest ANT zip archive at http://ant.apache.org/.
2. Unzip the package and rename the folder to “ant”.
3. Copy the “ant” folder to the desired location, say at the root of drive D.
4. Run the command prompt as Administrator and set the environmental variables for ANT and JAVA (Note: Set ANT_HOME to the uncompressed ant folder and JAVA_HOME to the Java JDK folder. If JAVA_HOME is incorrectly set, ANT cannot locate the needed tools.jar) as follows:

set ANT_HOME=D:\ant
set JAVA_HOME=D:\Program Files\Java\jdk1.7.0_09
set PATH=%PATH%;%ANT_HOME%\bin

5. Check whether ANT works correctly or not by using the command prompt.

ant -version

6. You’re done if you see the ANT version.

Screenshot of the example:

図1

How to display line numbers in Eclipse IDE?

By default, Eclipse’s editor does not display line numbers. Follow this simple guide to enable “Show line numbers”:

In Eclipse IDE, go to Window>Preference>General>Editors>Text Editors, and check Show line numbers. See screenshot below.

Eclipse Display Line Number

Tag Cloud