
Berikut adalah cara untuk memanggil atau menjalankan aplikasi lain dengan menggunakan Java, saya menggunakan IDE Netbeans.
Hal ini bertujuan untuk berbagai macam keperluan, seperti untuk menjalankan koneksi ke database, membuka pemutar musik, kalkulator dll.
Baiklah, berikut adalah kodenya :
Sebelumnya import terlebih dahulu ini,
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Memanggil aplikasi lain | |
public static void open_conection() { | |
File file = new File("c://xampp/xampp-control.exe"); | |
ProcessBuilder pb = new ProcessBuilder(file.getAbsolutePath()); | |
try { | |
pb.start(); | |
} catch (IOException ex) { | |
Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} |
Menjalankan aplikasi lain dengan Java
4/
5
Oleh
Unknown