Wrote warnings in file in Windows from during execution - java

How to start .jar application from command line and wrote errors ( exceptionsand warnings, all what is in Console in eclipse during execution ) in errors.text on Windows ?

it think you can do this by starting your jar with the following command:
java -jar myJarFile.jar 2>> errors.txt
the 2>> is used to redirect error messages (System.err)
if you want to redirect normal ouput too use 1> myfile.txt

Related

Desktop entry runs but terminal closes immediately and launcher never runs

Trying to setup a desktop entry on ubuntu 21.04 for a .jar file. When I execute it manually with:
$ java -jar /home/usr/Documents/launcher.jar
It outputs some logs from the jar and seems to throw that process into the background.
So as long as the terminal is open it stays running.
But when I setup the .desktop file:
[Desktop Entry]
Type=Application
Terminal=true
Icon=/home/usr/Pictures/logos/launcher.png
Exec=java -jar "/home/usr/Documents/launcher.jar"
Name=Launcher
Comment=Launcher information here
And when I run it a terminal opens showing the logs as expected but then it just closes immediately after and the launcher never actually starts. I was able to take a screenshot of the terminal before it closed/exited and there was no errors or unexpected logging.
UPDATE 1:
I tried to see if running it manually with following command gave the same output and running it as a desktop app and it did. Failed to actually launch launcher.jar
$ gnome-terminal -e "java -jar /home/usr/Documents/launcher.jar"
Have you try to use nohup command?
Add it before your java command and redirect outputs:
nohup java -jar [...] > launcher.log 2>&1 &

Trying to execute jar using cygwin, arguments not recognized

I have a makefile that calls a java parser to process some files before compilation. While in linux works perfectly when I am running that on a Windows 7 machine using cygwin my input are recognized as jar files.
My command inside my make is something like
java -jar ${MY_DIR}/myParser.jar -arg1 -arg2 -arg3 input.file output.file ;\
and I get an error that input.file is not a valid jar file... I assume it has something to do with my paths and how cygwin handles java but I can't make it work.
Thanks in advance
Try putting up ()
exec java -jar $(cygpath -w /path/to/myParser.jar) -arg1 -arg2 -arg3 input.file output.file
Srry not enough rep to add comment .

open 2 jar files on linux command

I need to open run two jar applications in the same time
I know that to run a jar file you have to type
java -jar app1.jar
but I need to terminate the current process to run
java -jar app2.jar
How can I open app2 without closing app1 ?
Execute this bash command
( java -jar app1.jar ) &
( java -jar app2.jar )
The commands will execute in parallel subshells
You can run one, push it into the background, and then run the other.
Run the first command, press ctrl-z and then type bg.
This runs the command in the background, leaving your command line available for you to call you next command.
http://www.thegeekstuff.com/2010/05/unix-background-job/

Ambiguous output redirect on solaris

I'm running Java program on solaris and want to redirect both standout and standerr to a log file while still keeping them in the console.
Here's the command I use:
Java -jar MyProgram.jar 2>&1 | tee build.log
However, it gives me the following error:
Ambiguous output redirect
Use ksh or bash, (t)csh doesn't support this syntax (and possibly not even the functionality)

Use Java Program As Start UP Script Linux (RHEL5) Giving Error?

hi i have created my jar file PingConsolApps.jar and i have run this jar file at terminal running fine now o want to add it as a service that would start up on boot so i have put my jar file in "/home" place and i have created file PingConsolApps in etc/init.d as following this site,
http://www.shayanderson.com/linux/ad...-on-bootup.htm
but i have edited it here,
Code:
#! /bin/sh
case "$1" in
start)
cd /home/
/usr/bin/java -jar PingConsolApps.jar &
;;
stop)
killall -v java
;;
esac
exit 0
i gave permission to it ,
Code:
chmod +x /etc/init.d/PingConsolApps
and after it i execute,
Code:
chmod 777 /etc/init.d/PingConsolApps
i try to start its service
Code:
/etc/init.d/PingConsolApps start
it does not show any error but after it i check it using
Code:
service PingConsolApps status
it does not show any thing and do not give ant error i check it in running service,
Code:
service --status -all
i do not get it there also
when i try to stop it
Code:
/etc/init.d/PingConsolApps stop
it give error "java: no process killed"
if it run this service then my sql data base would be updates while it do not up date ???
what are the mistakes in this script help me out to get my goals i am new to linux and development to specially like creating this services
Thanks in Advance
See: http://fedoraproject.org/wiki/Packaging:SysVInitScript#Initscript_template
It is mandatory to have a line like:
#chkconfig 234 90 10

Categories