首页 \ 问答 \ 如何在MacOS上获得干净的Java VM?(How to get a clean Java VM on MacOS?)

如何在MacOS上获得干净的Java VM?(How to get a clean Java VM on MacOS?)

在MacOS上(至少在SnowLeopard上),java命令无条件地将一个额外的jar添加到类路径中:

/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/.compatibility/14compatibility.jar。

该jar包含一个未命名的Apache Xerces + Xalan版本。 这可能会导致尝试显式使用这些库的某些其他版本的应用程序的混乱结果,特别是在servlet容器中的webapps中。

我试图通过使用MacPorts中的OpenJDK来避免这种情况,但MacPorts构建失败。

有没有人制定了一些其他的配方,除了删除该JAR文件的明显暴力? 这是在一个博客上推荐的,但是我担心一些Apple组件或其他组件在没有它的情况下会失败。


On MacOS (at least on SnowLeopard), the java command unconditionally adds an extra jar to the classpath:

/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/.compatibility/14compatibility.jar.

This jar contains a version of Apache Xerces+Xalan, unrenamed. This can cause chaotic results for applications that are trying explicitly to use some other versions of these libraries, particularly in webapps in servlet containers.

I tried to avoid this by using OpenJDK from MacPorts, but the MacPorts build failed for it.

Has anyone worked out some other recipe, other than the obvious violence of deleting that JAR file? It's recommended on one blog, but I fear that some Apple component or another will fail without it.


原文:https://stackoverflow.com/questions/1731726
更新时间:2023-09-28 07:09

最满意答案

该文件可以存储在任何地方,真的。 不过,我建议不要把它放在任何可以在线访问的地方。 通常,我最终将它放在例如/etc/nginx/.htpasswd

如果你想保护整个事物,这些行不应该在位置块中,而应该放在服务器块中。 喜欢这个:

... stuff

auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;

# FORGE CONFIG (DOT NOT REMOVE!)
... more stuff

该文件应由每个经过身份验证的用户使用一行代码组成,其中每行格式为username:encrypted-password 。 生成.htpasswd有很多种方法,我通常只是google的东西,例如http://www.htaccesstools.com/htpasswd-generator/

您也可以通过例如htpasswd实用程序创建它,但这是Apache服务器软件包的一部分,因此在您使用nginx时安装它是没有意义的。


The file can be stored anywhere, really. I recommend not putting it anywhere that's accessible online, though. Typically, I end up putting it in e.g. /etc/nginx/.htpasswd.

The lines should not be in the location block but rather in the server block if you want to protect the entire thing. Like this:

... stuff

auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;

# FORGE CONFIG (DOT NOT REMOVE!)
... more stuff

The file should consist of a single line for each authenticated user, where each line is in the format username:encrypted-password. There are many ways of generating the .htpasswd, I usually just google for something, e.g. http://www.htaccesstools.com/htpasswd-generator/

You could also create it through e.g. the htpasswd utility, but that's part of an Apache server package so it makes little sense to install it when you're using nginx.

相关问答

更多
  • Heureka,我自己想出来......或者我认为是解决方案。 ServerName my.domain DocumentRoot /var/sites/sitename/ ServerAdmin ... AuthUserFile /etc/apache2/.htpasswd AuthGroupFile /dev/null AuthNa ...
  • 完全相同的事情,只是省略-c选项。 Apache的文档在这里 。 htpasswd /etc/apache2/.htpasswd newuser 此外, htpasswd通常不以root身份运行。 它通常由网络服务器或正在服务的文件的所有者拥有。 如果您使用root来编辑它而不是以这些用户身份登录,那么这是可以接受的(我想),但是您需要小心确保不要以root身份创建文件(因此有root拥有它,没有其他人能够编辑它)。 Exact same thing, just omit the -c option. Ap ...
  • 我有像这样的.htaccess文件: AuthUserFile /data/www/.../http-users AuthType Basic AuthName "private" require user cf 它有效。 你能做什么: 通过查看错误日志来检测可能的原因。 在许多情况下,即使在托管环境中也可以访问它 确保已设置AllowOverride AuthConfig 。 您无法在.htaccess设置它,您必须在服务器配置文件中进行设置。 在托管环境中,您必须询问您的托管服务提供商。 不太可能, ...
  • 如果路径无效,您将收到500错误或其他内容。 由于浏览器提示输入密码,因此路径很可能正确。 但是,您需要确保正确生成htpasswd。 检查一下 - http://www.htaccesstools.com/htpasswd-generator/ If the path were invalid, you'd get a 500 error or something. Since the browser prompts for password, most likely the path is correc ...
  • 我找到了大于或等于2.4的apache版本的解决方案 AuthUserFile /home/www/.htpasswd AuthName "Acceso Privado" ...
  • 最后,解决方案如此简单... # password-protect single file AuthName "my_controller" AuthType Basic AuthUserFile /home2/afolder/.htpasswds/.htpasswd require valid-user 刚刚删除.php,一切都很好... Finally the solution was as simple as that... # pass ...
  • 该文件可以存储在任何地方,真的。 不过,我建议不要把它放在任何可以在线访问的地方。 通常,我最终将它放在例如/etc/nginx/.htpasswd 。 如果你想保护整个事物,这些行不应该在位置块中,而应该放在服务器块中。 喜欢这个: ... stuff auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; # FORGE CONFIG (DOT NOT REMOVE!) ... more stuff 该 ...
  • 只需将.htaccess文件放在要密码保护的目录中即可。 它是一个每个目录的配置文件。 Just put the .htaccess file in the directory you want to password-protect. It is a per-directory config file.
  • 好吧所以这个问题比我想象的要简单。 我正在使用不支持ssl的免费cloudflare dns指向。 我切换到使用namescheap dns,它开始工作。 okay so the problem was simpler than I thought. I was using the free cloudflare dns pointing which didn't support ssl. I switched to using the namescheap dns and it started worki ...
  • 看起来在AuthUserFile行中的目录和文件名之间有一个空格而不是斜杠。 Looks like there's a space instead of a slash between the directory and file name in the AuthUserFile line.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)