• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Opening URL Connection

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a simple standalone Java application that opens a URLConnection then reads it as a stream. This is just like reading a web page programmatically.

When I execute the app from the DOS command prompt with 'java', it executes fine. When I run it from the JBuilder IDE, it fails to "connect" and the contentLength return value is -1. Is this a security issue? Why does it work from the basic Java JRE, but not when run from within an IDE like JBuilder?
What it means is that I cannot debug the rest of the app using JBuilder's debugger I guess.
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I execute the app from the DOS command prompt with 'java', it executes fine. When I run it from the JBuilder IDE, it fails to "connect" and the contentLength return value is -1.
I had a similar problem. I bet that when you run it from the command prompt, your app runs under JDK 1.3, and when you run it from JBuilder, it uses JDK 1.4. See this thread for more information.
Eugene.
 
Mark Mokris
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eugene! WOW! You are right on!!!
I would never have guessed this, but where it works I am using jdk1.3 and where it doesn't work I am using jdk1.4. I actually don't need the contentLength, I was using it to tell me whether the connection was successful or not. I guess I will just go ahead and read the thing and not worry aout the content length.
MAN I OWE YOU A BEER! THANKS!
Thanks for sending me the private message on this too.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MAN I OWE YOU A BEER!
Offer him Vodka instead. And, by the way, he doesn't like shouting.
reply
    Bookmark Topic Watch Topic
  • New Topic