1 package com.company; 2 3 4 import static java.lang.System.*; 5 6 import java.awt.*; 7 import java.awt.event.MouseEvent; 8 9 import java.net.*; 10 11 import java.io.*; 12 13 public class Main { 14 15 public void mouseClicked (MouseEvent e) { 16 if (e.getClickCount() > 0) { 17 if (Desktop.isDesktopSupported()) { 18 Desktop desktop = Desktop.getDesktop(); 19 try { 20 URI uri = new URI( 21 "https://github.com/libgdx/libgdx/wiki/Improving-workflow-with-Gradle#how-to-remove-gradle-ide-integration-from-your-project"); 22 desktop.browse(uri); 23 } catch (IOException ex) { 24 ex.printStackTrace(); 25 } catch (URISyntaxException ex) { 26 ex.printStackTrace(); 27 } 28 } 29 } 30 } 31 32 public static void main(String[] args) throws IOException, URISyntaxException { 33 // write your code here 34 out.println("ahoj"); 35 36 Desktop d = Desktop.getDesktop(); 37 if (Desktop.isDesktopSupported()) { 38 Desktop.getDesktop().browse(new URI("http://www.example.com")); 39 } 40 URL oracle = new URL("http://java.studovna.net/data/index.php"); 41 //URL oracle = new URL("http://www.oracle.com/"); 42 BufferedReader in = new BufferedReader( 43 new InputStreamReader(oracle.openStream())); 44 45 String inputLine; 46 while ((inputLine = in.readLine()) != null) 47 System.out.println(inputLine); 48 in.close(); 49 50 try { 51 String ss = null; 52 Process p = Runtime.getRuntime().exec("cmd /c java -Xms2048M -Xmx2048M -jar C:\\Users\\jarda\\eclipse-workspace\\hello\\src\\hello\\craftbukkit-1.17.1.jar -o false"); 53 //Process p = Runtime.getRuntime().exec("cmd.exe /c start dir "); 54 BufferedWriter writeer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())); 55 writeer.write("dir"); 56 writeer.flush(); 57 BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); 58 BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); 59 System.out.println("Here is the standard output of the command:\n"); 60 while ((ss = stdInput.readLine()) != null) { 61 System.out.println(ss); 62 } 63 System.out.println("Here is the standard error of the command (if any):\n"); 64 while ((ss = stdError.readLine()) != null) { 65 System.out.println(ss); 66 } 67 68 } catch (IOException e) { 69 System.out.println("FROM CATCH" + e.toString()); 70 } 71 72 } 73 } 74