Java Stuff

Determine PID in Java:

exec java -Dpid=$$

Having started the Java interpreter as above, you'll be able to access the process id of the interpreter through the system properties:

String pid = System.getProperty("pid");

bytes, signed in Java

the byte data type is signed in java, to get the proper (unsigned) value into, say, an int:

byte b = (byte)0xFF;
int notSigned = b < 0 ? b+256 : b;

Internally, the Java VM uses int for boolean,byte, short and char anyway, so, consider using just using int to save yourself the trouble. Just make sure you throw out the high bits when you look at the value:

int notSigned &= 0x000000ff;

Oracle, jdbc-Driver, URL of

jdbc:oracle:thin:@$SERVER:1521:$SCHEMA

HTTP Proxies

One of the single most retarded aspects of Java. Use of the HTTP proxies by Java's HTTP implementation is governed by System Properties. Instead of using perfectly good existing environment variables (http_proxy), Sun decided to make up new names for it's system properties and not document them anywhere. The names were proxySet, proxyHost and proxyPost.

Later they realized their mistake and decided to change things aroung again to something else non standardized: http.proxyHost and http.proxyPort at least now you only need to set those properties and not a third one to inform the VM about the other two.

java -Dhttp.proxyHost=my.proxy.com -Dhttp.proxyPost=8080

Alternatively, it's possible to set the properties from within Java source code:

Properties props = System.getProperties();  
props.put("http.proxyHost","my.proxy.com") ;
props.put("http.proxyPort", 8080)

You'll eventually find an Overview of Networking Properties on Sun's Java site if you search long enough.

Comment on this page: