Problem with opening files (explorer)

Hi everyone,
since today I have the problem that whenever I try to open a file with this code:

public void load_document_button_click(GButton source, GEvent event) { //_CODE_:load_document_button:817988:
  println("load_document_button - GButton >> GEvent." + event + " @ " + millis());
  if (event == GEvent.CLICKED) {
    selectInput("Open:", "loadSelected");
  }
} //_CODE_:load_document_button:817988:

void loadSelected(File selection) { //<>// //<>// //<>// //<>// //<>// //<>// //<>//
  if (selection == null) { // no path selected
  } else {
    //do stuff
  }
}

the program freezes completly and has to be shut down via task manager.
Screenshot frozen:
<I will add one when it appears again, now it magically works…>

I tried restarting Windows but that didn’t help.
Did anyone experience something similar/has a solution?

It used to work before. I made no changes to the code whatsoever. I use the same Processing version as before. Sometimes it works as if there is no problem at all?!

Specs:
Windows 7 - 64bit
Intel Core i5-6300U
8GB Ram
Processing 3.3.6

1 Like

My suggestion. Run an MCVE to see if the problem is selectInput or your source of GButton (G4P?). If you can figure out which one is causing this problem, that is half of the battle won.

You can also try running examples either in basic or under the G4P library and see if you can reproduce this behavior.

Also notice it could be your code. Running examples is the best way to start.

Kf

Hi Kf,
the code ran before without any changes.
Also the explorer window was already there but the content of it was my windows home screen so I don’t think the button is/was the problem.

Actually I didn’t have the problem again since then but at that time it was ~10 times even when restarting the computer…

I don’t really care too much because it doesn’t happen anymore, I’m just worried in the future when someone is using my tool it suddenly frezzes and the user didn’t save.

The problem returned. Here is a screenshot…
Maybee the CPU isn’t warm enough yet?

hi @MxFxM this might be an issue with your java version. if you dont mind, can you post all the code? to see if i have the same issue on my mac and my pc.

Hi,
it’s the code from above (I do more in my load function but that isn’t called until the selection is finished and I can’t show the real code here).
What I mostly complain about is the inconsistency because sometimes it woks and sometimes it doesn’t.
Also exporting and running the .exe doesn’t help.

And you tried running the program on different machines? Does the whole computer slow down or freeze or is it just the application?

Can I ask what does your program do exactly?

Also are you running any libraries and can you consistently run a version of the program without any Library or other dependencies? Does the same result happen?

Only on two. On my PC it freezes early in the morning (I usually start at 7am), however after about 10am it works without a problem. On the other PC I only run it once or wice a day (after 10am) and there it never froze yet. I am however writing the code on the first machine and only use the exported file on the other (which froze on the first PC too).

Only the application freezes. I checked but there is no antivirus software complaining during the freeze or after then forcing the program to stop.

I open .tsv files, do some magic with the values and then save it as .txt and .csv depending on which button was pressed. The program seems to freeze while opening the explorer window no matter if I use selectInput() or selectOutput().

import fisica.*;
import g4p_controls.*;

I haven’t tried without but I will test that today if it freezes in the first place.

I should also add there is no error in the Debug field of processing. Only after forcing the program to stop. It then says something along the lines of: “Target VM failed to initialize”.

But I guess that’s just from stopping it with the taskmanager?

I will edit this post when it happens again but today it seems to work fine…

We might have found a reason:
Usually at about 9am where I work its breakfast time so everybody browses the internet.
When the explorer was last used on a folder from a network drive and not a local folder the first time it tries to load the explorer on the same location takes too long and so it freezes?!

This has been very interesting and i am going to share this with others on here, unless you have already resolved the issue. It’s possible that running your program from a network drive can slow things down, especially if your sketch requires a network connection to download data and it seems you have ran your sketch locally without any issues. correct?

I’m running the program locally. I only open the explorer on a directory that is on the network drive. Network drive beeing a server from our company which is locaed roughly 1km from me.

Let me see if I understand what’s going on:

It works okay if you try to load from a local directory, but it freezes if you try to load from a network drive?

If that’s the case, then I’d check your settings. My guess is that you’ve disallowed Java from accessing the internet or something.

If that doesn’t help, then please try to isolate your problem in a MCVE that reproduces the problem in as few lines of code as possible.

Only sometimes…

The file is not on the internet. And sometimes it works so this can’t be the problem.

As soon as it comes up again I will.

Isn’t the file on a networked drive? My point is that it sounds like Java is having trouble accessing the network, which is a security setting that you can adjust.

It’s on a file server that I can access via LAN but it’s not accessible to the web.

And the IT of my company does not allow us “normal” users to change any settings.