Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use java.io.tmpdir instead of user.home for storing extracted library #270

Closed
tarioch opened this issue Jun 12, 2017 · 3 comments
Closed

Comments

@tarioch
Copy link
Contributor

tarioch commented Jun 12, 2017

Currently the LibraryLoader uses "user.home" as the fallback, it would be nicer if it would use "java.io.tmpdir" instead.

@tarioch tarioch changed the title Use temp directory instead of user.home for storing extracted library Use java.io.tmpdir instead of user.home for storing extracted library Jun 12, 2017
@kernle32dll
Copy link

Well, you can do this pretty easily yourself:

String tempDirectory;

try {
  tempDirectory = Files.createTempDirectory("J2V8_temp").toString();
} catch (final IOException e) {
  // Temp dir creation failed - use J2V8 default
  tempDirectory = null;
}

V8.createV8Runtime(null, tempDirectory)

This creates a temporary folder "J2V8_temp" inside the systems tmp folder. We recently fell over this, because on Alpine (#252) user.home defaults to "/" - which fails to write to (at least in our Docker context).

@tarioch
Copy link
Contributor Author

tarioch commented Jun 13, 2017

In my case I'm actually using another library which in turn uses j2v8, but even though I can probably workaround it by manually initializing j2v8 first and then only use the other library.
But I think it still makes sense to change the default to be the tmpdir.

@matiwinnetou
Copy link
Contributor

I agree that default makes sense to tempDir. This is very easy PR you could contribute this @tarioch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants