在运行时设置CLASSPATH [英] Setting CLASSPATH during runtime

查看:451
本文介绍了在运行时设置CLASSPATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何设置CLASSPATH变量?

How do I set a CLASSPATH variable during runtime while using IKVM?

我一直在试图通过这样做: java.lang.System.setProperty(java.class.path,无所谓);

I've been trying to do it by using: java.lang.System.setProperty("java.class.path", "whatever");

我调用类需要在类路径的配置文件的工作 - 我记住这似乎表明,它并没有得到它的设置得到错误

The class I'm calling requires a configuration file in the classpath to work - and I keep getting errors that seem to indicate that it hasn't gotten its settings.

是我想补充的方式变量不正确?

Is the way I'm trying to add variable incorrect?

推荐答案

我试图做同样的事情。我不得不编译为.NET的DLL,但其中的一些(第三方)jar文件试图从Java类路径中加载它们的配置文件的一些jar文件。

I was trying to do the same thing. I had some jar files compiled to a .Net dll but some of those (3rd party) jar files were trying to load their configuration files from the java classpath.

我通过指定ikvmc工具-classloader选项解决了这个问题。例如:

I solved the problem by specifying the -classloader option for the ikvmc tool. Example:

ikvmc -out:mydotnetapp.dll -classloader:ikvm.runtime.ClassPathAssemblyClassLoader c:/myjavaapp/lib/*.jar

这为我工作!

源代码的解决方案: HTTP:/ /old.nabble.com/Not-able-to-load-files-from-ClassPath-td31141788.html

这篇关于在运行时设置CLASSPATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