maven one-jar-plugin output filename

The filename parameter allow one to change, guess what, the jar filename.

<plugin>
<groupId>org.dstovall</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<filename>${project.build.finalName}.jar</filename>
</configuration>
</plugin>

There are many more options. see source code

Poorman jnlp dynamic servlet

I was tired from changing jnlp codebase address between test and production environment. So I wrote this servlet that serves a jnlp file, but with the right codebase address, in accord with the server address.

Dont forget to set the jnlp mime-type (application/x-java-jnlp-file) in your jee server. I hope you like it.

=== JnlpServlet.java
package org.veiogaga;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class JnlpServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		String httpScheme = request.getScheme();
		String serverAdress = request.getServerName();
		int serverPort = request.getServerPort();
		String contextRoot = request.getContextPath();		

		response.setContentType("application/x-java-jnlp-file");
        PrintWriter out = response.getWriter();
        out.println(getJnlp(httpScheme,serverAdress,serverPort,contextRoot));
        out.close();

	}

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		execute(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		execute(request, response);
	}

	//adjust accordingly with your requirements
	private String getJnlp(String httpScheme, String  serverAdress, int serverPort, String contextRoot){

		//String codebase = "http://localhost:8080/MyApp/";
		String codebase = httpScheme+"://"+serverAdress+":"+serverPort+"/"+contextRoot+"/";
		String href =  "myapp.jnlp";

		        String jnlp = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"

                + "<jnlp codebase=\"%s\" href=\"%s\" spec=\"1.0+\">\n" //codebase

                + "<information>\n"
                + "<title>MyApp title </title>\n"
                + "<vendor>veioGaga Inc.</vendor>\n"
                + "<homepage href=\"http://www.example.org\" />\n"
                + "<description>This app will ghange the world</description>\n"
                + "<description kind=\"short\">just a little bit</description>\n"
                + "<offline-allowed />\n"
                + "</information>\n"
                + "<security>\n"
                + "<all-permissions />\n"
                + "</security>\n"
                + "<resources>\n"
                + "<j2se version=\"1.5+\" />\n"
                + "<jar eager=\"true\" href=\"jnlp/myapp.jar\" main=\"true\" />\n" 

                + "<jar href=\"jnlp/myapp.jar\" />\n"
                + "</resources>\n"
                + "    <application-desc main-class=\"org.veiogaga.app.WorldGui\" />\n"
                + "</jnlp>";

		return String.format(jnlp, codebase,href,httpScheme,serverAdress,serverPort,contextRoot);
	}
}
=== servlet

=== web.xml:
<servlet>
    <description> Generate JNLP dinamicaly</description>
    <display-name>JnlpServlet</display-name>
    <servlet-name>JnlpServlet</servlet-name>
    <servlet-class>org.veiogaga.JnlpServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>JnlpServlet</servlet-name>
    <url-pattern>/myapp.jnlp</url-pattern>
</servlet-mapping>

===

java plugin in ubuntu 12.04

IcedTea java plugin  is broken right now in ubuntu 12.04.
So I’ve downloaded java 7 from oracle and did:

sudo rm  /etc/alternatives/mozilla-javaplugin.so

sudo ln  -s /home/user/opt/jdk1.7.0_05/jre/lib/i386/libnpjp2.so /etc/alternatives/mozilla-javaplugin.so

And it works!
Test it with about:plugins in firefox.Hope it helps.

source: http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html

Esclarecimento espiritual

Cresci bastante, espiritualmente falando, nesse ultimo ano. Era um ignorante espiritual. Agora entendo a brevidade da vida na terra e a imortalidade do espirito. O tempo na Terra deve ser usado para ajudar o proximo para que esse tambem se torne um ser mais iluminado e pratique mais caridade.

Saiba mais: allan kardec, nucleo espirita segue jesus, racionalismo cristao, xico xavier.

linux e windows ao mesmo tempo! coLinux

coLInux XP network config

coLInux XP network config

Usando linux e windows ao mesmo tempo:

/cygdrive/c/coLinux
$ ./colinux-daemon mem=””1500M kernel=vmlinux initrd=initrd.gz cobd0=”\Device\Harddisk0\Partition3″ root=/dev/cobd0 cobd1=”\Device\Harddisk0\Partition4″ root=/dev/cobd0 eth0=”pcap-bridge,TAP-LAN” eth1=”tuntap,TAP-LOOP” eth2=”slirp”

Usa tres placas de rede . com LOOP Xming fica melhor.
mem=1500M , ate queria mas max=1G