Answers for "How to load an API in java"

2

how to open a webpage with java

/**
 * author Scratchy (Twitter @S_cratchy)
 * Just import stuff
 */
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
This you put in your button or whatever
 */
String url_open ="HTTPS://www.google.com";
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url_open));
} catch (IOException ex) {
Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
}
Posted by: Guest on November-23-2019
1

how to read a json resposnse from a link in python

import urllib, json

url = "put url here"
response = urllib.request.urlopen(url)
data = json.loads(response.read())
print (data)
Posted by: Guest on May-05-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language