unsupported major.minor version 解决方法

        一直以来都是用jdk1.5,这次重返电信由于其系统是在jdk1.4上编译的,编译的时候出现了unsupported major.minor version49.0的错误,上网查看了一下还是一个很普遍的错误,捣鼓了两天终于捣鼓出一些东西,现分享给大家。

     何谓 major.minor,且又居身于何处呢?先感性认识并找到 major.minor 来。顺便写一段 代码,然后用 JDK 1.5 的编译器编译成class,用UltraEdit或者其他能打开非十进制文件的软件打开此class,见下图:        



 从上图中我们看出来了什么是 major.minor version 了,它相当于一个软件的主次版本号,只是在这里是标识的一个 Java Class 的主版本号和次版本号,同时我们看到 minor_version 为 0x0000,major_version 为 0x0031,转换为十制数分别为0 和 49,即 major.minor 就是 49.0 了。
      现在不妨从 JDK 1.1 到 JDK 1.7 编译器编译出的 class 的默认 minor.major version 吧。(又走到 Sun 的网站上翻腾出我从来都没用过的古董来)

JDK 编译器版本 target 参数 十六进制 minor.major 十进制 minor.major
jdk1.1.8 不能带 target 参数 00 03 00 2D 45.3
jdk1.2.2 不带(默认为 -target 1.1) 00 03 00 2D 45.3
jdk1.2.2 -target 1.2 00 00   00 2E 46.0
jdk1.3.1_19 不带(默认为 -target 1.1) 00 03 00 2D 45.3
jdk1.3.1_19 -target 1.3 00 00   00 2F 47.0
j2sdk1.4.2_10 不带(默认为 -target 1.2) 00 00   00 2E 46.0
j2sdk1.4.2_10 -target 1.4 00 00   00 30 48.0
jdk1.5.0_11 不带(默认为 -target 1.5) 00 00   00 31 49.0
jdk1.5.0_11 -target 1.4 -source 1.4 00 00   00 30 48.0
jdk1.6.0_01 不带(默认为 -target 1.6) 00 00   00 32 50.0
jdk1.6.0_01 -target 1.5 00 00   00 31 49.0
jdk1.6.0_01 -target 1.4 -source 1.4 00 00   00 30 48.0
jdk1.7.0 不带(默认为 -target 1.6) 00 00   00 32 50.0
jdk1.7.0 -target 1.7 00 00   00 33 51.0
jdk1.7.0 -target 1.4 -source 1.4 00 00   00 30 48.0
Apache Harmony 5.0M3 不带(默认为 -target 1.2) 00 00   00 2E 46.0
Apache Harmony 5.0M3 -target 1.4 00 00   00 30 48.0

当然你也可以用其他方法查看版本号,比如javap -verbose XXXX(class名)。

        那么现在如果碰到这种问题该知道如何解决了吧,还会像我所见到有些兄弟那样,去找个 1.4 的 JDK 下载安装,然后用其重新编译所有的代码吗?且不说这种方法的繁琐,而且web应用程序还不一定能成功,其实大可不必如此费神,我们一定还记得 javac 还有个 -target 参数,对啦,可以继续使用 1.5 JDK,编译时带上参数 -target 1.4 -source 1.4 就 OK 啦,不过你一定要对哪些 API 是 1.5 JDK 加入进来的了如指掌,不能你的 class 文件拿到 JVM 1.4 下就会 method not found。目标 JVM 是 1.3 的话,编译选项就用 -target 1.3 -source 1.3 了。

      相应的如果使用 ant ,它的 javac 任务也可对应的选择 target 和 source

<javac target="1.4" source="1.4" ............................/>

如果是在开发中,可以肯定的是现在真正算得上是 JAVA IDE 对于工程也都有编译选项设置目标代码的。例如 Eclipse 的项目属性中的 Java Compiler 设置,如图:




 其实理解 major.minor 就像是我们可以这么想像,同样是微软件的程序,32 位的应用程序不能拿到 16 位系统中执行那样。


如果我们发布前了解到目标 JVM 版本,知道怎么从 java class 文件中看出 major.minor 版本来,就不用等到服务器报出异常才着手去解决,也就能预知到可能发生的问题。


其他时候遇到这个问题应具体解决,总之问题的根由是低版本的 JVM 无法加载高版本的 class 文件造成的,找到高版本的 class 文件处理一下就行了。

GetCapabilities Description: This method has been replaced by the more generic GetServices method. For capabilities of individual services refer to the GetServiceCapabilities methods. SOAP action: http://www.onvif.org/ver10/device/wsdl/GetCapabilities Input: [GetCapabilities] Category - optional, unbounded; [CapabilityCategory] List of categories to retrieve capability information on. - enum { 'All', 'Analytics', 'Device', 'Events', 'Imaging', 'Media', 'PTZ' } Output: [GetCapabilitiesResponse] Capabilities [Capabilities] Capability information. Analytics - optional; [AnalyticsCapabilities] Analytics capabilities XAddr [anyURI] Analytics service URI. RuleSupport [boolean] Indicates whether or not rules are supported. AnalyticsModuleSupport [boolean] Indicates whether or not modules are supported. Device - optional; [DeviceCapabilities] Device capabilities XAddr [anyURI] Device service URI. Network - optional; [NetworkCapabilities] Network capabilities. IPFilter - optional; [boolean] Indicates whether or not IP filtering is supported. ZeroConfiguration - optional; [boolean] Indicates whether or not zeroconf is supported. IPVersion6 - optional; [boolean] Indicates whether or not IPv6 is supported. DynDNS - optional; [boolean] Indicates whether or not is supported. Extension - optional; [NetworkCapabilitiesExtension] Dot11Configuration - optional; [boolean] Extension - optional; [NetworkCapabilitiesExtension2] System - optional; [SystemCapabilities] System capabilities. DiscoveryResolve [boolean] Indicates whether or not WS Discovery resolve requests are supported. DiscoveryBye [boolean] Indicates whether or not WS-Discovery Bye is supported. RemoteDiscovery [boolean] Indicates whether or not remote discovery is supported. SystemBackup [boolean] Indicates whether or not system backup is supported. SystemLogging [boolean] Indicates whether or not system logging is supported. FirmwareUpgrade [boolean] Indicates whether or not firmware upgrade is supported. SupportedVersions - unbounded; [OnvifVersion] Indicates supported ONVIF version(s). Major [int] Major version number. Minor [int] Two digit minor version number. If major version number is less than "16", X.0.1 maps to "01" and X.2.1 maps to "21" where X stands for Major version number. Otherwise, minor number is month of release, such as "06" for June. Extension - optional; [SystemCapabilitiesExtension] HttpFirmwareUpgrade - optional; [boolean] HttpSystemBackup - optional; [boolean] HttpSystemLogging - optional; [boolean] HttpSupportInformation - optional; [boolean] Extension - optional; [SystemCapabilitiesExtension2] IO - optional; [IOCapabilities] I/O capabilities. InputConnectors - optional; [int] Number of input connectors. RelayOutputs - optional; [int] Number of relay outputs. Extension - optional; [IOCapabilitiesExtension] Auxiliary - optional; [boolean] AuxiliaryCommands - optional, unbounded; [AuxiliaryData] Extension [IOCapabilitiesExtension2] Security - optional; [SecurityCapabilities] Security capabilities. TLS1.1 [boolean] Indicates whether or not TLS 1.1 is supported. TLS1.2 [boolean] Indicates whether or not TLS 1.2 is supported. OnboardKeyGeneration [boolean] Indicates whether or not onboard key generation is supported. AccessPolicyConfig [boolean] Indicates whether or not access policy configuration is supported. X.509Token [boolean] Indicates whether or not WS-Security X.509 token is supported. SAMLToken [boolean] Indicates whether or not WS-Security SAML token is supported. KerberosToken [boolean] Indicates whether or not WS-Security Kerberos token is supported. RELToken [boolean] Indicates whether or not WS-Security REL token is supported. Extension - optional; [SecurityCapabilitiesExtension] TLS1.0 [boolean] Extension - optional; [SecurityCapabilitiesExtension2] Dot1X [boolean] SupportedEAPMethod - optional, unbounded; [int] EAP Methods supported by the device. The int values refer to the IANA EAP Registry. RemoteUserHandling [boolean] Extension - optional; [DeviceCapabilitiesExtension] Events - optional; [EventCapabilities] Event capabilities XAddr [anyURI] Event service URI. WSSubscriptionPolicySupport [boolean] Indicates whether or not WS Subscription policy is supported. WSPullPointSupport [boolean] Indicates whether or not WS Pull Point is supported. WSPausableSubscriptionManagerInterfaceSupport [boolean] Indicates whether or not WS Pausable Subscription Manager Interface is supported. Imaging - optional; [ImagingCapabilities] Imaging capabilities XAddr [anyURI] Imaging service URI. Media - optional; [MediaCapabilities] Media capabilities XAddr [anyURI] Media service URI. StreamingCapabilities [RealTimeStreamingCapabilities] Streaming capabilities. RTPMulticast - optional; [boolean] Indicates whether or not RTP multicast is supported. RTP_TCP - optional; [boolean] Indicates whether or not RTP over TCP is supported. RTP_RTSP_TCP - optional; [boolean] Indicates whether or not RTP/RTSP/TCP is supported. Extension - optional; [RealTimeStreamingCapabilitiesExtension] Extension - optional; [MediaCapabilitiesExtension] ProfileCapabilities [ProfileCapabilities] MaximumNumberOfProfiles [int] Maximum number of profiles. PTZ - optional; [PTZCapabilities] PTZ capabilities XAddr [anyURI] PTZ service URI. Extension - optional; [CapabilitiesExtension] DeviceIO - optional; [DeviceIOCapabilities] XAddr [anyURI] VideoSources [int] VideoOutputs [int] AudioSources [int] AudioOutputs [int] RelayOutputs [int] Display - optional; [DisplayCapabilities] XAddr [anyURI] FixedLayout [boolean] Indication that the SetLayout command supports only predefined layouts. Recording - optional; [RecordingCapabilities] XAddr [anyURI] ReceiverSource [boolean] MediaProfileSource [boolean] DynamicRecordings [boolean] DynamicTracks [boolean] MaxStringLength [int] Search - optional; [SearchCapabilities] XAddr [anyURI] MetadataSearch [boolean] Replay - optional; [ReplayCapabilities] XAddr [anyURI] The address of the replay service. Receiver - optional; [ReceiverCapabilities] XAddr [anyURI] The address of the receiver service. RTP_Multicast [boolean] Indicates whether the device can receive RTP multicast streams. RTP_TCP [boolean] Indicates whether the device can receive RTP/TCP streams RTP_RTSP_TCP [boolean] Indicates whether the device can receive RTP/RTSP/TCP streams. SupportedReceivers [int] The maximum number of receivers supported by the device. MaximumRTSPURILength [int] The maximum allowed length for RTSP URIs. AnalyticsDevice - optional; [AnalyticsDeviceCapabilities] XAddr [anyURI] RuleSupport - optional; [boolean] Obsolete property. Extension - optional; [AnalyticsDeviceExtension] Extensions - optional; [CapabilitiesExtension2]这个接口该怎么回复一个支持media2的报文
10-12
【多变量输入超前多步预测】基于CNN-BiLSTM的光伏功率预测研究(Matlab代码实现)内容概要:本文介绍了基于CNN-BiLSTM模型的多变量输入超前多步光伏功率预测方法,并提供了Matlab代码实现。该研究结合卷积神经网络(CNN)强大的特征提取能力与双向长短期记忆网络(BiLSTM)对时间序列前后依赖关系的捕捉能力,构建了一个高效的深度学习预测模型。模型输入包含多个影响光伏发电的气象与环境变量,能够实现对未来多个时间步长的光伏功率进行精确预测,适用于复杂多变的实际应用场景。文中详细阐述了数据预处理、模型结构设计、训练流程及实验验证过程,展示了该方法相较于传统模型在预测精度和稳定性方面的优势。; 适合人群:具备一定机器学习和深度学习基础,熟悉Matlab编程,从事新能源预测、电力系统分析或相关领域研究的研发人员与高校研究生。; 使用场景及目标:①应用于光伏电站功率预测系统,提升电网调度的准确性与稳定性;②为可再生能源并网管理、能量存储规划及电力市场交易提供可靠的数据支持;③作为深度学习在时间序列多步预测中的典型案例,用于科研复现与教学参考。; 阅读建议:建议读者结合提供的Matlab代码进行实践操作,重点关注数据归一化、CNN特征提取层设计、BiLSTM时序建模及多步预测策略的实现细节,同时可尝试引入更多外部变量或优化网络结构以进一步提升预测性能。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值