Matlab program to Java application

Hi, I have to transform a Matlab program to a Java application (with a nice GUI). What's your opinion to the two possibilities:
1. Calling Matlab out of the java code with a library called com.mathworks.jmi. I don't find much on the net about it. Does anyone know if it works reliable and if I can get the three dimensional plots and present it in my java GUI?
2. All the existing Matlab scripts have to be rewriten into java. That looks like to much work to me. What would you use to present simple three dimensional bodies? Java 3D? Is there any nice library to use for 3D plots in a xyz coordinate system?
Thanks!

Hi,
I have worked few years back to call Matlab programs from Java. The only option i could find from the resources available then is to write a C program to make a call to this Matlab code, convert this C program to dll file and then call it using Java's JNI api.
If you feel the back end functionality implemented in Matlab is very complex and time consuming to convert into Java, then i would advice you to code all the UI related stuff in java and then make calls to back end in Matlab to display the info( in the form of graphs). But i should warn you that you should look for the mode to transfer info(like arrays) between Java and Matlab via JNI and dll files, also you should take care of multithreading. I should also warn you that this process is not very good in terms performance and response time.
But if you need good response time then i would advice you to code everything in Java. Hope this helps!!!

Similar Messages

  • Can we run EXE file/ Another Java Program from Java Application? How?

    Can we run EXE file and another java program from java application?
    Thanks in advance

    Example running adobe acrobat
    String command = "C:\\Program Files\\Adobe\\Acrobat 5.0\\Reader\\AcroRd32.exe /t "+selectedDocument+" \\\\CONTROL\\HP LaserJet 4L";
    Runtime rn = Runtime.getRuntime();
    Process process = rn.exec(command);
    process.waitFor();rykk

  • How to run windows program through java applications.

    pls help me!!!!! code RED!~

    C:\Documents and Settings\student\Desktop\Running.java:12: cannot resolve symbol
    symbol : variable JMStudio
    location: class Running
    String path="C:/Program Files/MF2.1.1/bin"+JMStudio;
    ^
    1 error
    this error is generated
    any idea on how to solve it?

  • Cannot run batch program from Java Application

    Hi All,
    Im trying to run a batch file under windows from my Java Program. The batch file is located in the following path:
    C:\Program Files\MyApp\runme.bat
    The above-entioned path contains white space which is not allowed in NT.
    Im trying following code:
    import java.io.*;
    public class Exec {
    public static void main(String args) {
    try {
    Runtime.getRuntime().exec("cmd /c start C:/Program Files/MyApp/runme.bat");
    }catch(Exception ex){ ex.printStackTrace();}
    How to run this file?
    Thanks in advance.
    Ketan Malekar

    or use the overload that takes an array of strings as argument
    String[] command = {"cmd", "/c", "start", "C:/Program Files/MyApp/runme.bat");
    Runtime.getRuntime().exec(command);

  • How can I execute an IE browser window from within my java application?

    I am programming a java application that requires me to execute a browser application and point to a specific web site. How can I do this? I cannot seem to find any examples on the web.

    Hi Heals,
    This forum is for discussing Measurement Studio for Visual Basic and is not really a good place to ask general purpose Java questions. I suggest searching one of the comp.lang.java.* newsgroups at http://groups.google.com/.
    Off the top of my head, though, I would say take a look at the Runtime.exec method.
    - Elton

  • Internet Accesses Freeze Java Application

    I have been programming a Java application, which is actually an instant text messaging system, that obviously makes internet accesses.
    The thing is, I have got this JFrame, with JScrollPanes, JTextAreas for messaging, and whenever the user presses the magical 'send' button; till the reply comes, the window freezes; you know it turns into grey.
    The way I send the messages is just to call the method that makes the connections and writes the data.
    How should I modify my code that my application should not freeze while waiting response? Is there a way to decrease the priority of a method or something?
    Thanks in advance..

    To clarify a bit.
    When you press the button an event is generated and put into the
    event handling queue (which handles all awt/swing events such as redraws/resizes etc). The Queue is processed by the event processing
    thread which pulls the button pressed event from the queue, finds
    the associated eventHandlers and calls them. What this means is that
    any code inside your event handler is run in the Event handling thread
    which causes it to not be able to handle any more events until the
    code in your handler is finished. Therefore all refreshes/button presses
    /resizes etc. (everything to do with the GUI and some other bits too)
    stop responding until your handler returns. Creating network connections
    can take a fair bit of time which means your handler takes a fair amount
    of time which means that the GUI locks up for a fair amount of time.
    Right, that there is the reason your GUI stalls.
    now, as pkwooster said, the way around this is to create a seperate
    thread that handles your connections to the internet. At the simplest
    level this thread can be created inside your "button pressed" event handler
    . For more complex solutions you will need to find someway of notifying
    a running thread that you have more work for it.
    pkwooster also said that there is a lot of code in this forum on topics
    related to the task you are attempting. You might wish to take his
    advice and look for it.
    matfud

  • Executing Java Application in another machine

    Hi all,
    I am programming a Java application which will eventually run in a different machine. This application uses the Communications API, so I wonder if it is necessary that the destination machine has the javax.comm.property and win32com.dll files installed. In that respect, the target machine will have a certain version of JRE installed, in which folders should I install those files.
    Having said that, I would appreciate if someone could also enumerate good practices to ensure an application will successfully run on different machines
    Regards.

    My problem is that if there is a new PC , nothing installed in it, can I launch a java application in it ?
    My friend asked me if I can build an application in java which I can use in any PC and the application will do something like an installation. In fact he wants to know if java can build an installation like application which will install for example a software on a new PC.
    I think I told you more clearly the situation.

  • A Java application how to pass Microsoft OEM Ready program?

    Hello,
    I have a Java application that needs to pass OEM Ready program, but it fails on AppVerifier item. The error messages are:
    "Freeing memory block inside current thread's stack address range."
    "First chance access violation for current stack trace."
    These errors are occurred by JVM. Anybody understands a Java application how to pass AppVerifier? Thanks in
    advance.
    p.s. The Java application is only a simple "Hello World" program.
    p.s. I also test many popular Java applications (such as JBuilder/NetBeans), they
    also cannot pass AppVerifier.
    p.s. The OEM Ready Program web site: http://msdn.microsoft.com/en-us/windowsvista/cc315067.aspx

    One small update. These errors are reported by AppVerifier tool. But the origin of the errors seems to be coming from JNI Calls. Basically AppVerifier is a runtime verification tool and helps in monitoring an application's interaction with OS, the registry, the file system,heap, handles, locks, and more and reports the errors found.
    And when I check my application ( which interacts with few .jar files using JNI calls ) with AppVerifier, it is reporting the errors, upon debugging I found the source of the errors to be the JNI calls. Any idea about the reasons and fix for these errors.
    I thank you in advance.

  • How to remove Java Applications from "Add and Remove Programs" list?

    I have deployed my Java applications (both JWS and Applet) via JNLP with allow-offline option enabled and without installer-desc option specified.
    My questions are:
    1. An entry is added to the Add and Remove Programs list after launching the application via JNLP. Is it due to the specification of JNLP or JWS? Is there anyway to prevent this behavior?
    2. I removed my application by clearing the cache via Java Control Panel but the entry for the application is still listed in Add and Remove Programs. How can I remove the entry in the Add and Remove Programs?
    I have tried following methods but neither works:
    1.Go to Add and Remove Programs, and click [remove] button to the right of my application.
    *Warning message like 'Application cannot be uninstalled completely' is thrown.
    2.Follow instructions listed @ [Microsoft Online Support site|http://support.microsoft.com/kb/314481/en-us] to remove my application manually via Windows registry.
    *Couldn't find appropriate registry entry to delete.
    Thanks in advance!

    Hi, guys!
    This issue has been officially approved as a new bug (Bug Id: 6946221) for the JDK 1.6_20(might include any release below) release.
    It will take a couple of days for it to be shown up in the external Bug database. However, once it becomes available for viewing on external Bug database.I would like to encourage your valuable participation to vote on this bug to get it fixed ASAP by the SUN developer teams.
    Java Bug Database @
    [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6946221|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6946221]
    Voting for the bug @
    [http://bugs.sun.com/bugdatabase/addVote.do?bug_id=6946221|http://bugs.sun.com/bugdatabase/addVote.do?bug_id=6946221]
    Thank you for your cooperation!
    Edited by: Jay-K on Apr 23, 2010 12:14 AM

  • I want to run a streaming quotes program on Scottrade. They tell me that their product does not work if I have more than one Java application on my Mac. How do I delete the older versions? Thanks

    I want to run a streaming quotes program on Scottrade. They tell me that their product does not work if I have more than one Java application on my Mac. How do I delete the older versions? Thanks

    I have the same problem, they never told me that, just that the newest version of Java "locks" up streaming quotes.

  • How do I start and suspend Java Application from say C++ program

    I want to start a Java application via C++ and on some condition i want to suspend the same program not terminate , but suspend

    Have you tried running the virtual machine from your C++ application ? You can start Java applications from your C++ application using JNI after starting the Virtual machine from within your C++ application. According to the Java documentation you can even now stop the virtual machine from within your C++ program.
    I haven't looked at the 'suspend' detail but I suppose it will not be a problem to call a method via JNI to set a flag to suspend a thread etc.
    There is a tutorial: 'Invoking the Java Virtual Machine' at the following URL: http://java.sun.com/docs/books/tutorial/native1.1/invoking/invo.html.
    This example seems to work only for version1.1 of the JDK. For JDK1.3, version 1.2, (I am not so sure whether I fully understand Sun's version numbers for Java yet) there is some updates on the JNI for starting the VM from C++. This article is called 'JNI Enhancements'. The URL for this article is:
    http://java.sun.com/j2se/1.3.0/docs/guide/jni/jni-12.html
    You have to set version to: JNI_VERSION_1_2
    There is only one problem. I get an error when calling JNI_CreateJavaVM from C++. I could not find any documentation that indicates how you can go about diagnosing what is causing the problem. Normally in Visual C++ you can just get the probable cause by inspecting GetLastError() or the function itself can return helpful diagnostic (error) codes.
    If you manage to start the VM correctly from within Visual C++ please let me know. My email address is [email protected]
    good luck
    Henko

  • How can my java program launch other applications?

    can anyone link me, provide some keywords, or information on how a java program can execute another program... for example, a button click would launch acrobat, firefox, or (in particular) another java application.

    don't read all that much fantasy.
    I've read Eddings' Belgariad and Malloreon, which I really liked at the time but which are not even in the same league as GRRM. The characters are much more one-dimensional, and the plot gets cornier as you go along.
    IVE READ BELGARIOD... AGREE THAT IT WAS PRETTY SHALLOW AND I READ IT AFTER LOTR SO IT WAS SUCH A PALE RIPOFF IN COMPARISON
    His Elenium and Tamuli series were a little better, but still far from Ice and Fire.
    Tolkein, of course, but you've probably heard of him. :-)
    Donaldson's Mirror of Her Dreams and A Man Rides through were good.
    HAVENT READ THESE, WILL ADD TO MY LIST, THANKS!
    Terry Brooks' Shanara series is supposed to be pretty good, and I think Anne McCaffery's Dragonriders of Pern series is considered to be among the classics, but I've never read either one.
    READ SOME BROOKS AND FOUND IT SHALLOW LIKE EDDINGS. HAVE READ MCCAFFERY BUT NOT DRAGONRIDERS, AND THE TRILOGY I READ WAS OK BUT THE TONE WAS REALLY GOOFY. A GROUP OF REFUGES ON A NEW PLANET AT A TIME WHEN THE HUMAN RACE IS ENSLAVED BY ALIENS, AND THE BOOK SEEMED TO FOCUS ON HOW FUN BUILDING A CAMP WAS ON THE NEW PLANET AND EVERYONE WAS REALLY PEPPY WHICH FELT ODD GIVEN THE CIRCUMSTANCES OF THE SETTING.
    Michael Moorcock's Elric series was very good, also very dark. It was kind of... I don't know... odd. Like you'd want to light up a bong and put on some Floyd while reading it.
    HAVENT READ EITHER, ANOTHER FOR THE LIST, THANKS AGAIN!
    There's another series of 2 or 3 books that I read a few years ago and really liked, but I can't for the life of me remember the author, the books, any characters names...
    P.S. If you want to talk about a nag of a female character, you gotta love (as in hate) Cersei. She gets her on POV in Feast. Good stuff.
    YEAH I LIKE CERSEI ACTUALLY. GRRM IS GOOD IN HOW THERE REALLY IS NO MAIN CHARACTER AND EVERYONE IS VERY EXCITING TO READ. RJ ON THE OTHERHAND HAS A DEFINATE CENTRAL CHARACTER TO THE PLOT, AND CHAPTER AFTER CHAPTER OF SOME OF THE FEMALE POV'S GOT AGGRAVATING ESPECIALLY WHEN THEY NAG SO MUCH THE TRUER HEROS OF THE STORY (MY OPINION)... ITS LIKE, SHUT YOUR MOUTH AND LET THEM SAVE THE DAY ALREADY... HEHE... BUT YOU'LL SEE OR HAVE A DIFFERENT OPINION ENTIRELY.
    to you i recommend orson scott card... you've probably read ender's game but he has some really good fantasy too... the homecoming series (first book call of earth or memory of earth) was really good, and the alvin maker series is ok plotwise but the characters are incredible... i found a lot of humor and witty dialog in that series and enjoyed it immensely. anyways, thanks again for the list additions, will read feast of crows first, hopefully soon. glad to hear you're liking it... some reviews on amazon weren't stellar.

  • Trying to call a program within a Java application

    Hi,
    I am trying to call a program from within a Java application.
    Here's my code:
    // the program siftwin32 takes it's input via < and outputs using >
    String command = "C:/Demo/siftDemoV4/siftDemoV4/siftWin32.exe < c:/demo/query.pgm >c:/demo/query.key";
    Process p = Runtime.getRuntime().exec(command);
    int val = p.waitFor();
    The program "siftwin32" never executes. That is, the .key file is never generated. The value returned from the waitFor() is 1 which I know is bad.
    I'm not sure what the problem is. Running siftwin32 from the command line works fine.
    Any help would be greatly appreciated!
    Thanks,
    Neal
    Edited by: nealchecka on Nov 28, 2007 10:01 PM

    It's probably being executed; you're just passing it bad arguments and confusing it.
    The < and > operators are something that the shell uses. They're not arguments to programs typically. When you run it from the command line, it's going through a shell (the command line is the shell, that is to say a program for running other programs).
    When you run Runtime.exec, it doesn't go through the shell. The program is executed directly. If you use the version of exec() that takes a single string argument, the string is tokenized on whitespace and the tokens are used as the executable and its arguments.
    You have a few options.
    One is to write a shell script (or I guess a batch file on windows) that does the i/o redirection, and invoke that script.
    Another can be to send all these arguments to the shell by passing them on the command line to the shell, or to "start" or something (I'm not sure about what Windows does specifically). You can find examples online.
    Or you can do the redirection yourself, in the Java program. After you exec, use the resulting Process object to get the standard input, standard output, and standard error streams, and write/read/read those streams. If you like you can read from or write to files with those streams. Personally I generally prefer this option, since it has less dependency on the OS, and it's more flexible, and it's more tightly integrated into the Java class.

  • Iwant the following  program to be visible  as Java Application

    Hi for all
    Iwant the following program to be visible when it is runned in java application
    the program is compiled correctly , but when it is runned as an application the, following message appears
    press any key to continue...
    That is a common problem for me
    can someone explain for me
    import java.awt.*;
    import javax.swing.*;
    class sandi extends JMenuBar {
         public sandi(){
              JMenu fileMenu = new JMenu("File");
              JMenu editMenu = new JMenu("Edit");
              JMenu otherMenu = new JMenu("Other");
              JMenu subMenu = new JMenu("SubMenu");
    JMenu subMenu2 = new JMenu("SubMenu2");
    add(fileMenu);
         add(editMenu);
         add(otherMenu);
              setVisible(true);}
    public static void main(String [] args){
              sandi rami=new sandi();

                   JFrame frame = new JFrame("test");
                   frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                   frame.setSize(300, 300);
                   JMenuBar menuBar = new JMenuBar();
                   menuBar.add(new JMenu("test"));
                   frame.setJMenuBar(menuBar);
                   frame.setVisible(true);

  • Start java application from java program

    My problem is the following:
    I start a java application A that allows you to select a couple of .java files.
    After having choosen them, the application adds some additional information to these .java files (that means some more lines of code � we call it �infecting� the java files).
    After the files have been infected, I want to start the application B implemented by these choosen and infected .java-files (without a new start of the Java Virtual Machine)
    For doing so, we use the following method whichs works quite fine:
    public static void ExecuteWithInvoke(String path, String classname)
         try
              new URLClassLoader(new URL[] {new File(path).toURL()})
                   .loadClass(classname).getMethod("main",
                   new Class[] { String[].class }).invoke(null,
                   new Object[] { new String[] {} });
         catch (Exception e)
         {e.printStackTrace();}
    The only problem that occurs:
    When the application B is launched, the �old� version of the choosen .java files is used and not the current, already infected version of these files. (I guess because the �old� .class files are used.)
    I solved this problem by finishing the program A after the infecting and restart my application B manually. In this case the infected .java files are used (I guess the new Start of the Java Virtual Machine solves my problem by reloading the �new� .class files)
    How can I reach to start my application with the mentioned method but with the infected .java files and without having a new start of the JVM ??
    Can anybody help me?
    Thanks in advance
    Sorry for my English, it�s a long time since I quit school

    Hello,
    my problem of reloading classes is still unsolved although you tried to help me!
    Therefore I posted a little program to illustrate our difficulty.
    It would be nice if somebody could have a look at this program.
    We have a file Testdatei.java whose only method is the main method.
    I get the class object of this file and with the help of Reflection the declared methods.
    Evereything works fine so far.
    Then I change the content of this file by adding an additional method a() (see change() for this).
    Now I delete the old class file and I compile Testdatei.java again (see compileJava()) and once more I get the class object for this changed file. Afterwards I get the declared methods for this class via reflection.
    But instead of showing now the methods main() and a() Reflection still only shows the method main().
    I guess the changed class has not been reloaded!!
    package testpackage;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.lang.reflect.Method;
    import java.net.URL;
    import java.net.URLClassLoader;
    import com.sun.tools.javac.Main;
    public class LoadClass
         private File f;
         private Class c = null;
         private Object o;
         public LoadClass()
              f = new File("C:/AAJ/src/testpackage/Testdatei.java");
              try
                   o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
                   c = o.getClass();
                   System.out.println("Class " + c.getName() + " found.");
              catch (Exception e)
              {e.printStackTrace();}
              Method [] method = c.getDeclaredMethods();
              for (int i=0; i<method.length; i++)
                   System.out.println(method.getName());
              change();          
              compileJava(f.getPath());
              File fileToDelete = new File("bin/testpackage/Testdatei.class");
              System.out.println(fileToDelete.delete());
              Class cla = null;
              try
                   Object o = neuesExemplar(f.getPath(), "testpackage.Testdatei");
                   cla = o.getClass();
                   System.out.println("Class " + cla.getName() + " found.");
              catch (Exception e)
              {e.printStackTrace();}
              Method [] methods = cla.getDeclaredMethods();
              for (int i=0; i<methods.length; i++)
                   System.out.println(methods[i].getName());
         private int compileJava(String javaFile)
         String[] args = {"-d", "C:/AAJ/bin/", "-classpath", System.getProperty("java.class.path"), javaFile};
         return Main.compile(args);
         public static void main(String[] args)
              new LoadClass();
         private Object neuesExemplar(String pfad, String klassename) throws Exception
         URL url = new File(pfad).toURL();
         URLClassLoader cl = new URLClassLoader( new URL[]{ url });
         Class c = cl.loadClass(klassename);
         return c.newInstance();
         private void change()
              FileWriter fw;
              BufferedWriter bw;
              try
                   fw = new FileWriter(f);
                   bw = new BufferedWriter(fw);               
                   bw.write("package testpackage;");
                   bw.newLine();
                   bw.newLine();
                   bw.write("public class Testdatei");
                   bw.newLine();
                   bw.write("{");
                   bw.newLine();
                   bw.write("public static void main (String [] args)");
                   bw.newLine();
                   bw.write("{");
                   bw.write("System.out.println(4);");
                   bw.newLine();
                   bw.write("}");
                   bw.newLine();
                   bw.newLine();
                   bw.write("private void a ()");
                   bw.newLine();
                   bw.write("{");
                   bw.newLine();
                   bw.write("System.out.println(55);");
                   bw.newLine();
                   bw.write("}");
                   bw.newLine();
                   bw.write("}");
                   bw.close();
                   fw.close();               
              catch (IOException e)
              {e.printStackTrace();}                                             
    I�m using eclipse 3.1.0. Is it possible that it�s a bug in eclipse that eclipse holds the old class file in memory from the beginning and always refers to this one and not to the new compiled one?
    Thanks a lot
    Simon

Maybe you are looking for