Java From Matlab

I visited
http://www.cs.yale.edu/homes/spielman/ECC/javaMatlab.html
Now it's passed 3 days and I havent been able
to create my own objects.
I try the fist example and it works perfectly.
I run this program in Matlab:
function [] = Prueba();
wd = javaObject('scen1.WeatherData');
end
It is ok.
Then I tried this one
function [] = Prueba();
wd = javaObject('scen1.WeatherDataPepo');
end
and it says:
??? Error using ==> javaObject
No class scen1.WeatherDataPepo can be located on Java class path.
Error in ==> Prueba at 3
wd = javaObject('scen1.WeatherDataPepo');
WeatherDataPepo is originated by this java code:
package scen1;
import java.io.Serializable;
public class WeatherDataPepo implements Serializable {
public String city1name; //see source file a detailed description
public String city2name;
public Double[][] city1weather;
public Double[][] city2weather;
And then compilated using NetBeans IDE 5.0 with SDK 1.5.1
to produce WeatherDataPepo.class.
This file is in the same directory of WeatherObject.class which is the
one I downloaded from your WebPage. No matter this two class files
are in the same directory, one works in Matlab and the other one
doesn't.
This keeps happening when a try to create different objects using the same
compiler.
I'd appreciate very much if you can help me.
Thanks
Jose Alejandro Ospina

Perhaps you should ask your professor or contact the MathWorks support; this is a Matlab question and hasn't got a lot to do with Java...

Similar Messages

  • Calling Java from Matlab

    I create a java class:
    class MyClass
    int myField;
    public MyClass(int value)
    myField = value+1;
    and in Matlab I use
    a = MyClass(3);
    to call the class. I should get 4, but in stead, the result I get back is
    MyClass@1743ff4
    where did I do wrong? please help thanks.

    There is an error by putting "new" in the statement. I coded:
    a = MyClass(3).myField;
    It works. Hope this post helps Matlab and java programmer. Thank you very much I have been fighting this for decades.

  • How can I access the driver DLL,s from Matlab or Java?

    I would like to access a DAQpad-6016 from Matlab or Matlab via Java objects or via c-files. Is it any support for that? Is it any DLL-files to download or c-code? \Ake

    Hi Ake!
    I think the 6016 supports NI-DAQmx. If so, I started a thread
    http://forums.ni.com/ni/board/message?board.id=250&message.id=10165
    (opens in new window) that explains how to import the NI-DAQmx dll into Matlab.
    I'd be happy if it works for your card, too.
    Jens

  • ��Java with Matlab??

    Hi, I�m new in this group. I try to connect a Java interface with matlab, i use JBuilder and i try to use ActiveX but JBuilder 5.0 don�t support ActiveX. How can i do it?
    Excuse me for my bad English.

    You could just use the extern part of Matlab to implement an external invocation of the Matlab engine from a C or Fortran program.
    Now if you wrap this C implementation in Java through the JNI you would be able to invoke Matlab functions directly from Java.
    The other way around is directly supported from Matlab 5.3 and up.

  • How do i uninstall java from my MacBook Pro running Lion?

    I would like to uninstall Java from my Lion OS running MacBook Pro. *it got installed a while back while running a Java program, and due to Fashback and other holes, I would like it off of my system, other than a complete re-install, how do I remove it?
    Thanks in advance.

    CT wrote:
    Uninstalling Java on Lion
    There's a lot more installed than what that article says. The Java installation package includes much more than just:
    /System/Library/Java/JavaVirtualMachines/
    Take a look at the package with Pacifist.

  • I can not get the right frequency out of my NI-DAQ 6062E card from Matlab

