2

I am in need to test particullar JAR which has one domain hardcoded that it connects to. On my machine (freebsd) I cannot edit /etc/hosts to point to specific location that it will connect to (it'll affect more users, not just me) and therefore I have to think about other solution. Should I use some kind of utility?

1
  • This is perhaps better suited to Super User. Commented Mar 9, 2016 at 14:23

1 Answer 1

1

How about trying chroot, FreeBSD's jail or some virtualization, like VirtualBox or FreeBSD's byhyve?

Also have a look at this question on Unix & Linux.

The functionality you are looking for seems to be implemented in glibc. You can define a custom hosts file using the HOSTALIASES environment variable.

Edit:

Another solution would be to disassemble the JAR, update and then recompile. See this question about decompiling a JAR on SO.

Sign up to request clarification or add additional context in comments.

3 Comments

HOSTALIASES I tried. Doesn't work which leads me to believe it's different call from jvm. Virtualisation is limited here plus it's like getting cannon to kill a fly (I have ssh access to one of machines so having fun like this is not possible)
Then what about chroot? It's a bit simpler than jail. I also added an edit about disassembling the JAR and recompiling. Not sure if any specific tools could help as they would need to translate system calls. Some sort of virtualization is the only way that comes to my mind.
Well that seems worth trying although it's not guaranteed in any way. Probably setting this up will take me a while but I'll try it if everything else fails

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.