matlab 出现nanbuilder for java build 时出现错误

Matlab Builder JA - java.lang.ExceptionInInitializerError
Subject: Matlab Builder JA - java.lang.ExceptionInInitializerError
Date: 5 Jan, :05
Message: 1 of 1
You can think of your watch list as threads that you have bookmarked.
You can add tags, authors, threads, and even search results to your watch list. This way you can easily keep track of topics that you're interested in. To
view your watch list, click on the &My Newsreader& link.
To add items to your watch list, click the &add to watch list& link at the bottom of any page.
How do I add an item to my watch list?
search criteria to your watch list, search for the desired term in the search box. Click on the &Add this search to my watch list& link on the search results page.
You can also add a tag to your watch list by searching for the tag with the directive &tag:tag_name& where tag_name is the name of the tag you would like to watch.
To add an author to your watch list, go to the author's profile page and click on the &Add this author to my watch list& link at the top of the page. You can also add an author to your watch list by going to a thread that the author has posted to and clicking on the &Add this author to my watch list& link. You will be notified whenever the author makes a post.
To add a thread to your watch list, go to the thread page and click
the &Add this thread to my watch list& link at the top of the page.
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Got questions?Get answers.
Join the 15-year community celebration.
Play games and win prizes!
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test
Discover what MATLAB (R) can do for your career.
Opportunities for recent engineering grads.
MATLAB Academy
On-demand access to MATLAB training.
What are newsgroups?
The newsgroups are a worldwide forum that is open to everyone. Newsgroups are used to discuss a huge range of topics, make announcements, and trade files.
Discussions are threaded, or grouped in a way that allows you to read a posted message and all of its replies in chronological order. This makes it easy to follow the thread of the conversation, and to see what&s already been said before you post your own reply or make a new posting.
Newsgroup content is distributed by servers hosted by various organizations on the Internet. Messages are exchanged and managed using open-standard protocols. No single entity &owns& the newsgroups.
There are thousands of newsgroups, each addressing a single topic or area of interest. The MATLAB Central Newsreader posts and displays messages in the comp.soft-sys.matlab newsgroup.
How do I read or post to the newsgroups?
MATLAB Central
You can use the integrated newsreader at the MATLAB Central website to read and post messages in this newsgroup. MATLAB Central is hosted by MathWorks.
Messages posted through the MATLAB Central Newsreader are seen by everyone using the newsgroups, regardless of how they access the newsgroups. There are several advantages to using MATLAB Central.
Other ways to access the newsgroups
Use a newsreader through your school, employer, or internet service provider
Pay for newsgroup access from a commercial provider
Use Google Groups
Mathforum.org provides a newsreader with access to the comp.soft sys.matlab newsgroup
Run your own server. For typical instructions, see:
Select Your Country
Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a location from the following list:
(Fran?ais)
(Italiano)
Switzerland
Asia Pacific
(简体中文)在java调用matlab时候遇到了错误
[问题点数:40分,结帖人apolloflying]
在java调用matlab时候遇到了错误
[问题点数:40分,结帖人apolloflying]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
本帖子已过去太久远了,不再提供回复功能。查看: 12221|回复: 23
【原创】MATLAB Builder For Java入门实例讲解
签到天数: 12 天[LV.3]偶尔看看II
如果在混合编程中有什么问题,如果您有什么好的经验请到及时和大家分享哦。如果有问题也欢迎与我交流:
本节教程主要提供一个简单的 Builder For Java的演示实例,在学习这个教程前,请先配置好您的Matlab Builder For Java运行环境,具体可以参考。
本次我们将一个AboutUs.m的M文件编译成Java的类,并在Java环境中测试运行。AboutUs.m文件就是在Command Window中显示出“MATLAB技术论坛”的介绍信息。function AboutUs
% By LaterComer of MATLAB技术论坛
% See also
% Contact me
% Modifid at
11:38:26
%
clc
info=char(...
'MATLAB技术论坛 | 仿真论坛 | MATLAB函数百科 | 最优秀专业和权威的MATLAB技术交流平台!',...
' ',...
'官方网址:&a href=&matlab:web
-browser&&&/a& net/cn/org',...
'服务邮箱:',...
'在线客服:',...
' ',...
'&a href=&matlab:web
-browser&&MATLAB技术论坛(Simulink仿真论坛)&/a&由西北工业大学航空学院dynamic同学于日创建,',...
'并在对论坛管理结构进行扩充和重组,新加入6名(yaksa,matsuper,yangzijiang,',...
'faruto,rocwoods,xiezhh)MATLAB高级爱好者!',...
' ',...
'MATLAB技术论坛是目前国内优秀、专业和权威的MATLAB技术学习和交流平台!',...
'致力为网友提供丰富的MATLAB教学资源、强大的MATLAB技术支持和全面的MATLAB有偿服务!',...
' ',...
'网站涵盖MATLAB教学,MATLAB安装,MATLAB经典教程,Simulink仿真科技,',...
'MATLAB函数速查,MATLAB汉化包,MATLAB电子,MATLAB读书频道,GUI界面开发,',...
'统计概率,拟合优化,混合编程,GPU高性能计算,神经网络,遗传算法,控制系统,',...
'图像处理,经济金融,信号通信,医药生物,数学建模,电子电力,汽车设计等几十个方面!');
disp(info);复制代码在演示之前,引用官方文字解释下两个名词:
What Is a MATLAB Builder JA Project?
To use the MATLAB Builder JA product, you create a project, which specifies the MATLAB code to be used in the components that you want to create. This product supports data conversion between Java types and MATLAB types. For more about projects and their contents, see Anatomy of a MATLAB Builder JA Project.
What Is a MATLAB Builder JA Component?
A component created by the MATLAB Builder JA product is a standalone Java package (.jar file). The package contains one or more Java classes that encapsulate MATLAB code. The classes provide methods that are callable directly from Java code.
一、生成Java组件
1、启动MATLAB,将上面的AboutUs.m保存到MATLAB的当前目录下,比如D:\Documents\MATLAB\JavaBuilder\AboutUSExample。
2、在Command Window中输入deploytool,打开发布工具。并填写或修改工程名称为AboutUsPrj,保存路径为D:\Documents\MATLAB\JavaBuilder\AboutUSExample,类型选择Java Pakage,并点击确定按钮。
JavaBuilder1.jpg (344.8 KB, 下载次数: 48)
13:36 上传
3、此时打开Java Package窗口,点击工具栏最后的“Action”按钮,并选择“Setting...”,将Package Name修改为AboutUsPck(默认情况,Package Name为工程名)。当然这个我们没有必要一定要修改,根据个人习惯哦。
JavaBuilder12.jpg (290.21 KB, 下载次数: 42)
13:37 上传
4、切换到“build”选项卡。在“Classes”栏,点击Add class为程序添加Java类,将类名Class1修改为AboutUsCls,如果要删除或者重命名Java类,可以右击类名进行操作。
JavaBuilder3.jpg (4.32 KB, 下载次数: 23)
13:36 上传
然后点击Add files,选择AboutUs.m文件,作为类的方法(method,说白了就是我们需要运行的M文件)。
JavaBuilder2.jpg (124.34 KB, 下载次数: 27)
13:36 上传
当然如果程序包含其他的数据、图片等资源文件,您可以添加到Shared Resources and Helper Files 栏。我们这个简单的演示程序就包含这些东西了。
总结下我们刚才的设置的Java Package程序的信息:
工程名:AboutUsPrj
类名:AboutUsCls
包文件名:AboutUsPck
编译文件:AboutUs.m
5、单击工具栏的“build”按钮对程序进行编译。编译时间根据自己计算机性能,一般在几分钟左右。此时这整个过程就完美结束了,是不是有点太小儿科了呀?
6、编译结束以后,在当前目录下生成了AboutUsPck文件夹,包含distrib和src两个子目录。distrib中的文件(特别是其中的AboutUsPck.jar文件,即编译的核心结果)就是Java Builder生成的可发布文件。AboutUsPck.jar其实是一个压缩包,我们可以使用WinRaR或者WinZip等软件打开。
JavaBuilder11.jpg (126.33 KB, 下载次数: 26)
14:38 上传
二、在安装MATLAB的计算机上运行Java包
1、打开系统命令提示符CMD.exe行并输入如下命令。
JavaBuilder5.jpg (73.63 KB, 下载次数: 27)
14:07 上传
2、先将当前目前切换到distrib目录,方便直接操作。cd /d D:\Documents\MATLAB\JavaBuilder\AboutUSExample\AboutUsPck\distrib复制代码3、调用JDK运行编译完的程序,D:\Program\MATLAB\R2011a\toolbox\javabuilder\jar\javabuilder.jar是MATLAB自带的javabuild的路径,逗号后面是刚才编译生成的包文件和对应的类java -classpath D:\Program\MATLAB\R2011a\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar AboutUsPck.AboutUsCls复制代码4、如果命令提示符返回如下信息,那说明编译测试运行成功。
JavaBuilder6.jpg (216.79 KB, 下载次数: 24)
14:07 上传
5、当然上面的dos命令可以在MATLAB中一次性输入: && cd AboutUsPck\distrib % 将当前目录切换到distrib文件夹
% 在MATLAB运行dos脚本命令,必须用!开头
&& !java -classpath D:\Program\MATLAB\R2011a\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar AboutUsPck.AboutUsCls
复制代码运行结果如下:
JavaBuilder7.jpg (502 KB, 下载次数: 36)
14:07 上传
三、在没有安装MATLAB的计算机上运行Java包
如果您的计算机没有安装MATLAB,此时您必须安装编译这个Java程序所对应MATLAB的MCR组件。
1、在MATLAB的Command Window中输入mcrinstaller,获取MCR的路径。
&& mcrinstaller
The WIN32 MCR Installer, version 7.15, is:
& & D:\Program\MATLAB\R2011a\toolbox\compiler\deploy\win32\MCRInstaller.exe
MCR installers for other platforms are located in:
& & D:\Program\MATLAB\R2011a\toolbox\compiler\deploy\&ARCH&
&&&ARCH& is the value of COMPUTER('arch') on the target machine.
Full list of available MCR installers:
D:\Program\MATLAB\R2011a\toolbox\compiler\deploy\win32\MCRInstaller.exe
For more information, read your local MCR Installer help.
Or see the online documentation at ' web site. (Page may load slowly.)
D:\Program\MATLAB\R2011a\toolbox\compiler\deploy\win32\MCRInstaller.exe
2、将这个MCRInstaller.exe连同刚才的AboutUsPck.jar一起发布给您的客户。如果要运行AboutUsPck.jar,请先安装MCRInstaller.exe。不妨假设MCRInstaller.exe安装在d:\Program\MCR,且AboutUsPck.jar保存到D:\javabuilder\AboutUsPck.jar。
3、当然您可以在那个deploytool的Java Package界面中直接打包那个MCR。
3.1 切换到Package选项卡,点击那个Add MCR链接。
JavaBuilder8.jpg (72.32 KB, 下载次数: 22)
14:34 上传
3.2 选择Embed the MCR in the package,确定。并点击工具栏倒数第二个Package按钮生成打包文件。
JavaBuilder9.jpg (116.33 KB, 下载次数: 26)
14:34 上传
JavaBuilder10.jpg (169.62 KB, 下载次数: 24)
14:34 上传
3.3 此时会将MCRInstaller.exe和distrib目录下的文件,自动打包生成一个AboutUs_pkg.exe的自解压文件,您将他发给用户就可以的。用户双击这个exe的时候会自动安装MCRInstaller.exe。
4、在Windows自带的命令提示符中输入如下命令(当然您的目标计算机上一定要安装JDK哦):
4.1 切换当前目录到AboutUsPck.jar所在目录cd /d D:\javabuilder\复制代码4.2 调用JDK运行编译完的程序,d:\Program\MCR\toolbox\javabuilder\jar\javabuilder.jar是MCR自带的javabuild的路径,逗号后面是Java包文件和对应的类java -classpath d:\Program\MCR\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar AboutUsPck.AboutUsCls复制代码4.3 如果命令行能够返回上面图片展示的效果,那祝贺您,成功了!
顶一下~ O(∩_∩)O
签到天数: 72 天[LV.6]常住居民II
非常喜欢这个系列!!
沙发围观!!
该用户从未签到
我照着楼主的做了,但是却出不来结果。
&& !java -classpath D:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar AboutUsPck.AboutUsCls
java.lang.NoClassDefFoundError: Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder/AboutUsPck/jar
Caused by: java.lang.ClassNotFoundException: Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar
& & & & at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
& & & & at java.security.AccessController.doPrivileged(Native Method)
& & & & at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
& & & & at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
& & & & at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
& & & & at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.AboutUsPck.jar.&&Program will exit.
Exception in thread &main& &&
签到天数: 12 天[LV.3]偶尔看看II
请当前目录切换到distrib 文件夹,然后在运行那个dos命令
该用户从未签到
这个我试过了,还是出现错误,并且错误在cmd中也是这样
签到天数: 1 天[LV.1]初来乍到
我也出现这样的问题 。& & 这个如何解呢?&&
网站官方,,,保证您有偿编程安全。
签到天数: 5 天[LV.2]偶尔看看I
同 niukun1989 & Truman 相同問題 麻煩版大解答 囧
签到天数: 333 天[LV.8]以坛为家I
还是出同样问题,不知道是什么原因。
网站官方,,,保证您有偿编程安全。
签到天数: 5 天[LV.2]偶尔看看I
楼主,我matlab版本是6.5,deploytool好像用不起来?必须是7.0以上??
该用户从未签到
您好!有问题参考附件.
我的jdk,环境配置都可以的。
说我没有权限发url.参考附件了。
15:57 上传
点击文件名下载附件
下载积分: 贝壳 -1
14.25 KB, 下载次数: 17, 下载积分: 贝壳 -1
网站官方,,,保证您有偿编程安全。
Powered by}

我要回帖

更多关于 matlab 出现nan 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信