    Hi.
    My name is Johan and I want to generate an analog square waveform with 5.76 kb/s in frequency with my NI DAQCard-6062E from Matlab.
    When I run in Matlab the program below, I get the frequency of 5.747 kb/s on the output channel (even thou I have chosen 5.76 kb/s). When I try to change the sample rate, to higher values in Matlab, I get the same frequency until I choose the sample rate to 5.79 kb/s. The output signal is in that case is 5.813 kb/s.
    So my problem is that I can't get the exact frequency of 5.76 kb/s.
    How do I solve this.
    Thankful for help.
    Best regards, Johan
    Program in Matlab:
    clear all
    openDAQ=daqfind; %Detect any open DAQ channels
    for i=1:length(openDAQ), %Close any open DAQ channels
      stop(openDAQ(i));
    end
    ao = analogoutput('nidaq',1); %Create an object for analog output
    addchannel(ao, [0 1]);
    set(ao, 'SampleRate', 2*5760); %Here the sample rate is specied. 2*, because to get right samplerate
    y=[80,-80] %Sets theoutput values to 80 and -80 (As -1 and 1)
    putdata(ao, [y' y']); %Sends the values to out buffer
    set(ao,'RepeatOutput',inf) %Repeats sending in infinity
    set(ao, 'TriggerType', 'Immediate'); %Choose trigger to immediate, because sending values shall occur driect after start command.
    start(ao);
    %stop(ao)

    Hello Johan!
    Bad news I am afraid….
    I assume you are using the Data Acquisition Toolbox from the Mathworks and when it comes to support on that interface I have to advice you to contact the Mathworks for assistance. We don't provide any support on their data acquisition interface since we have nothing to do with it.
    Sorry for the inconvenience this might cause you.
    Regards,
    Jimmie A.
    Applications Engineer, National Instruments
    Regards,
    Jimmie Adolph
    Systems Engineer Manager, National Instruments Northern Region
    Bring Me The Horizon - Sempiternal

  • Call java from ABAP

    JCo connectivity is used to call RFCs from Java. can i call Java from abap?
    thanks in advance.....
    regards,
    Sundararamaprasad

    Hi Sundar ,
             This link will surely give u an idea about calling java fro ABAP using Jco.
    http://www.thespot4sap.com/Articles/SAP_Netweaver_Java_Connector.asp
    regards,
    aravindh.

  • Should I remove Java from  my IMac?

    Should I remove Java from my iMac?  Heard  of security problem with Java and  wondered if I should delete it,

    MadMacs0 wrote:
    I've been going entirely on the almost universal statement that installing Lion does not install Java by default. I'm very aware of the fact that older versions of OS X actually rely on the use of Java for some system functions, but I've been told that is no longer the case. If that were so, then there is no need for any Java to be present, yet you say it is there and you aren't the only one who has told me that.
    But exactly how much Java is installed by default? Obviously not enough to use it for browsing. In the days of the Java 6 Preferences app, it used to alert you that Java was not installed and offer to do so.  What happens with standalone apps like CrashPlan in Lion that require Java, do they have enough, by default, to run?
    The only Java component missing in these OSs is the Java Runtime Environment (JRE). Peruse those installations, looking in these directories, and be enlightened:
    /Applicatons/Utilities/->Java Preferences.app
    /Library/Java/
    /Library/Internet Plug-Ins/->JavaAppletPlugin.plugin
    /System/Library/CoreServices/->
            Jar Launcher.app
            Java Web Start.app
            JavaVersion.plist
    /System/Library/Frameworks->
            JavaFrameEmbedding.framework
            JavaScriptCore.framework
            JavaVM.framework
    /System/Library/LaunchAgents/->
    com.apple.java.InstallOnDemand.plist
    com.apple.java.updateSharing.plist
    /System/Library/Java
    /System/Library/PrivateFrameworks/->
            JavaApplicationLauncher.framework
            JavaLaunching.framework
    to name a few, but probably not all the Java components installed with OS Xs. Then, stop saying Java's not installed, when only the JRE component is missing.
    There has been speculation from some that perhaps it migrated from an older system or that Lion was installed on top of the older system. There's also some confusion these days about what actually constitutes a "clean install".
    AFAICT, it's speculated wrongly. As for the clean install, I define it to occur when the user wipes the drive, installs the OS, sets up everything, and then installs all 3rd-party software. Then, the installation is clean. If there's any migration involved, then it's not clean. i've not done one for over ten years and my OSs started with 9.2->Jaguar->to the current three.

