Instead of defining those variables in the MyComputer/Properties/Advanced/EnvironmentVariable menu, just define them in the C:/autoexec.bat file .
set JAVA_HOME=c:\sdk\jdk_1.6.0
set CYGWIN_HOME=C:\dev\frag\bin\win32\cygwin\
REM set CYGWIN_HOME=C:\sdk\cygwin\
set HOME=c:/home/michaelz
set ANT_HOME=c:\sdk\apache-ant-1.6.5\
REM for some reason, I could split this line in several lines ...
REM set PATH=%CYGWIN_HOME%\bin;%PATH%
REM set PATH=%YOUR_KIT%;%PATH%Publish Post
PATH=%JAVA_HOME%\bin;c:\sdk\cmd;%CYGWIN_HOME%\bin;%ANT_HOME%\bin
Wednesday, July 11, 2007
Tuesday, July 3, 2007
Read User Input
Here's a simple way to read user input from the standard input (stdin) console:
/**
* Display the given prompt and return the text types by the user (after his first Enter)
* @param prompt text to write in the stdout. Generaly used for asking the user to type something.
* @return userInput - text given by user in the console (stdout)
*/
public static String readUserInput(String prompt) {
System.out.println(prompt + " ( Type to confirm.) ");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String userInput = "";
try {
userInput = bufferedReader.readLine();
if(log.isInfoEnabled()) {
log.info("Thanks ! ");
}
} catch (IOException ioe) {
log.error("Unable to read user input, Exception : " + ioe.getMessage());
}
return userInput;
}
JVM arguments
- JConsole
Enable jconsole by adding the following:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
The main argument is -Dcom.sun.management.jmxremote. It's not required anymore in JDK 1.6 . The other arguments are used for specifying explicitely the port number (7091). Useful for monitoring a JVM from a remote computer. - YourKit
For enabling YourKIT Java profiler, add
-agentlib:yjpagent to your JVM argument.
In addition, the YourKit/bin directory should be added to the path - Remote debug
For enabling remote debugger, add the following argument to the JVM:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044 - JPS for getting all the monitoreable JVM
Subscribe to:
Posts (Atom)