There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze gaming google gpu hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network operating system printer problem ram registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
JAR works but exe doesn't

Reply  
Thread Tools
gsingh2011's Avatar
Member with 62 posts.
 
Join Date: Jan 2009
31-Oct-2009, 12:30 PM #1
JAR works but exe doesn't
I know some people are against converting jars to exes, but I needed to in this case. The jar worked fine but my exe gives me the error below. The code is just,
Code:
package mail;

import java.net.*;
import java.io.*;

public class Mail {

    public static void main(String[] args) {
        System.out.println(args.length);
        try {
            if (args.length == 1){
                URL url = new URL("http://sygmd.org/email2.php?message="+args[0]);
                InputStream connect = url.openStream();
            }
        } catch(Exception e){
            e.printStackTrace();
        }
    }

}
email2.php is a one line php script that sends me an email, so you wont be able to test that. This is the error from the exe:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...Client(Unknown
Source)
at sun.net.http://www.protocol.http.HttpURLConn...onnect(Unknown Sour
ce)
at sun.net.http://www.protocol.http.HttpURLConn...onnect(Unknown Source)
at sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown So
urce)
at java.net.URL.openStream(Unknown Source)
at mail.Mail.main(Mail.java:13)
The thing is, first I had the code in python and converted it to an exe, I got a similar error. Now in java it's not working either, but the code works fine. I have no idea what the problem could be.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:36 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.