  • JNI (Java from C) -- multiple JREs installed, need to use non-default one

    Hello,
    I don't know how many Google/forum searches I must have tried -- I can't seem to find a solution to my problem.
    I am calling Java from C. We have two types of environments:
    (1) 1.3/1.4 mix, and
    (2) 1.4 only.
    The mixed environments are configured to use 1.3 by default. This configuration will not be changed. The original developer's code needs backported to the mixed environment, but it has been discovered that his Java code is not 1.3-compatible.
    Since the code is not compatible with 1.3, I need a way to bypass the default JRE setting and get JNI to start a 1.4 JVM. Is there a way to do this?
    Thank you for your help.

    My "solution" is a kludge. It attempts to compensate
    for what I thus far believe to be an apparent lack of
    functionality. I believe the functionality I
    described should exist in JNI so that little jewels
    like my "solution" are not needed. What I am doing
    is improper. Therefore, I respectfully disagree with
    you.Except that your OP suggested that if you could replace it with 1.4 then that would be suitable solution.
    So if that is a suitable solution and you can in fact modify the JNI code then that is a solution that meets all of your needs.
    Regardless however you will note that the "The Java Native Interface" book in chapter 7 provides a specific section which
    1. Specifically points out why you can't depend on a generic VM loading mechanism
    2. Provides a specific mechanism which is OS/Platform specific, for doing runtime loading of the VM presuming certain constraints are followed.

  • Java from Time Machine

    Hi all...
    Due to the recent Java update (From Apple), Java is disabled in web-browsers.
    Simple question is, how do I restore just the old version of Java from a Time Machine backup, without having to do a full restore of all my files?
    Thanks.

    You can't.
    MadMAC0 posted at https://discussions.apple.com/message/20107182?ac_cid=tw123456#20107182 that:
    Apple has posted (10/22/12) the approved solution for restoring the Java 6 plug-in:
    Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality.

  • Problem in generate Java  from PL SQL package in Jdeveloper

