Execute a simple Java Console application

How to execute a simple java console program, with a main function?

Sometimes whe need to build a simple java program to test some concept/code/whatever.

So the code is something like (grabbed from stackoverflow for my quick reference):

Sun’s tutorial contains a complete demonstration, but here’s another one from scratch. You need two files:


public class Test {

   public static void main(String[] args){
      System.out.println("Hello world");
Then create a Manifest.mf file with the following content:

Manifest-version: 1.0
Main-Class: Test

Then compile the Java source file and create the jar file:

javac Test.java
jar cfm test.jar Manifest.mf Test.class
java -jar test.jar


Hello world

Glassfish Server quick start guide

There is a lot of documentation to read/browse to get what it’s needed to star using Glassfish Server for development…. Let’s do this in a QUICK way 🙂

So, this is for the Glassfish server that is installed with Netbeans 6.9.1 and on Windows. For Linux the only thing that changes is the start-up procedure.

To start the default domain:

1) Goto the install Glassfish directory /bin

2) asadmin start-domain domain1   -> this will start the default installed domain named domain1

To access the Administration Console.

1) Point your browser to: http://localhost:4848/login.jsf or http://server_name:4848/login.jsf

If by any chance you forget to put the login.jsp page an error creeps up: The requested resource (/common/index.jsf not found) is not available when trying to access the Glassfish Administration console. You have to specify the login.jsp page to make it work.

[K]Ubuntu and Netbeans 6.1 with Firefox 3.0

One annoying things that took some time to solve was that on the Start page of Netbeans there are URL’s to several articles, blog posts and so one, but every time I’ve pressed one of the it say’s that it could not execute Firefox.

I’ve checked the path, permissions, and so on but with no solution.

Well the issue is quite simple:

Goto Netbeans Tools menu and select the last option Options. It should start on the general tab where you select the browser you which to use.

Select Edit and on the arguments for Firefox remove whats there: -remote “openURL({URL})” and just keep the {URL} nothing else.

Save, close and it should work.

Now back to work…

IBM WebSphere interserver authentication: LTPA and SSL

On some applications J2EE applications deployed on WebSphere, you may have a two layer deployment: one server for the web layer and another server for the business logic layer. But for this to work you may need to enable global security and then to allow the communication between servers you need to setup LTPA between servers. On version 5.x and 6.0 just by moving the LTPA key from the business server to the application server and setting up the authentication method does the deal, and it has no need of intermediate steps to allow communication between servers.

On 6.1 version is not quite that simple, because RMI communication between servers runs now over SSL, and guess what: if an SSL session can’t be established, the communication is not possible.

The error message might be something like:  CAUGHT_EXCEPTION_WHILE_CONFIGURING_SSL_CLIENT_SOCKET: JSSL0080E: javax.net.ssl.SSLHandshakeException – The client and server could not negotiate the desired level of security. Reason: com.ibm.jsse2.util.h: No trusted certificate found vmcid: IBM minor code: E07 completed: No]

The key lead here is the “No trusted certificate found”, which means that an SSL session could not be established because of a missing server certificate.

The solution: On the IBM Websphere server that needs to communicate (in this case the server running the the web layer), execute the following steps:

1) Logon into the WAS console.

2) Goto Security -> SSL and Key Management

3) Select the NodeDefaultTrustStore and then Signer Certificates

4) Define your parameters, where the main information to be given is that the host must be the server you which to connect  to and the port is 9043.

5) Just give an alias name and press the button “Retrieve Signer Certificate”

6) Press apply and OK, and you’re done.

Try connecting again. It should work now.