• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Error In Executing A File in JAVA

 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I have this piece of code, but I am getting an error while executing it. Could you please tell me where i am going wrong here. I know it which line the error is occurring but i don't know what to put in there.

Code:



And the error is:


Sorry i could not provide the URL.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like the Citrix ICA client is returning an error code when executing the WSAD-RDP.ica file,
The code 193 appears to indicate a CreateFileMapping error, whatever that may be.
More of a Citrix / ICA related problem it seems. You're certain the configuration in the ICA file is valid?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. I think so. When i double click on the file, it opens perfectly. But when i do it through the code, it throws this error.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, my bad (I think).
The error code is not related to the ICA file at all.
I just noticed you're calling Runtime's exec() method and providing the .ica file as an argument.
That won't work, because it's not an executable file in and of itself.
You'll have to provide a path to an executable that can take a path to an .ica file as a (command-line) argument and execute accordingly.
When double-clicking the file in Windows, the file association for the .ica extension will take care of that for you.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So could you please tell me how the runtime.exec() should be like?
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, because i don't know the name of or the path to the executable that's supposed to handle the .ica file.
XenApp presumably?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just mean an example of what it should be like... I dont need the whole thing!
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well ok, an example of executing a .bat file using CMD.exe:




Note that I'm purposefully using the full path to the cmd.exe file here, even though in this case that's not strictly necessary.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Will check it out and let you know.
 
Marshal
Posts: 22446
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An alternative is using one of the following:

1) don't use Runtime.exec but Desktop.open:
2) use rundll32 to launch the default application: Note that I used an array to specify the command; I just prefer it that way.

Also, whenever you use Runtime.exec or ProcessBuilder be sure to have read When Runtime.exec() won't.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jelle/Rob for helping me out with this. It works now.

@Rob: I would like to know that what is the argument "url.dll,FileProtocolHandler" mean??

Actually this is part of larger application that I am trying to make. Just would like to ask the question here rather than starting a new thread.

So after the Citrix ICA client opens up. I have to enter a username and password into the Citrix login. Can I do it through Java?

Actually I am trying to make an auto login to a Citrix ICA client.
 
Rob Spoor
Marshal
Posts: 22446
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Somnath Mallick wrote:@Rob: I would like to know that what is the argument "url.dll,FileProtocolHandler" mean??


Don't ask me how it works, but if the first argument to the rundll32 application (part of Windows) is that exact string, rundll32 will lookup the default application for whatever comes after it. You can use it to launch your default browser for URLs as well, by simply passing a URL (starting with http:// or https://).
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rob...

Could you please help out in the other queries as well.
 
Rob Spoor
Marshal
Posts: 22446
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already would have if I had known the answer.
 
reply
    Bookmark Topic Watch Topic
  • New Topic