    Hi
    i have problem in create java class from PL SQL package in JDeveloper.
    I use Database navigator of jdeveloper and right click on a package and choose Generate Java then in Jpublisher window choose my view Controller and accept other default values.
    I call methods of generated class in the Action of a button in my JSP page, but when I click the button it  throw null pointer exception !!! i fund one of generated method return null and it lead to this exception.
    protected DefaultContext __tx = null;
    public DefaultContext getConnectionContext() throws SQLException  {
    if (__tx==null){
    __tx = (getConnection()==null) ? DefaultContext.getDefaultContext() : new DefaultContext(getConnection());
        return __tx;
      public Connection getConnection() throws SQLException
        if (__onn!=null) return __onn;
         else if (__tx!=null) return __tx.getConnection();
         else if (__dataSource!=null) __onn= __dataSource.getConnection();
         return __onn;
    i try to generate class in Model project and create DataControl for that and use method action but noting change and i get null pointer again!!
    Jdeveloper Versino = 11.1.1.7.0

    Let me ask you another question: Why do you generate java from the package at all?
    Where do you want to call the package?
    Back to your question: you should see code like
        public void setDataSourceLocation(String dataSourceLocation) throws SQLException {
            javax.sql.DataSource dataSource;
            try {
                Class cls = Class.forName("javax.naming.InitialContext");
                Object ctx = cls.newInstance();
                java.lang.reflect.Method meth = cls.getMethod("lookup", new Class[] { String.class });
                dataSource = (javax.sql.DataSource) meth.invoke(ctx, new Object[] { "java:comp/env/" + dataSourceLocation });
                setDataSource(dataSource);
            } catch (Exception e) {
                throw new java.sql.SQLException("Error initializing DataSource at " + dataSourceLocation + ": " + e.getMessage());
    in the generated code. This code look up a datasource (which you have defined e.g. on the Weblogic Server) by calling the method
    setDataSourceLocaltion("jdbc/HRConnDS");
    This look up the datasource nad stores it in the class variable.
    Timo

  • Calling labVIEW vi from matlab

    i want to pass data (modulated sine wave) from matlab into labview,
    transmit it (through the NI-DAQ card) into a channel, receive it back
    on the input port of the card and pass the data back from labVIEW into
    matlab. i built the vi and compiled the corresponding mex function.
    when called, the function runs without error but the problem is that i
    get back only noisy values and i have also verified with the help of a
    CRO that no actual wave is transmitted. i.e., it seems that the labVIEW
    vi doesn't actually run (though the LabVIEW window does open). this
    after i have selected the "load front panel" option in the vi
    properties. i might add that when i created a vi that uses the
    "simulate sine signal" tool of labVIEW itself to transmit a sine wave
    over the channel (As against using data from matlab, as in the former
    case) but receive the data into matlab only (as in the former case),
    the VI runs when called from matlab, the CRO shows sine waves being
    transmitted and received and the data i receive into matlab is an
    attenuated sine wave as expected. any MIT pro who can help me out?
    Thanks.

    It sounds like the problem is not that the VI isn't running, but rather that the data it is "receiving" from MATLAB is getting messedu up. This conclusion is drawn, of course, from the fact that simulated data can successfully be written and read in LabVIEW and passed to MATLAB using the same methods. The only way to get to the bottom of this dilemma is going to be to do some good, old-fashioned troubleshooting.
    Since we believe that the problem lies in MATLAB passing data to LabVIEW, the first thing you can try is putting a pause at the beginning of your LabVIEW code and creating a graph on the VI's front panel to show the data before it is written. If it is jumbled there, then you'll next want to check the data inside of MATLAB before it is passed. If that data is okay, then you've narrowed it down to the actual transfer, and you should then start making sure that you are matching the proper datatypes and formats. Hope this points you in the right direction!
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

  • Upgrade java from 1.2 to 1.5 on SunOS 5.8

    Hi,
    Can anyone help me to upgrade java from 1.2 to 1.5 on SunOS 5.8 ....
    Thanks
    G. Singh

    Can anyone help me to upgrade java from 1.2 to 1.5 on
    SunOS 5.8 ....Sure, download the installation file and run it, then follow instructions. If you need more help, I'd be happy to help for $150 / hour

  • Calling Java from Delphi

    Can ActiveX bridge used for calling Java from Delphi?

    Also trying to solve this problem, after creating the bean i packaged/registered it successfully, (tested the bean using beanbox, works perfectly) then tried calling it via createoleobject in delphi 7
    (*Code Snip *)
    Var
    v : variant;
    begin
    try
    v := createoleobject(Edit1.text); // my class name ie WorldPort.Bean (also tried WorldPort.Bean.1
    except on e:exception do
    showmessage(e.Message)
    end;
    end;
    (*Code Snip*)
    After this simple code failed i started backtracking , eventually after getting "Access Violation...etc in axbridge.dll" all the time. tried delphi "import activex control" got the same access violation.
    Decided to test the example from http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/examples.html........ they both crashed on execution (calc.exe and boundprop.exe).
    After this failed I tested these example classes on another machine, both crashed again.....
    Also tried this experiment in VC++ , after adding the class to the Toolbox , i try to drop it onto a form, once again access violation.**PS**
    ('You will need VC++ and the Microsoft SDK to build the dll, download c++beta for free from microsoft site it you need it')** and a simple cmd file todo the job would look something like this:
    echo - ** Build Java ActiveX Bridge **
    echo Make sure these folders exist in jre--> axbridge\lib and axbridge\bin
    cd\SDK\jre\axbridge\bin
    set path=%path%;C:\MSDN\Bin;C:\VisualC++\lib
    echo path
    javac WorldPort.java
    jar cmf Manifest.txt WorldPort.jar WorldPort.class
    "C:\SDK\bin\packager.exe" -clsid {162193C4-AD5C-4A06-9F88-A737AE9B43AD} -out "C:\SDK\jre\axbridge\bin" WorldPort.jar WorldPort-reg
    *** After running this cmd you will find the dll in bin folder and the jar in lib folder..***
    Must Read:http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
    Hope some of this helps , if you have successfully created / installed/ used a "JavaActiveX" in Delphi , i would really like to try replicate it on my machine..

  • ClassDefNotFound error when calling Java from C++

    Hi all,
    I have a problem with calling my java from C++ through JNI.
    I have set my CLASSPATH environment varible that include path to every libary that I need. My source is as follows:
    #include <jni.h>
    #include <stdio.h>
    int main()     
         JNIEnv               *env;
         JavaVM               *jvm;
         JavaVMInitArgs     vm_args;
         jint               res;
         jclass               cls;
         jmethodID          mid;
    IMPORTANT: specify vm_args version # if you use JDK 1.1.2 and beyond
         vm_args.version = JNI_VERSION_1_4;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         JNI_GetDefaultJavaVMInitArgs(&vm_args);
         /* Create the Java VM */
         res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         if (res < 0) {
              printf("Can't create JVM\n");
              return 1;
         cls = (env)->FindClass ("dds/test/comm/listeners/NACKListenerFrame");
         if (cls == 0)     {
              printf("Can't find NACKListenerFrame Class\n");
              return 1;
    mid = (env)->GetStaticMethodID(cls, "start", "()V");
         if (mid == 0)     {
              printf("Can't find NackListnerFrame.start \n");
              return 1;
         (env)->CallStaticVoidMethod((_jclass*)cls, (_jmethodID*)mid, NULL);
         jthrowable e = (env)->ExceptionOccurred();
         if (e)     {
              env->ExceptionDescribe();
              env->ExceptionClear();
         if ((jvm)->DestroyJavaVM() < 0)     {
              printf("Cannot destroy JVM./n");     
         return 0;
    I deliberately left out the codebelow because I want the JVM I created to load Classes from the system's CLASSPATH variable as I have set path to every classes that I need, in that CLASSPATH variable.
    JavaVMOption     options[1];
    options[0].optionString=
    "-Djava.class.path=.;E:/DDSproject/DDSImplementation/classes";
    vm_args.options = options;
    vm_args.nOptions = 1;
    But it seems like unless I specify CLASSPATH in my C++ source code the JVM could not find any classes.
    I tried to put the "jvm.dll" path to the first one in the System's PATH variable. It does not work either...
    Gurus Pls help!!!.. I don't know what to do... I don't wanna code my CLASSPATH in my c++ source code as above.
    Thanks in advance,
    chancellor

    I was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
    char* str1;
              char* str2;
              char* classpath;
              str1 = "-Djava.class.path=";
              str2 = std::getenv("CLASSPATH");
              classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
              strcpy(classpath, str1);
              strcat(classpath, str2);
              if (str2 == NULL)     {
                   printf("CLASSPATH environment variable is not defined.");
                   exit(1);
              m_VmArgs.version = JNI_VERSION_1_4;
              m_options[0].optionString= classpath;
              m_VmArgs.options = m_options;
              m_VmArgs.nOptions = 1;
              m_VmArgs.ignoreUnrecognized = JNI_TRUE;
              JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
              /* Create the Java VM */
              m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
              if (m_Res < 0) {
                   printf("Can't create JVM\n");
                   exit(1);
    thanks,
    chancellor

Maybe you are looking for

  • How to get time stamp as a number

    The get date/time vi gives time stamp in string or cluster. I want time stamp as number because i have to give time stamp number to a build array along with another number. How do i get this , say for example time as 14.32

  • My mini iPad will not connect when I facetime

    Help

  • Cracked screen... Cold weather?

    So last night I was using my phone and took it out of my sweatshirt pocket and noticed it was cracked after being outside in the cold. I hadn't dropped it or smashed it into anything. It looks as though I pressed the home button and it cracked up fro

  • Substitution for services

    Colleagues We need to create and FI substitution for services in order to apply the cost of them as if the purchase document had Account Assignment Categoryu201DJu201D instead the real u201CFu201D For us this mean that the cost will be applied to an

  • HANA text analysis in service tickets for product determination

    Hello, can anyone please tell me which prerequisites need to be fulfilled so that the automatic product determination using SAP HANA text analysis is working properly while creating a service ticket in SAP Cloud for Customer? So far I can only find c