JAVA file Reader in KNIME

Good evening. Once again, we need help. How can I read a JAVA file with the standard library using KNIME. A kind of compiler in KNIME that can read files with the standard library.

You can pass your Java code as string content to the Java Snippet node. You can even do this dynamically through a flow variable, it will be compiled dynamically.

If it’s an entire “root class” you’ll likely need to split it up into the different sections. (imports, statics, and per-row executed code)

–P

2 Likes

Unfortunately, it doesn’t work that way. for example, my code does not work in batch mode.

I need to type in one of the tasks at the end of the workflow. Because since at a certain moment I have one other application open. My process should print the code without stopping and go further according to its logic.

@takbb
Could you please connect to this problem

@Nuke_Attokurov … that isn’t really how this forum works. If (1) you describe a problem in sufficient detail for me to understand exactly what it is you are trying to do or (2) at least give enough detail that I feel it is in my “sphere of knowledge” and I am therefore happy to ask further questions to clarify your requirement and (3) I think I may be able to assist, and (4) I have the time and (5) I have the inclination, then I will generally give my time freely and willingly without being summoned.

Can you start again at point (1) of my wish list and see if we can go from there.

(But all that said… I thank you for your faith in my abilities… it’s just that generally if I think I can help, I will try to do so, but in this case I didn’t understand well enough what you were asking to think that I could… and also @qqilihq is much more a KNIME java expert than I am)

thanks :wink:

5 Likes

I recently noticed that the code uploaded to KNIME via Java Snippet works flawlessly in an open KNIME application. The problem is that not every code can be run in batch mode the same way. To be honest, I’ve been experimenting a lot to find out. I will attach the file below. Everything works fine in this file when I run it through the application. But again, when in batch mode, just nothing happens.

At my work in KNIME, a process is built that is waiting for some kind of unloading, and when the unloading is ready, an alert comes to the screen in the form of an open window, let’s call the window that is displayed as “window2”.

In order for my initial process to receive this data, I need to somehow click on this window, which we called “window2”. Now I have to snap my hands. The window may appear at different times of the day, and in order not to take up the whole day of KNIME in the open state, I want to run it in batch mode and make the Java code work there.
keyPressBot.knwf (5.2 KB)

Hi @Nuke_Attokurov ,

I’m really struggling with working this out… and I’m confused by your latet post.

The thread is entitled “Java file Reader in KNIME”, but how does this fit with your last post?

I have to say that If I wanted to have a bot to “press keys”, I wouldn’t go writing a workflow to do it; I’d just install the free utility AutoHotKey and leave early for the day :wink: Is there a particular reason why you appear desperate to reinvent the wheel here?

3 Likes

@takbb
Oo! Thank you very much.
thank you for helping me find an alternative

1 Like

Gentlemen, it turned out that starting with windows 10 it is impossible to run any application out of the box. for example, it is impossible to make an autoclicker through java. This can be done in java via JNA using C or C++ code. The code that does not work on windows in batch mode, as it turned out later, fully works on linux.

Now I am satisfied knowing the reason why this is exactly the case. To find out, it took me 2 weeks of active search for answers and numerous experiments. I was afraid that a similar problem might arise in the future and if I deal with it now, then in the future I will be able to avoid it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.