java and jar a couple years later!

Compile:

C:\src>javac systemtray\SystemTrayTest.java

Run:

C:\src>java -cp . systemtray.SystemTrayTest

Jar:

C:\src>jar cvmf ..\manifest.mf SystemTray.jar *

where manifest.mf has:

Manifest-Version: 1.0
Created-By: 1.7.0_03 (Oracle Corporation)
Main-Class: systemtray/SystemTrayTest <ENTER>

Run from Jar:

C:\src>java -jar SystemTray.jar

From a .cmd or .bat file:

@echo off
start javaw -jar C:\SystemTray.jar
exit

Using an image from the inside the .jar file, remember the / in the resource path!!!

imageURL = this.getClass().getResource(“/tray.gif”);

Ethernet:

import java.net.*;
import java.io.*;

try {

InetAddress thisIp = InetAddress.getLocalHost();
System.out.println(“IP:”+thisIp.getHostAddress());

}

Advertisements

~ by nambabwe on 2012/03/06.

 
%d bloggers like this: