Set working directory in shortcut

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Set working directory in shortcut

Post by gdamerau »

Hello,

i was evaluating OWS to automatically deploy clients on customer machines. Everything works fine except for one unexpected behavior related to desktop shortcuts.

To outline my current setup. I'm using the same Java application (JNLP) which is deployed on different servers (e.g. production, test, uat, ...). Each of those applications create a shortcut on the desktop with different names. Up to here everything works fine.
Now i would like to define the working directory on shortcut level. The default "Run in" of the shortcut points to "%userprofile%\AppData\Local\Programs\OpenWebStart" which needs to be changed in my setup to something like "%userprofile%\myapp\prod" for production, "%userprofile%\myapp\test" for test, and so on.

But when i execute one of those applications via OWS, the shortcut is reset to the default "%userprofile%\AppData\Local\Programs\OpenWebStart".

Is there any know way to prevent OWS from updating existing shortcuts? Or is there another way how to define the working directory per instance?

I couldn't find any suitable answer on that in the www. I already tried a couple of configurations in OWS Settings/Desktop integration. The only solution was to deactivate shortcuts in general AFTER they were created by OWS the first time. But that is not a proper solution in my opinion.

I hope somebody can help me with my problem. Thanks!

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

Hello

Which OWS version are you using? From your description your OS is Windows.

" Java application (JNLP) which is deployed on different servers (e.g. production, test, uat, ...). Each of those applications create a shortcut on the desktop with different names"

OWS names the Desktop Shortcut Link file based on the <title> tag in the jnlp and if that is missing based on the name of the jnlp file. Since in your case the shortcut is created with different name I assume you have different title in those jnlp files.

Just for you information in OWS 1.5.1 we have implemented Desktop Shortcut Link name creation to avoid collision/overwriting when title or jnlp file name is same by suffixing the name with hash value.

"Now i would like to define the working directory on shortcut level. The default "Run in" of the shortcut points"

Do you mean to say "Start In" directory as shown in the picture:
StartIn.JPG
StartIn.JPG (39.27 KiB) Viewed 11252 times
At present OWS is setting the working directory as the parent directory of the target i.e. javaws.exe.

You are saying that you want to customize the working directory name.

"But when i execute one of those applications via OWS, the shortcut is reset to the default "%userprofile%\AppData\Local\Programs\OpenWebStart".
Is there any know way to prevent OWS from updating existing shortcuts? Or is there another way how to define the working directory per instance?"

As I explained above OWS could overwrite shortcuts if the title or the jnlp file name is same. But now OWS 1.5.1. will not overwrite shortcuts.

At present there is no way to customize working directory name.

I hope this helps.

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hello,

thanks for your response.

To answer your questions first:
I'm using OWS 1.5.0 on Windows.
As you mentioned, I'm using different <title> nodes in my jnlp files, which results in different shortcut names.

Do you mean to say "Start In" directory as shown in the picture:
Yes (i'm using a non-english Windows and thought it's called "Run in" :D

I checked the updates in 1.5.1. But unfortunately this won't help me. I would need some kind of OWS option to just create shortcuts if they don't exist and keep the shortcut untouched otherwise. But if i understood you correctly, this is not possible at the moment.

I guess it isn't possible to deactivate adding the hash code to the shortcut name in OWS 1.5.1 somehow?

Kind regards,
Gordon

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

>
I checked the updates in 1.5.1. But unfortunately this won't help me. I would need some kind of OWS option to just create shortcuts if they don't exist and keep the shortcut untouched otherwise. But if i understood you correctly, this is not possible at the moment.
>
What makes you think that OWS is touching shortcuts?

As per your scenario, you have specified different titles in different jnlps with same name. This should make sure that different shortcut links are created. For example you have server1/xyz.jnlp with title "server1" and server2/xyz.jnlp with title "server2". On starting these app OWS would have created two shortcuts with names "server1" and "server2". Both will have "Run in" directory as the OWS install dir. Now suppose you manually changed "Run In" directory in both the above shortcut files and then run the jnlps again. Are you seeing the behavior that OWS is changing the Run In directory in the short cut?

>
I guess it isn't possible to deactivate adding the hash code to the shortcut name in OWS 1.5.1 somehow?
>
We started appending the hash code to make sure that there is no collision of name of shortcut. Otherwise shortcuts were getting overwritten and on click users were finding that some other app then the expected one got started. There is no option to deactivate hash code suffix.

Why do you want to deactivate the hash suffix?

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hi,

As per your scenario, you have specified different titles in different jnlps with same name. This should make sure that different shortcut links are created. For example you have server1/xyz.jnlp with title "server1" and server2/xyz.jnlp with title "server2". On starting these app OWS would have created two shortcuts with names "server1" and "server2". Both will have "Run in" directory as the OWS install dir. Now suppose you manually changed "Run In" directory in both the above shortcut files and then run the jnlps again. Are you seeing the behavior that OWS is changing the Run In directory in the short cut?

This is exactly the scenario i'm observing. It is independent of the two servers (in your example "server1/xyz.jnlp" and "server2/xyz.jnlp"). To make it easier lets just take server1/xyz.jnlp into account.
If i change the "Start in" directory of the shortcut "server1" to, e.g. "C:\tmp", it will be reset to the OWS install dir at the next run of the jnlp.

Why do you want to deactivate the hash suffix?
I understand the reason behind it. I was just curious and wanted to be prepared if one of my colleagues will ask me about that change :D

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Short update. A colleague of mine who is working in asia, doesn't have this problem. So i guess it is somehow related to my and my colleagues setup.
Maybe you have an idea where i can start searching for the cause of this behavior or what i can try out?

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

> To make it easier lets just take server1/xyz.jnlp into account.
If i change the "Start in" directory of the shortcut "server1" to, e.g. "C:\tmp", it will be reset to the OWS install dir at the next run of the jnlp.
I can confirm this behavior both with OWS 1.5.0 and OWS1.5.1. OWS overwrites the existing Desktop Shortcut Link file.

I can't say if this is a bug or it is the way it is supposed to be. But this behavior is different from Oracle JWS.

I ran https://docs.oracle.com/javase/tutoria ... lDemo.jnlp . I edited the downloaded jnlp file to remove href and include <shortcut><desktop/></shortcut> hint and ran the edited file with Oracle JRE 1.8.0_271 's javaws. It created shortcut. Rt-clk > Properties on shortcut link file. The "Start in" property was blank. I edited the "Start in" property. Ran javaws again. The "Start in" property was NOT overwritten.

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hi,

the AccessibleScollDemo.jnlp doesn't have the jnp\information\shortcut node. I think that's why Oracle JWS doesn't create the shortcut. I searched a bit and found https://wpollock.com/AJava/webstart/Demo.jnlp. I tried with Oracle JWS and the shortcut was created the first time and then never touched again. (c:\Program Files\Java\jre1.8.0_311\bin>javaws.exe https://wpollock.com/AJava/webstart/Demo.jnlp).

My colleague is using 1.5.0 too and the problem seems to be not happening there. So i guess it is somehow related to something environmental. For the time being, i have no idea where the differences are. I will try to figure out. If you have anything specific i can do, please let me know.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

> the AccessibleScollDemo.jnlp doesn't have the jnp\information\shortcut node.

True. I added the tag and removed href in jnlp and even then the shortcut was not created. It seems JWS shortcut creation depends on whether you choose to cache the app or not. This option is available in Java Control panel. For me it was disabled so no shortcuts were created. I enabled it and saw that the shortcut is created. My observation is that once Oracle JWS creates the shortcut it does not touch it when there is no href in the jnlp file.

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hi,
is there any news on that topic? Will there be a fix to not touch shortcuts after they have been created?
Unfortunately i wan't able to figure out why on my machine the shortcuts were touched again while this doesn't happen on a colleagues machine.
Kind regards

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

Jnlp HAS href:

Oracle JWS::
- Initially the "Start in" property of Desktop Shortcut is blank.
- Change the property.
- On running the Jnlp again, JWS overwrites the desktop shortcut link file making the "Start in" property blank. Thus any change in "Start in" property will be overwritten.

OWS:
- Initially the "Start in" property of Desktop Shortcut is OWS Install Dir.
- Change the property.
- On running the Jnlp again, OWS overwrites the desktop shortcut link file. Thus any change in "Start in" property will be overwritten with OWS Install Dir.

Jnlp DOES NOT have href:

Oracle JWS:
- Initially the "Start in" property of Desktop Shortcut is blank.
- Change the property.
- On running the Jnlp again, JWS DOES NOT overwrite the desktop shortcut link file. Thus any change in "Start in" property is preserved.

OWS:
- Initially the "Start in" property of Desktop Shortcut is OWS Install Dir.
- Change the property.
- On running the Jnlp again, OWS overwrites the desktop shortcut link file. Thus any change in "Start in" property will be overwritten with OWS Install Dir.

As you can see from above the behavior of OWS and JWS is same when Jnlp has href. But when Jnlp does not have href, behavior of JWS and OWS is different.

We will have a closer look at this and decide if OWS should behave the same as JWS and why it is important for OWS to enforce "Start In" to OWS Install Dir.

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hi,
i saw there is a new version of OpenWebStart 1.5.2 with changes related to shortcut handling.
Everything now works as expected. Many thanks for your help.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

Thanks for the positive feedback.

It would help if you can support us by buying paid support.

gdamerau
Posts: 8
Joined: 13 Jan 2022, 15:10

Re: Set working directory in shortcut

Post by gdamerau »

Hi,
sorry for my late response. I'm already in contact with the responsible department of my company. Fingers crossed.

Janak Mulani
Posts: 726
Joined: 24 Mar 2020, 13:37

Re: Set working directory in shortcut

Post by Janak Mulani »

Thanks. Btw, which company do you belong to? Your registered email id seems to be a personal email id.

Post Reply