Prev: Official rules for the FEX
Next: Write a function called addall in MATLAB that mimics the sum function?
From: Kevin on 21 Mar 2010 03:17 "Yair Altman" <altmanyDEL(a)gmailDEL.comDEL> wrote in message <hg7i8j$7lm$1(a)fred.mathworks.com>... > "Steven Lord" <slord(a)mathworks.com> wrote in message <hg70vk$dop$1(a)fred.mathworks.com>... > > > > "Michele" <denber.nospam(a)mindspringNOSPAM.com> wrote in message > > news:hg62cm$d73$1(a)fred.mathworks.com... > > > In another thread, I asked about a way to keep Matlab from hanging if you > > > try to access a web server that doesn't respond (see > > > http://www.mathworks.com/matlabcentral/newsreader/view_thread/164917#628434). > > > > > > The concensus seemed to be that by adding a line like: > > > > > > urlConnection.setReadTimeout(5000) ; > > > > > > to urlread, that would cause the needed timeout. In fact, someone posted > > > that > > > "I added this on line 96 or urlread.m (R2006b) and it works." > > > > > > However, it doesn't work for me (R13 v 6.5 in XP). If I say: > > > > > > methodsview java.net.URLConnection > > > > > > I get back a whole list of methods including various sets and gets, but > > > "setReadTimeout" is not among them. My copy of java.net is apparently > > > lacking this method. > > > > Apparently this method was added to the URLConnection class in a later > > version of Java than the one used by MATLAB 6.5 (R13). > > > > > Unfortunately, I don't understand where java.net comes from, and don't > > > know how to figure it out. Is it the case that I'm simply pointing to an > > > old version of this that lacks this method and needs to be updated from > > > somewhere? At java.com perhaps? Or is java.net something written by > > > Mathworks for Matlab? Do I need some new jar file? > > > > You need to use a newer version of Java -- since we only officially support > > each version of MATLAB with the version of Java that ships with that > > version, while you _could_ change the Java versoin for your installation I > > would recommend instead upgrading your installation to a later version. > > > > -- > > Steve Lord > > slord(a)mathworks.com > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ http://www.wikio.com/article/bad-credit-payday-loans-176415445 > > To expand on Steve's answer, setReadTimeout() only became available in Java 1.5 (which was bundled with Matlab R14SP2=7.0.4 and higher on Windows), as seen here: http://java.sun.com/javase/6/docs/api/java/net/URLConnection.html#setReadTimeout%28int%29 > > Your Matlab version, R13 (=6.5) only contains Java 1.3.1. You can try to use the newer Java version as explained here: http://www.mathworks.com/support/solutions/en/data/1-1812J/ > > However, note that using a non-default Java version might cause unexpected problems in your Matlab. > > Yair Altman > http://UndocumentedMatlab.com |