![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
can't compile code
A friend of mine gave me some java code and some basic directions. Unfortunately, I can't get it to compile or execute. I would realy appreciate it if you guys could help me out. Im an absolute newb when it comes to java. :o
Maybe someone could compile it for me. Also, when he says to "run it with java VS 'id number', how is that done and where is it executed? Im guessing its supposed to be typed in the command prompt, but im not sure of the directory...Thanks for your help! Directions Quote:
Code: import java.util.*;
import java.io.*;
import java.net.*;
public class VS{
public static void main(String[] args) throws Exception{
String calcID;
System.out.print("\n***TI Vote-stuffer**\n");
if(args.length==0){
System.out.print("\n\nPlease enter a calculator-ID to vote for");
System.out.print("\nas a parameter! eg 'java VS 123'");
System.out.print("\nyou may find the ID by clicking on an entry on TI's web site");
return;
}
calcID=args[0];
System.out.print("\n\nUsing calculator ID: " + calcID+"\n\n");
URL url;
URLConnection urlConn;
DataOutputStream printout;
DataInputStream input;
while(true){
Thread.sleep(500);
// URL of CGI-Bin script.
url = new URL ("http://www.84silver.com/contest_vote_finals.php");
// URL connection channel.
urlConn = url.openConnection();
// Let the run-time system (RTS) know that we want input.
urlConn.setDoInput (true);
// Let the RTS know that we want to do output.
urlConn.setDoOutput (true);
// No caching, we want the real thing.
urlConn.setUseCaches (false);
// Specify the content type.
urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// Send POST output.
printout = new DataOutputStream (urlConn.getOutputStream ());
String content =
//"calculator_id=" + URLEncoder.encode ("1161") +
"calculator_id=" + URLEncoder.encode (calcID) +
"&vote_for_this_one=" + URLEncoder.encode ("Vote!");
printout.writeBytes (content);
printout.flush ();
printout.close ();
// Get response data.
input = new DataInputStream (urlConn.getInputStream ());
String str;
while (null != ((str = input.readLine())))
{
System.out.println (str);
}
input.close ();
}
}
} |
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
Save the code in a file named "VS.java" and then type the following command:
javac VS.java The following code runs it: java VS (calc_id)
__________________
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
i could compile this for you, but it would do about as much good as if i took a piss for you, in other words, none. i'm not going to try to send or link to or upload any .exe files onto anything. compiling is the fun part when you get to hunt down your mistakes. (for the first half-hour)...after 30 minutes compiling is no longer fun. more like slamming your nuts in a sliding glass door. here's the secret though...for most compile errors there are two answers...
either or
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
I compiled it on my machine, no compiler error...
__________________
|
|
|
|
|
|
#5 |
|
Programmer
Join Date: Sep 2005
Location: Požega, Croatia
Posts: 93
Rep Power: 3
![]() |
Me too. I used VS.NET 2003, Java.
__________________
1001 1101 1001 1110 0101 1102 ?! AAAAARRGGHHH _____________________ Free&Premium Web hosting reviews. Click here! Money making oasis. Run your own home based biz. |
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4
![]() |
He prolly don't have a compiler or don't know how to invoke it.
__________________
PFO - My daily dose of technology. |
|
|
|
|
|
#7 | |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
I got these errors:
Note: VS.java uses or overides a depreciated api Recompile with -Xlint: depreciation for details. Can someone just e-mail the .exe file to me please? Quote:
|
|
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
Would you run an .exe that someone you don't know mailed to you???
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
|
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3
![]() |
Quote:
|
|
|
|
|
|
|
#10 | |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
Quote:
Yes, you guys seem nice enough. Norton takes care of most malicious programs anyways. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|