Avatar of liyy
liyy
 asked on

enable java command scripting on GUI for end-user use

Hi,

I have following java command as below, we want to enable it to GUI for end-user use, my boss didn't want user running command line, is there any ways to do that?

java -jar xxxxxx.jar compare ${1} ${2} output-file.doc

Ideally, user can input file1 and file2 on the interface and then run above java command.

Server and client platform are Mac OSX server and Mac computer receptivity.

Apart from java environment, is it possible use PHP associate with above java command to accomplish that?
JavaPHPLinux

Avatar of undefined
Last Comment
liyy

8/22/2022 - Mon
for_yan

Do you have Java code of what is in your jar file or just classes?
ASKER CERTIFIED SOLUTION
for_yan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
wesly_chen

> is it possible use PHP associate with above java command to accomplish that?
Yes, use
system('<command>', $retval);
liyy

ASKER
thanks for yan,

I only know how to write PHP, Java is out of my hands, of course, use webpage add some text box and input filename from user and then execute java command line, something like that.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
liyy

ASKER
wesly,

I also need to write PHP to handle error in case end-user didn't input the filename, wrong file name, wrong path, etc, let me try to use your suggestion.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
liyy

ASKER
Write PHP is easy for me, but I have no experience for the PHP code associate with Java comand, if java have run-time error, can PHP can handle this! Let me try, I don't mind to post the code if the program run successful!
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
CEHJ

>>But the exit code/reval should be the same as "nonzero" if failed.

Only if the java app has been written correctly. Exit codes often aren't by Java programmers - you might be lucky ;)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
liyy

ASKER
I have got the problem, PHP code cannot capture file path, I am thinking another way to accomplish that!
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
liyy

ASKER
thanks CEHJ,

Can you explain more specific of your instruction? I am not java expert!
liyy

ASKER
Since no further comments, I only partially complete the solution.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy