How to call get value of java console in Livecode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
How to call get value of java console in Livecode
Hi guys,
I got a java console application and I want to call jar file and get value from console into livecode application.
Could you guys please give me some solutions for this one, It's quite urgent ?
So appreciated.
Regards,
Quang
I got a java console application and I want to call jar file and get value from console into livecode application.
Could you guys please give me some solutions for this one, It's quite urgent ?
So appreciated.
Regards,
Quang
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: How to call get value of java console in Livecode
For calling console apps see the "shell" function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: How to call get value of java console in Livecode
Thanks FourthWorld,
I followed to your instruction by using shell to call java console, when I test some window command It works.
However, I try to execute jar file, there are some problem, Hope you can show me what's wrong ?
Here is my code:
when I run "java -jar Demo.jar" on command line it works fine
My jar file is already put into C folder
Could you please give me the solution ?
Best Regards,
Quang
I followed to your instruction by using shell to call java console, when I test some window command It works.
However, I try to execute jar file, there are some problem, Hope you can show me what's wrong ?
Here is my code:
Code: Select all
on mouseUp
local volumeSerialNumber
put "C" into pDiskLetter
put char 1 of pDiskLetter & ":" into pDisk
set the hideConsoleWindows to true
put shell("dir " & pDisk) into tDirData
get matchText(tDirData,"Volume Serial Number is (.*)\n",volumeSerialNumber)
if it is true then
put shell("java -jar Demo.jar ") into tData ============Unable to access jar file Demo.jar
answer tData
else
answer "Disk not found."
end if
end mouseUp
My jar file is already put into C folder
Could you please give me the solution ?
Best Regards,
Quang
Re: How to call get value of java console in Livecode
Sounds like you put your demo.jar file in the root of the c: drive so it would be at "c:\Demo.jar"
Most likely the folder that your shells are executing from are NOT the root of the c: drive.
If you "put the defaultfolder" it will tell you where your shell will be executed from. If your Demo.jar is not in the same place, the java executable won't be able to find it.
You can solve this in 1 of 2 ways. Either specify the full path to your demo.jar
Otherwise you can just set the defaultfolder to the location of your jar file then execute the shell
Most likely the folder that your shells are executing from are NOT the root of the c: drive.
If you "put the defaultfolder" it will tell you where your shell will be executed from. If your Demo.jar is not in the same place, the java executable won't be able to find it.
You can solve this in 1 of 2 ways. Either specify the full path to your demo.jar
Code: Select all
put shell("java -jar C:\Demo.jar ") into tData -- assuming i'm correct and your demo.jar is in the root of C:
Code: Select all
set the defaultfolder to "c:\" -- again, if your jar is NOT in the root of C: specify the correct path here.
put shell("java -jar Demo.jar ") into tData
Re: How to call get value of java console in Livecode
Dear sturgis,
I resolved this
Thank a lot for helping me
Regards,
Quang
I resolved this
Thank a lot for helping me

Regards,
Quang