How do I interrupt execution of a Java method called using javaMethod() in MATLAB?
Afficher commentaires plus anciens
I have a method in my Java class that prints "Hello World" in an infinite loop. The code is as follows:
class Hello
{
public static void main(String args[])
{
while(true)
System.out.println("Hello World\n");
}
}
I am running the above code as follows from MATLAB command prompt:
javaMethod('main', 'Hello', [])
The code runs fine but I am not able to interrupt the execution of main() by typing CTRL+C. Futher, implementing a KeyListener and calling System.exit(0) kills MATLAB as well.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deploy to Java Applications Using MWArray Data API dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!