Tuesday, August 7, 2007

Running a simple Java program on Windows

let's say you have:

// Toto.java
package com.mydomain.MyTest;
public class Toto
{
public static void main (String[] args)
{
System.out.println("hello");
}
}


then, you can create a BuildRun.bat like this:

REM BuildRun.bat
javac Toto.java
copy Toto.class com\mydomain\MyTest\
java.exe com.ltu.MyJNITest.Toto

To get directly the execution shell file that you need to run, you can get it from Eclipse:
http://stackoverflow.com/questions/2502518/eclipse-export-running-configuration
.

Saturday, August 4, 2007

%ProgramFiles% environment variable

%ProgramFiles% is not like the other environment variables. It is initialized by the system with the value of ProgramFilesDir at boot time, and cannot be changed after that.

Since ProgramFilesPath value is %ProgramFiles%, it has the same value also

"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"

Usually, I just restart the console and all environment variables are set to their correct value. You can see the value of all environment variables by doing "set" in the Windows console. But %ProgramFiles" is initialized only at boot time.

Creating an environment variable %ProgramFiles% from the control panel will not modify this behaviour, even after reboot.