Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javaw.exe required on windows, problems with gradle installDist #593

Open
damnms opened this issue Jan 24, 2024 · 10 comments
Open

javaw.exe required on windows, problems with gradle installDist #593

damnms opened this issue Jan 24, 2024 · 10 comments

Comments

@damnms
Copy link

damnms commented Jan 24, 2024

Hi, first of all: thanks for lanterna, i really like that.
I have a application that works like a charm on linux. Now i thought i provide also a windows build for it. For that i use gradle and the installDist target which produces a .bat and a .sh with everything required to run the application. Unfortunately, on windows when i doubleclick the .bat, nothing happens. I checked the console and noticed that it references the #335 bug.
When i replace all "java.exe" with "javaw.exe" in the .bat, it works.
Is there any plan for lanterna to implement this so it works also on windows with java.exe instead of javaw.exe?

@avl42
Copy link
Contributor

avl42 commented Jan 24, 2024 via email

@damnms
Copy link
Author

damnms commented Jan 24, 2024

gradle´s installDist target creates the distribution with a .bat and a .sh. Its from the official gradle distribution plugin (https://docs.gradle.org/current/userguide/distribution_plugin.html). Relying on something that exists only in windows is, well, not so optimal. There is no javaw in mac nor in linux, only in windows. Right now, i use sed to replace the java.exe command with javaw.exe and it works, but it feels very wrong.

A "normal" windows user clicks on the .bat/.exe and its done. Usually, windows user do not have cygwin installed.

@avl42
Copy link
Contributor

avl42 commented Jan 24, 2024 via email

@avl42
Copy link
Contributor

avl42 commented Jan 24, 2024 via email

@damnms
Copy link
Author

damnms commented Jan 25, 2024

i was also considering to raise a feature request in gradle, but i talked to some guys in #java on libera.chat and they told me, i am so free and cite one which is very very well known (so i trust him when he says do it that way or that way):
"person: You'd want a way to ensure a console window, rather than changing the invocation command"
and i replied: "the "usual" windows user clicks on the .bat and does not open a terminal and executes it in there".
and he responded: "sure. But is there a way for a java process to say "hey, I need a console window, CREATE ONE"?
and i replied: "you mean i should check if its windows OS, if so create a console window and execute my application? that feels more wrong than the sed approach :D"
and he wrote: "well, I don't think YOU should do it, but lanterna should :)"

i dont want to hack around to produce distributions that are compatible on different platforms. i mean, thats why there is java, isnt it. so for me, as end-user, i want to use lanterna and be able to run that produced artifact on windows, linux and mac, without touching anything else.

Second question: Why would javaw.exe not existing on linux/unix/mac even
matter here?

Because you rely (on javaw.exe) software that is not portable and not on other systems, it is only there on windows. If lanterna is a windows only library and it requires javaw, okay. But if should be compatible to linux/mac/*bsd/etc. - then one should only rely on whats on all systems, and that is java. Otherwise, such things happens with now gradle. Guess the same will happen with every distribution tool.

Afterall, "java.exe" and ".bat"-files aren't on linux/unix/mac, either.

Thats wrong. The .bat file is generated on a linux system and the java.exe is java, just in another format. Javaw is something very different. Again: i build my software on linux, it works like a charm on linux, it works on *bsd, mac, etc. - but not on windows, because of javaw. Its like relying on a windows curl .exe instead of the curl library that can be used anywhere.

right now i use sed to replace "java.exe" with "javaw.exe" in the bat file. but thats nasty.

@avl42
Copy link
Contributor

avl42 commented Jan 25, 2024 via email

@damnms
Copy link
Author

damnms commented Jan 25, 2024

ideally make the double-click on .bat to open the "DOS-box"

The gradle distribution tool (i prefer that over maven) generates 1 distribution that should work everywhere, which contains a /bin/app.bat (all win) and a /bin/app.sh (all linux/unix-like) and executes the packaged "fat-jar".

"lanterna for DOS-box"?

open the "DOS-box" and show the lanterna UI inside that dos-box.

that sounds exactly what i would have thought it does when i start that. i am very very unfamiliar with windows, i use it only at weekends for 1-2 AAA games that have cheat protection (and therefore dont work on linux).
Is there any roadmap/ETA/what needs to be done/documentation/etc.?

@avl42
Copy link
Contributor

avl42 commented Jan 25, 2024 via email

@damnms
Copy link
Author

damnms commented Jan 25, 2024

but when JNA is used, that would mean there are 2 releases for lanterna then, one for windows and one for all others, right?

just took a look at the code, so it uses some windows handlers but nothing else is shipped with it, so still possible to use 1 release. i will take a look at it and see how far i come.

@avl42
Copy link
Contributor

avl42 commented Jan 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants