I am trying to learn how to connect to web sites using java. Someone suggested that I learn to "consume an API with java". They also suggested that I practice through a weather website called weather underground and sent me a link [URL] .... I would like to know how to connect to this site to get weather information.
How can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that? Example : I get host, user,pass in txt and connect it with java code!
com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host localhost, named instance sqlexpress has failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host. at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDriverError(SQLServerException.java:171) at com.microsoft.sqlserver.jdbc.SQLServerConnection.g etInstancePort(SQLServerConnection.java:3174) at com.microsoft.sqlserver.jdbc.SQLServerConnection.p rimaryPermissionCheck(SQLServerConnection.java:937 ) at com.microsoft.sqlserver.jdbc.SQLServerConnection.l ogin(SQLServerConnection.java:800) at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(SQLServerConnection.java:700) at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(SQLServerDriver.java:842) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at jdbc.JdbcSQLServerConnection.main(JdbcSQLServerCon nection.java:25)
I want to develop attendance system that scans students fingers for attendance and mark his attendance in database automatically once finger scanned.Is it possible to connect java application to external hardware? If yes what extra knowledge i should know ? How can i connect it ? and what books are good for it ?
I am trying to make a Connect Four game with java swing, but I am getting an error with my attempt at making an multi D panel maker when I try to run it.
I have just started learning about sockets and such... and i have created a chat program with a server and a client
server:
public class Server { private static ServerSocket server; private static Socket connection; private static PrintWriter pw; private static BufferedReader br; private static JTextField textOutput;
[Code] ....
so, everything is working fine . There is only one thing i would like to do now: make it so that i can run the server from my computer and then others can run the client from theirs and we will be able to chat . So I tried:
In the client code on line 56 is says:
connection = new Socket("localhost",7777);
So I changed "localhost",7777 to "myip",7777)
But when i run the server on my computer and run the client on another computer i get this error:
Why is the connection getting refused? is it for security reasons? so hackers cant connect to me or something? And is there a way to tell your computer to allow that client to connect?
Our assignment is to make a version of the classic 'Connect Four' game, where we need to construct a GUI that shows the current state of the game and instead of having a winner once a player has four chips in a row, the game needs to continue until no chips can be placed anymore.We currently get stuck in the GUI part. Running it right now results in a board with empty spaces only. Also after choosing a column to place, the board remains empty.
Our question: How do we get the board filled with the right color of chips at the right place?We know the 'ArcsPanel'-class (almost at the bottom of the code) is wrong, but we don't know what to do to make it right.
soo, is there a way to (via sockets or something like that) connect to a stream via the streamers url (or just via anything) and then get the actual stream? like the images that keeps updating? so that i can display the images/stream on a jframe?
I have a vps set up to running a MySQL database already by zpanel but when I try to connect to the database with Java I am unable to connect and receive the message:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."
I have MySQL Connector(dev.mysql.com/downloads/connector/j) already added to my build and tried it with both the url and the ip. This is my connection code:
package net; import java.sql.*; import javax.swing.JOptionPane; public class LoginDatabaseConnection { Connection conn = null;
[Code] ....
The code is from youtube but when I connect to localhost it works fine however when I try to connect to the VPS the above error happens.
I am a student in an intro to computer science class working on my final project. This is essentially a game of connect 4, but only requiring 3-in-a-row for victory. We were given the base game and a sample file to work with to make an AI that beats our professor's ai in the base game. Here is the base game
I am having a problem to connect my .exe file to the database(mysql). I used launch4j to convert the jar file to .exe but the jar file can connect to the database when running inside the dist folder. When I run the .exe I am getting this error: No suitable driver found for jdbc:mysql.
My code below is trying to make a connect four program without GUI. I'm having trouble with getting the players to make their moves. What should I put in my "makeAMove" method...
Java Code:
public class Connect
final static int MAXROW = 6; final static int MAXCOL = 7; public static void main(String[] args){
Whenever I enter a column number to drop a checker, the program immediately stops running and gives me a "java.lang.ArrayIndexOutOfBoundsException" and points to my checkWinner method. There are two int constants, one is LOWEST_ROW_INDEX = 5, and the other is RIGHTMOST_COLUMN_INDEX = 6. I cannot figure out what to do differently with my checking algorithm to stop this from happening.
public static String checkWinner(String[][] gb) { //tests for a horizontal line made by four of the same color checker for(int row = 0; row <= LOWEST_ROW_INDEX; row++) { for(int col = 0; col <= RIGHTMOST_COLUMN_INDEX; col++)
For the latest assignment, my instructor has asked us to create a program where we create lines of at least for integers and if the program registers there being four of the same integer horizontally, vertically, or diagonally it returns true. For example:
If the program doesn't see four integers of the same value anywhere, it is supposed to return false. I've got it so it returns true for the lines above, 6x6 lines of integers and lines where only four out of six+ integers are equal. However, I cannot get my code to return false if there are only three matching integers in a row/column/diagonal nor can I get the program to print out either true or false for lines that do not start at the top left corner. (i.e 2 3 1 1 1 1) For the former I get this error message:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at ConnectFour.is4Consecutive(ConnectFour.java:41) at ConnectFour.main(ConnectFour.java:32)
For the latter:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at ConnectFour.is4Consecutive(ConnectFour.java:43) at ConnectFour.main(ConnectFour.java:34)
The answer to fixing my code is probably something small or something that will make me wonder why I hadn't thought of it myself... Here is my code:
import java.util.Scanner; public class ConnectFour { private static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); System.out.print("Enter the height: "); int h = sc.nextInt(); System.out.print("Enter the width: ");
For my job I would to develop a Java application which downloads some data from a webpage and then process them.
The problem is that I have to authenticate to a proxy server to connect to the internet. As I browsed on the net, there is a possible way for implementation.
Sometimes it works fine, but usually I get the following exception:
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2083) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
I don't understand what's the problem and why it's not persistent.
Is there a way to connect the popupmenu to the right Object (JFrame).
(Something like SwingUtilities.getWindowAncestor(popupmenu)
I've created 2 JFrames each with the same MouseClass. When you click on the RMB a pop menu is shown with a background item. When clicked on the background item only the last created JFrame changes his background.
Below is my simplified code. I'm probably not thinking like a good OO'er.
I started with Eclipse and wrote the basic "Hello World" app and added a few other lines of a=5, b=9, println (a*b) etc. and ran the program in the screen.
Then I thought that perhaps I could move it onto my nexus 7 and see what it looks like there. [I have a lot to learn I suppose].
The first issue is that I can't connect my Nexus 7 tablet to me macbook pro without using "android file transfer" and then the computer does not show the device in the finder because it is running through the file transfer program.
I have done some research and changed the settings in the nexus to connect as a camera rather than storage but that doesn't work either.
So my main issue now is being able to get the program onto the device - can it simply be copied and pasted into one of the files on the device using the file transfer screen?
I'm working on an application I made a few years ago. At that time I connected to a local database so my address was 'jdbc:mysql://localhost:3306/'. That database is long gone so I recreated it on one of my hosted servers but I'm a little unsure of how to connect to it. At the moment I'm trying "jdbc:mysql://www.mydomain.com:3306/" but it is giving me an access denied error.
java.sql.SQLException: Access denied for user 'myusername'@'c-[my-ip].hsd1.pa.comcast.net' (using password: YES)Every result on Google seems to use localhost so I'm having a little difficulty figuring out the correct format.
I am doing an assignment in my Java class and I need to connect the nodes to make a 12 pointed star. I have already drawn out the star and figured out which nodes to connect together. The only thing I cannot get is to show all of the nodes in the order they connect. I can only get the first 3 nodes to show up. I need it to wrap around and basically keep adding 5 to the last node until all numbers 0-11 are used.
public class StarWinding { public static void main(String[] args) { for (int i = 0 ; i < 12; i+=5) { System.out.print(i + " "); } } }