run javacode from matlab
1 view (last 30 days)
Show older comments
PLEASE help me sir .I am _novice(_just more than) level user . I want to run the below java code in matlab workspace .
It ran successfully in JAVA environment .
I have added the path of classfile generated after compiling this programme and apache jar file in static path by editing classpath.txt.
I went through the MATLAB External API reference guide but I am not able to get it.
I used javaclasspath command to see my added path and it showed that it is there.
version of softwares that i use
MATLAB Version 18.104.22.1681 (R2008b)
Operating System: Microsoft Windows Vista Version 6.1 (Build 7600)
Java VM Version: Java 1.6.0_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode**
import org.apache.commons.net.TimeTCPClient;// third party class
public final class TimeClient
public static final void timeTCP(String host) throws IOException
TimeTCPClient client = new TimeTCPClient();
// We want to timeout if a response takes longer than 4 seconds
public static final void main(String args)
catch (IOException e)
} please help me.
Stephen on 22 Feb 2012
It is easier then that. Directly inside MATLAB:
client = org.apache.commons.net.time.TimeTCPClient;
t = client.getDate()
Find more on Java Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!