lmariscal / twitchirc

Twitch Bot Development made Easier | DEPRECATED
Other
39 stars 15 forks source link

Help with logger #32

Closed NiD27 closed 6 years ago

NiD27 commented 6 years ago

Hey ive seen even after converting jar to exe the logger does not appear as a console anyway i can get it to open as a console window? and dispplay all the logs in an console? tried this but failed half way https://gyazo.com/c3c785479c97ffdeb49a0cafc5066dbf update this didnt work either https://gyazo.com/88452a5c2f3fc8b6aa19bb3569b14f2d https://gyazo.com/acf0d09ac78f70d7a3a1412e85906a80 ps- i am hoping for a proper console like one in cpp (sorry i come from a cpp background havent done a lot in java) ps of ps - i realized this post dont really belong here so pls remove it sorry for my mistake

mvarendorff commented 6 years ago

What are you using to convert the jar to an exe? If that is tied to the JavaFX framework that might be the issue.

NiD27 commented 6 years ago

@I am using jar2exe liek even just running the jar dont run as cmd and dont appear in taskmanager or in tasklist in cmd

mvarendorff commented 6 years ago

In that case I think, it is best to contact the owner/maintainer of jar2exe as this issue is very, very likely not connected to this specific code.

NiD27 commented 6 years ago

@geisterfurz007 so using java.util.logging.logger does log to console right? i am creating my jars with intellij btw still dont work

mvarendorff commented 6 years ago

Looking into it.

mvarendorff commented 6 years ago

Yes the Logger logs to console. Just double clicking the jar file will not open the console window. To see the output open a cmd window in the directory in which the jar is in and run "java -jar myJarName.jar". I have no experience with jar2exe and the only thing I can do at this point is link to [jar2exe's tutorial for console applications(http://www.jar2exe.com/solutions/console).

NiD27 commented 6 years ago

ok i will just do a batch file that should fix it i was hoping to do it in java itself without any extra things like batch

mvarendorff commented 6 years ago

Theoretically you can.

Include this piece of ugly code in the beginning of your main method:

if (args.length == 0) {
    try {
        Runtime.getRuntime().exec("cmd /c start cmd /k java -jar unnamed.jar x");
    } catch (IOException e) {
        e.printStackTrace();
    }
    return;
}

This will check if there are no arguments given to the application and if so, it will start it with "x" as argument. This will lead to the condition to result in false and with that run the file with a console. This should work as well with the exe file and a slightly different command if you want to stick to jar2exe but that is up to you.

Edit args-length idea: Mine (you can tell by the horrible quality :P) Working command: https://stackoverflow.com/a/29138847/6707985

NiD27 commented 6 years ago

Dont really work maybe im doing something wrong. had to remove return so main would work properly https://gyazo.com/5a197a052ea4e13c3f18c20ecfee3feb

mvarendorff commented 6 years ago

Replace unnamed.jar with myJarsName.jar The return is placed intentionally so that you don't have two bots running. The small bit I posted above is only to basically restart your process with a console.

NiD27 commented 6 years ago

np still no juice

lmariscal commented 6 years ago

I hope you found a fix, closing the issue for the moment as no other issue related to this lib is here.