user.home in windows ts running eclipse rcp project - rcp

So me and a friend have created an application using Eclipse RCP. Now we want to distribute it using Windows Terminal Services. I have Windows TS up and running and have added about 6 accounts on it. I have also deployed my Eclipse RCP applications using the TS Remote App Manager. The application needs to create a folder in the users folder to store data, so the configuration is set up to create this folder "#user.home/...." Great, so now we try to access it from our TS Web Access site.
The first two accounts we have tried to run it on work fine, and are performing the way we desire. However, the remaining start the application but immediately give me an error message saying that we dont have access to the configuration folder at C:/Users/Administrator/... I can see the problem is that my users don't have the authority to write to the Admin folder, but I am confused as to why the user.home is referencing the Admin folder instead of the users folder. I have tried changing the users home folder in the profile and Terminal Services section of their properties but neither of these makes a difference. Does anyone know why user.home would return the Admin folder. Thanks!

Turns out the "Home" key was not set up in the users directory. It could be fixed by following the directions in the answer found here. Java user.home is being set to %userprofile% and not being resolved

Related

Cannot rename files from within sandbox

Do Win10 handle file permissions differently than Win7? Even when Properties > Security > Advanced permissions for files/folders seem to be identical?
Problem:
For several years, I've been running my browser within a Sandboxie sandbox. Now I migrated from Win7 to Win10, using the same Sandboxie configuration. But in Win10, the sandboxed applications have troubles in renaming files. Sandboxie does work with Win10, and no one reported the troubles I have.
For example: When I run Notepad in SB, it is unable to rename any files, not even those it just created. When I run Firefox from within SB, it does not remember its configuration from the previous run - that's because it is unable to rename .tmp files with updated configuration (e.g. "extensions.json.tmp" to "extensions.json"). Everything else seems to work fine.
Q: Do I have to set anything differently in Win10 than it was set in Win7?
Details: Without SB everything works correctly, in SB only the file rename seems not to work. The only difference I found is that without SB the apps are executed under my win accout, while in SB they are executed under the "ANONYMOUS LOGON" account. The privileges of both accounts seems to be almost identical (checked using the "Process Explorer" app).
The whole directories and everything within them is owned by me, and SYSTEM, Administrators and OWNER (myself) have full control on all files and folders, recursively.
When I create a folder, and then a file within that folder, I can rename that file even from within the sandbox. But I see no difference in privileges of this new folder/file and other folders/files created earlier (they all are owned by me, and SYSTEM, Administrators and OWNER have full control in all cases).
The same setup works in Win7Pro, but not in Win10Home. What's the problem?
Version: Win10Home x64 v10.0.18362, Sandboxie 5.30
The problem was in Sandboxie 5.30. It has been already fixed in 5.31.2.

SQL Server 2008 Database Changing Read Only state to 'True' After Deployment

I'm creating a Installation Setup for one of my applications using visual studio setup project in VS2010. In which I'm accessing my database from application folder. I have added both MDF and LDF files to Data folder in Application folder.
Everything works fine and I'm able to install the application, but when opening the application I'm getting an error saying 'Cannot update database because its read-only'. I have checked the database with SSMS and see that the Read-only flag is set to True by default and database is showing in gray color. After change the read only property the application works fine.I have done a lot of searching and rebuild-ed the project many times with changing the database. How can i get rid of this issue ?
A couple of possibilities:
In your setup project, on the properties window of the DB file in the File System on Target Machine view, make sure you didn't accidentally set the Readonly property to true.
If the database is in your Application folder in (for example) the Program Files folder, well that location is read-only to limited users. You haven't said whether your app is for all users or just administrators. If it's for a limited user then install the file to User's Personal folder or a location that limited users can write to. If the app requires admin privilege then your app needs an elevation manifest to cause it to run with admin privilege, if that's why the DB is readonly. Running your app as administrator would be a quick test to see if this is the issue.

Maven reads user configuration from wrong location

I just discovered why Maven doesn't work properly on my machine. For some reason it reads the user configuration from the completely wrong location. And I don't understand why. When I run maven with the -X switch I get the following output in the beginning:
[DEBUG] Reading global settings from D:\dev\maven\active\conf\settings.xml
[DEBUG] Reading user settings from D:\.m2\settings.xml
[DEBUG] Using local repository at D:\dev\maven_repo
Why is it reading user settings from D:\.m2 and not my actual user directory like it normally should? It worked fine on my old computer. Does it have something to do with me having installed maven on a different drive this time? On my old computer it was installed on the C drive.
Where does it get this D:\.m2 from? How can I make it read the user settings file from the actual default location, %userprofile%\.m2?
Finally figured it out. Found the solution in this blog post. To find the home directory in Java you do this:
System.getProperty("user.home");
Problem is, for some dumb reason, Java isn't using Windows environment variables or anything like that to find this path. It actually uses the parent directory of the Desktop directory. Since I like to keep certain main folders in my user directory on a separate drive (documents, downloads, music, desktop, etc) I had moved the desktop directory to D:\Desktop. Java then takes that directory, goes one level up and makes Maven and other java applications think D:\ is my home directory.
Gotta say the more I use Java the more i hate it... anyways, hopefully this might help save some hours of head scratching for someone else too.
Update
The original blog post is gone, but found on the WaybackMachine (the URL has been updated), but here's the gist from that post in case that goes too...
The issue: So how does Java play into all of this? Well, Java
developers sometimes want to store settings for their applications in
a folder within the user’s profile directory. It’s the Linux way, and
Java tends to do things the Linux way. (As mentioned earlier, Windows’
“AppData” folder servers the same purpose, with some extra separation
for data dependent on whether or not it should roam with the user’s
profile.) For some reason, Java does not use the Windows environment
variable to determine the location of the user’s profile, but instead
access a registry key that references the user’s desktop folder. It
then takes the parent directory of the desktop and assumes that is the
user’s profile folder (assuming the user makes use of the default
setup Windows chooses).
Essentially, when a programmer calls the Java command:
System.getProperty("user.home");
Java uses the following idea to determine where my user profile folder
is:
PATH_TO_DESKTOP_FOLDER_AS_SET_IN_THE_REGISTRY + "\..\"
This breaks down when the desktop folder has been modified.
So, with my setup, instead of saving settings at:
c:\users\tim\
Java apps tend to save data to:
t:\tim\
In reality, Java apps should save settings to:
c:\users\tim\AppData\Roaming\
or something like that.
To add insult to injury, the Java apps continue to follow the Linux
way and use a period at the beginning of the folder name in an attempt
to “hide” the folder (as is done on Linux). For Windows users, this
simply ensures these folders are listed first in directory listings.
(Hiding a folder on Windows is achieved through setting the hidden
attribute for the file.)
It looks like NetBeans has addressed the issue for their application,
but the root issue remains an unresolved, low priority bug. Somehow
I’d bet it would get fixed a lot faster if the mechanism for
determining the user’s home path on Linux was wrong.

How do I Include a file in a release package that is not part of the project

I need to create a release / install package. There is a drop down box in VS that lets me create a release version for the project. So I hit the publish button and choose the CD option. Sure enough it publishes the a setup I need. I installed the application everything goes fine though I have no idea where on the target machine where the application ended up??? Trouble is my application has signed XML file that stores the public keys my application uses to enable features depending on what a customer is licensed to do. I would like the key file to be part of the package that is installed so I don't have to send it seperately. I have to send the license file but I was hoping to avoid confusion by only requiring the user to only have copy the license file to the local directory. Which brings up another question were is application installed I did a search and found nothing with my application name???? But thereis an icon onthe star menu and the applicaton seems to run just file
You probably deployed your application as a "ClickOnce" Application. It installs the program to an obfuscated folder in your users folder. On Windows 7 it winds up in something like "c:\users\username\AppData\Local\Apps\2.0\somefoldername\somefoldername". If you need more control of the installation, the free InstallSheild LE that comes free with VS2010 is not a bad choice. It will let you add additional files as well.

How to delete application file from AppData\Roaming folder

I am using windows installer to create setup project.
How I can remove/delete application files from AppData\Roaming folder when application uninstalled.
I tried added a special folder and set DefaultLocaltion to [AppDataFolder] but it didn't working.
Do I need to do anything else?
I'd need to understand what you are trying to do to give you specific advice. In general what you are trying to do would be OK removing files from CommonAppDataFolder but not AppDataFolder as trying to clanup user data from multiple user profiles is not a best practice. Additionally trying to cleanup Roaming Profile User data is outright impossible because the other users aren't logged on.
You'll want to read:
Managing Roaming User Data Deployment Guide
Assuming you are trying to do what I think you are, you'll need a cleanup script / exe that you leave behind on uninstall and a custom action to write to the registry during uninstall ( MSI can't do this natively ) to call that script/EXE. You'll want to leverage the Active Setup trick as described here:
Using Active Setup to Repair User Settings
The way it'll work is your uninstall leaves the EXE and registry entry behind so that when a user logs on it's roaming data gets pulled down from the server to local and Active Setup realizes it hasn't run the script yet. The script runs (once) and the data is deleted. When the user logs off the data is replicated / deleted on the server. Then they log on again it doesn't run again.
By default Windows Installer does not remove the files created by your application, after the installation. To do that you need to either write your own custom action, that will run upon uninstall, or depending on the tool used for authoring the MSI, you can use built-in options for cleaning the application locations, as some tools have this support.

Resources