0

I wonder why, to run any program, Java needs to use the network. As my connection to the college wireless network really sucks, I get disconnected all the time, but without any notice from the access point. Thus, I cannot access the network anymore but the connection is still seen as up by the operating system. (In my case, I'm using netctl on Arch Linux.)

The result is that Java will take 20 sec waiting for something before running any code from the main() method.

This problem doesn't appear if the connection is down (from the point of view of network utilities).

Do you know why Java does that, and how to prevent it?

Edit, as it doesn't seem clear:

How to reproduce the bug :

  1. Use a broken gateway, such as 240.0.0.1
  2. Write a Java program with an empty main() method.
  3. Compile (javac)
  4. Run the program

The last step takes 20+ seconds to complete.

What I'd like you to explain is not why I'm having network issues but why Java is affected?

tiktak
  • 1,214
  • 8
  • 15
  • Sorry, many questions as I don't think they are directly related. How did you determine Java stops? Doe a program stos responding? Does your program do anything related to networking? Do other operrations on your machine go smoothly? – Nivas Mar 25 '14 at 17:58
  • 1
    It would be helpful for us if you add the code that you are trying to run. – Sandeep Chatterjee Mar 25 '14 at 18:00
  • 2
    Does your classpath point to anything that would be out on the network? – user1676075 Mar 25 '14 at 18:05
  • As @user1676075 points out, you probably have something on a network path in your classpath. Java doesn't, by itself, use the network. – Sirs Mar 26 '14 at 19:07

1 Answers1

0

The problem was indeed due to libraries, as an empty classpath solves the problem.

Update: Just so you know, the library was not on the network but was making requests to the network. This library was JR.

tiktak
  • 1,214
  • 8
  • 15