Cannot change path to user's profile

Hi everybody!

Here’s my small problem:

I want Spark to store user’s data in special folder (not in c:\documents and settings\username\Application data\Spark) but I can’t understand where I was wrong.

I use following batch file to start Spark 2.6.0 on Win2k3:

@echo off

setlocal enableDelayedExpansion

set my_spark=Spark_%username%.exe

set tmp=%TEMP%\resources

set app_home=x:\programs\Spark

set user_home=c:\temp

set userprofile=c:\temp

set java_home=%PROGRAMFILES(x86)%\Java\jre6

copy “%java_home%\bin\javaw.exe” “%user_home%%my_spark%” /y >NUL

set CLASSPATH=

for %%i in (%app_home%\lib*.jar) do set CLASSPATH=!CLASSPATH!;%%i

cd /d “%app_home%”

“%java_home%\bin\java.exe” -Duser.home=c:\temp -Xms16m -Xmx16m -XX:NewSize=4m -XX:MaxNewSize=4m -XX:PermSize=16m -XX:MaxPermSize=16m -XX:+PrintGCDetails org.jivesoftware.launcher.Startup %autologin%

But Spark creates user profile in c:\documents and settings rather than c:\temp.

Please help me to know where I was wrong.

P.S.: sorry for my poor English

i dont think

<< set userprofile=c:\temp >>

works

it was just a last hope

The JAVA manual says that I can change user’s home directory with -Duser.home=some_path in the command line. But it seems that Spark 2.6.0 does not use user.home variable to get user’s profile path.

you’ll have to modiffy the source

trunk/src/java/org/jivesoftware/Spark.java

line # 65

private String USER_SPARK_HOME;

Your answer was not really helpful but I needed it.

In Spark.java I found this:

if (System.getenv(“APPDATA”) != null && !System.getenv(“APPDATA”).equals("")) {

USER_SPARK_HOME = System.getenv(“APPDATA”) + “/” + getUserConf();

} else {

USER_SPARK_HOME = System.getProperties().getProperty(“user.home”) + “/” + getUserConf();

}

And desision is:

set APPDATA=c:\temp

Thank you for your duty!

I bet we have the same intention of changing the spark home directory… maybe we can help each other to this… I guess you need to rebuild spark according to source, not with the one’s installed on your pc…

I have build a branded or skinned version of spark, every name and every icon or images was changed… The only thing that’s left unchange is the spark home directory and the default downloads directory…, where “%HOMEDRIVE%%HOMEPATH%\Spark” originaly looks like this **“C:\Documents and Settings\User\Spark\user\username@myserver.com\downloads”… **** **

As per master Wolf_P advise:

youll have to modify 3 parts of the source within spark.java to modify the home directory of spark

#65

private static String USER_SPARK_HOME; //<-------- Variable declaration

#88ff

if (System.getenv(“APPDATA”) != null && !System.getenv(“APPDATA”).equals("")) {

USER_SPARK_HOME = System.getenv(“APPDATA”) + “/” + getUserConf();

} else {

USER_SPARK_HOME = System.getProperties().getProperty(“user.home”) + “/” + getUserConf();

}

this is where the Path is set

and

#425

public static String getUserConf() {

if (isLinux()) {

return “.Spark”;

}

else if(isMac())

{

return “Library/Application Support/Spark”;

}

else

return “Spark”;

}

Now, I don’t have any programming knowledge… where do these lines set “**C:\Documents and Settings\User\Spark”? **in my case I wanted to replace “Spark” in my customed name like **C:\Documents and Settings\User\mysparkname" **can you set this one? also set one with C:\temp folder and I will build a installer for you.
Spark.java.zip (4814 Bytes)

changed foldername to SomeOtherName:

http://pastebin.com/VFvW2sGn

and changed path to temp:

http://pastebin.com/gnHTmvwe

1 Like

Thanks a lot master Wolf_P!!! You are such a genius!!! spark home folder changed!!!

By the way sorry for my attached file…

@Pelevin, I’ll sent you a link once done with re-build!! with C:\temp directory…