when we make a connection using TContext object, to directories are created one called WMRepository2 and config. Is there any way to configure where the files get written? The problem is that in UNIX, the id executing the java class has no write access to the directory.
Do you mean your custom Java class that is using TContext? That would not need to have any sort of permissions to the IS directories. The IS user account used to connect and login to IS has no relationship to the permissions IS needs to run.
AFAIK, there is not a way to configure the WMRepository2 and config locations. The account under which Integration Server is running should have full permissions to the IS directory structure.
Let me know if I have misunderstood your situation.