Eclipse编程Tips(2)-让RCP自带JRE
来源:互联网 发布:windows创建窗口 编辑:程序博客网 时间:2024/05/17 09:40
有些时候我们编写的程序可能会用到其它一些库,比如JAI, J3D等,而在默认JRE中并没有这些库。一种方法是在用户的客户端上安装这些库,但是还有另外一种简单的方法,那就是自带JRE,把这些库全部放进JRE的响应目录中。这样无论客户端安装什么版本的JRE,是不是有全部的库,我们的应用程序总能够通过自己的JRE运行。
其方法是在RCP目录中,自建一个目录,就叫<jre>,里面就放入集成的JRE,把需要的库全部统统放进去就可以了。
原来,在eclipse.c中,有查找shipped VM的代码,eclipse.exe会先查找有没有自带的JVM,有的话就用它启动:
/* Find the directory where the Eclipse program is installed. */
programDir = getProgramDir();
...
/* If the user did not specify a VM to be used */
if (vmName == NULL)
{
/* Determine which type of VM should be used. */
vmName = ((debug || needConsole) ? consoleVM : defaultVM);
/* Try to find the VM shipped with eclipse. */
shippedVM = malloc( (_tcslen( programDir ) + _tcslen( shippedVMDir ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) );
_stprintf( shippedVM, _T_ECLIPSE("%s%s%s"), programDir, shippedVMDir, vmName );
javaVM = findCommand( shippedVM );
/* Format a message to indicate the default VM search path. */
vmSearchPath = malloc( (_tcslen( pathMsg ) + _tcslen( shippedVM ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) );
_stprintf( vmSearchPath, pathMsg, shippedVM, vmName );
free( shippedVM );
shippedVM = NULL;
}
eclipseWin.h
_TCHAR* consoleVM = _T("java.exe");
_TCHAR* defaultVM = _T("javaw.exe");
_TCHAR* shippedVMDir = _T("jre//bin//");
这样就可以通过自带JRE解决客户端库不完全的问题。我们的项目正是采用这种方式。
其方法是在RCP目录中,自建一个目录,就叫<jre>,里面就放入集成的JRE,把需要的库全部统统放进去就可以了。
原来,在eclipse.c中,有查找shipped VM的代码,eclipse.exe会先查找有没有自带的JVM,有的话就用它启动:
/* Find the directory where the Eclipse program is installed. */
programDir = getProgramDir();
...
/* If the user did not specify a VM to be used */
if (vmName == NULL)
{
/* Determine which type of VM should be used. */
vmName = ((debug || needConsole) ? consoleVM : defaultVM);
/* Try to find the VM shipped with eclipse. */
shippedVM = malloc( (_tcslen( programDir ) + _tcslen( shippedVMDir ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) );
_stprintf( shippedVM, _T_ECLIPSE("%s%s%s"), programDir, shippedVMDir, vmName );
javaVM = findCommand( shippedVM );
/* Format a message to indicate the default VM search path. */
vmSearchPath = malloc( (_tcslen( pathMsg ) + _tcslen( shippedVM ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) );
_stprintf( vmSearchPath, pathMsg, shippedVM, vmName );
free( shippedVM );
shippedVM = NULL;
}
eclipseWin.h
_TCHAR* consoleVM = _T("java.exe");
_TCHAR* defaultVM = _T("javaw.exe");
_TCHAR* shippedVMDir = _T("jre//bin//");
这样就可以通过自带JRE解决客户端库不完全的问题。我们的项目正是采用这种方式。
- Eclipse编程Tips(2)-让RCP自带JRE
- Eclipse编程Tips-让RCP自带JRE
- Eclipse编程Tips-让RCP自带JRE
- 转贴:Eclipse编程Tips-让RCP自带JRE
- rcp嵌入Eclipse自带的console
- 让Java程序自带JRE
- 让Java程序自带JRE
- 让Java程序自带JRE
- 让java程序自带jre
- 让Java程序自带JRE
- 让Java程序自带JRE运行
- 屏蔽Eclipse自带快捷键 消除Eclipse RCP快捷键定义冲突之终极法
- 让hadoop-0.20.2自带的eclipse插件支持eclipse-3.5以上
- 使用rcp自带console输出信息
- 使用rcp自带console输出信息
- exe4j打包exe文件(自带jre)
- Eclipse RCP 概述 (2)
- Eclipse 自带打包
- 基于XML的动态N级联动
- 今天又去招聘会了
- 自动生成缩略图 (文档类别:JavaScript)
- 计划写些关于java的文章
- a good beginning
- Eclipse编程Tips(2)-让RCP自带JRE
- 如何从公共对话框控件中提取多个文件名称
- 软件项目经理所必需具备的素质
- ChouBill的blog
- 比较简便的中文乱码解决问题
- 即将大四的我送给低年级的朋友(转载)
- 解决用Visual Web Developer 2005编译asp.net 2.0项目时无dll文件的问题
- protege学习资料
- [翻译] Effective C++, 3rd Edition, Item 30: 了解 inlining(内联化)的来龙去脉(下)