equinox启动第二阶段的参数有三个:
1、PROFILE 默认的是true,这个参数值是固定的,没有提供更改的方法和途径。
2、STARTUP默认的是false,这个参数对应的是 启动选项osgi.debug 。
如果设置了启动选项 osgi.debug ,equinox启动时会在user.dir 也就是eclipse安装路径下装载 .options文件。
可以在.options文件中修改一些参数的默认值,如果设置 org.eclipse.osgi/profile/startup = true
会在控制台显示所有启动插件时的信息。关于.options文件请见下面的详细说明。
3、eclipse.ignoreApp
默认的值是false.
如果在启动参数中 "没有" 设置 eclipse.ignoreApp = true ,那么会运行EclipseAppLauncher.java。
关于EclipseAppLauncher 后面的文章会提到。
4、关于.options文件
eclipse带了一个.options文件,可以在eclipse的plugins目录下的 org.eclipse.osgi_$version.jar 中找到。
一个.options文件内容如下:
#### Debugging options for org.eclipse.osgi
# Turn on general debugging for org.eclipse.osgi
org.eclipse.osgi/debug=false
# Prints out class loading debug information
org.eclipse.osgi/debug/loader=false
# Prints out event (FrameworkEvent/BundleEvent/ServiceEvent) and listener debug information
org.eclipse.osgi/debug/events=false
# Prints out OSGi service debug information (registration/getting/ungetting etc.)
org.eclipse.osgi/debug/services=false
# Prints out bundle manifest parsing debug information
org.eclipse.osgi/debug/manifest=false
# Prints out LDAP filter debug information
org.eclipse.osgi/debug/filter=false
# Prints out security (PermissionAdmin service) debug information
org.eclipse.osgi/debug/security=false
# Prints out start level service debug information
org.eclipse.osgi/debug/startlevel=false
# Prints out package admin service debug information
org.eclipse.osgi/debug/packageadmin=false
# Prints out timing information for bundle activation
org.eclipse.osgi/debug/bundleTime=false
# Debug the loading of message bundles
org.eclipse.osgi/debug/messageBundles=false
# Eclipse adaptor options
org.eclipse.osgi/eclipseadaptor/debug = false
org.eclipse.osgi/eclipseadaptor/debug/location = false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin=false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver=false
org.eclipse.osgi/eclipseadaptor/converter/debug = false
### OSGi resolver options
# Turns on debugging for the resolver
org.eclipse.osgi/resolver/debug = false
# Prints out wiring information after the resolver has completed the resolve process
org.eclipse.osgi/resolver/wiring = false
# Prints out Import-Package information
org.eclipse.osgi/resolver/imports = false
# Prints out Require-Bundle information
org.eclipse.osgi/resolver/requires = false
# Prints out package grouping information form the "uses" clause
org.eclipse.osgi/resolver/grouping = false
# Prints out cycle information
org.eclipse.osgi/resolver/cycles = false
# Prints out Eclipse-GenericRequire information
org.eclipse.osgi/resolver/generics = false
#### Profile settings
org.eclipse.osgi/profile/startup = false
org.eclipse.osgi/profile/benchmark = false
org.eclipse.osgi/profile/debug = false
# Override the default implemenation
org.eclipse.osgi/profile/impl = org.eclipse.osgi.internal.profile.DefaultProfileLogger
# Append all profile messages to the filename specified
org.eclipse.osgi/defaultprofile/logfilename =
# Output all profile log messages synchronously to the jvm console.
# By default, all log messages are cached until the log buffer is
# requested.
org.eclipse.osgi/defaultprofile/logsynchronously = false
# Specify the size of the default profile implementation log buffer.
org.eclipse.osgi/defaultprofile/buffersize = 256
#### Monitoring settings
# monitor class loading
org.eclipse.osgi/monitor/classes=false
# monitor bundle activation
org.eclipse.osgi/monitor/activation=false
# monitor resource bundle (*.properties) loading
org.eclipse.osgi/monitor/resources=false
#### Trace settings
# trace class loading - snapshot the execution stack when a class is loaded
org.eclipse.osgi/trace/classLoading=false
# trace location - file in which execution traces are written
org.eclipse.osgi/trace/filename=runtime.traces
# trace filters - Java properties file defining which classes should
# be traced (if trace/classLoading is true)
# File format:
# plugins=<comma separated list of plugins whose classes to trace>
# packages=<comma separated list of package prefixes of classes to trace>
# Note that there may be many 'plugins' and 'packages' lines in one file.
org.eclipse.osgi/trace/filters=trace.properties
# trace bundle activation - snapshot the execution stack when a bundle is activated
org.eclipse.osgi/trace/activation=false
5、下面作一个小实验
A.环境准备
a)默认已经安装了Java 1.5以上的开发环境。
b)下载eclipse-equinox-3.3.1.1 http://download.eclipse.org/eclipse/equinox/drops/R-3.3.1.1-200710231652/download.php?dropFile=eclipse-equinox-3.3.1.1.zip
c) 在C:\下创建目录 osgi-dev,将 org.eclipse.osgi_3.3.1.R33x_v20070828.jar 复制到 C:\osgi-dev 目录中
B.执行过程
a)在命令提示符下执行以下命令:
> java -console -jar org.eclipse.osgi_3.3.1.R33x_v20070828.jar
几秒钟,osgi>提示符显示出来。
b)在osgi>提示符下执行 ss :
显示:
C:osgi-dev>java -console -jar org.eclipse.osgi_3.3.1.R33x_v20070828.jar
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.1.R33x_v20070828
osgi>
c)在当前目录下,创建一个文件,文件名为 .options
将上面的.options内容复制到文件中,修改这一句:
org.eclipse.osgi/profile/startup = true // 这里修改false 为 true
d)再运行
> java -console -jar org.eclipse.osgi_3.3.1.R33x_v20070828.jar -debug
会看到启动过程中bundle进入和退出的情况,当然这里只有一个,如果很多bundle输出会很壮观的 :)
原文链接:http://blog.csdn.net/teamlet/archive/2008/01/08/2031027.aspx