ANT root directory - ant

How to get the ant root directory (in a crossplatform way) ?
For example:
in linux or macosx would be: /
in windows would be: C:/
etc..
Thanks..

I don't think you can get that directly.
Probably, you can get the user.home system property and extract the root from it.

Related

How to define repository.home at startup

I'm trying to define a folder for the Tar/Repository files in Sling. However, I can't figure out the right way to set an alternative repository.home folder.
As I understand it the Tar SegmentNodeStoreService is supposed to default to a folder under the {sling.home} path, set with the -c argument. No matter what I try it is always placing the repository folder relative to the folder I'm running start from. The rest of Sling goes in the sling.home folder.
For instance, if I'm in
~/Development
and I run
java -jar project/target/sling-app.jar -c /temp
The sling bundles, logs, etc will be under /temp, but the sling/repository folder will be put under the ~/Development folder.
I've tried adding these extra command line arguments too, but they don't help.
-Drepository.home=/temp
-Dsling.repository.home=/temp
Thanks in advance
Turns out it was a bug and it is now fixed in sling 9
https://issues.apache.org/jira/browse/SLING-6022

What's the difference between "./" and "/" when using Apache related programs?

I don't know if it's actually Unix operation, but there are often times when the instruction says we should use "./bin/WHATEVER" while other times says "/bin/WHATEVER"
What's the difference?
A period means the current directory and a path that starts with a / is the very root of the partition. So this:
./bin/whatever
Means a folder called bin inside the current directory. Whereas this:
/bin/whatever
Means the bin folder is in the root of the partition.

Java windows command

I am trying to compile some java code on Windows 7 pc, I have installed java JDK and I am trying to use the javac command in cmd but I get output saying that
'javac' is not recognized as an internal or external command,
operable program or batch file.
What do I have to do to enable compiler in cmd or is it possible to do in Windows?
1)Go to properties by right click on icon Computer , then navigate to Advanced System Settings.
2)Click Environment Variables.
3)Click on New , set Variable name as path and Variable path as the path of java jdk installation directory which could be something like this -
C:\Program Files\Java\jdk1.6.0_23\bin;
where C:** is the drive where JDK is installed and **Program Files\java is the directory where it resides.
look out for semi-colon(;) at the last.
4)Click ok
5)Restart cmd and run javac , it should work now.
Look for Screenshots here for more help.
Regards
Anshul
you have to set a new system variable for your JAVA_HOME in windows.
See here for further information.
Add the path to bin folder of JDK in your PATH variable. For instructions to set PATH variable follow this tutorial.
Your java directory is not on the path. Here are some helpful screenshots to show how to set it up:
http://vietpad.sourceforge.net/javaonwindows.html

What determines the location of the .grails directory?

I want to change the location of the .grails directory. I have read about using working directories, but this is not what I want. For some reason my .grails directory gets put in the "Administrator" user folder instead of in my user folder. How do I correct this?
The grailsWorkDir property controls the location. You can change the value in the BuildConfig.groovy file.
See the Grails documentation section 5.5 Customising the build:
There is an issue with Java and the user.home property in Windows. See this SO question for more details:
Java user.home is being set to %userprofile% and not being resolved
On Windows 7, the values in the registry for "Shell Folders" AND "User Shell Folders" in the registry path "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" affect the user.home and in turn the location of the ".grails" folder.
Try to setup the user.home JVM arg correctly on windows environment

java.exe always point to the path of JRE but not JDK

I have both jdk and jre installed on my windows 7.
I have set the JAVA_HOME to
C:\Program Files\Java\jdk1.6.0_23
I have add
C:\Program Files\Java\jdk1.6.0_23\bin
to PATH.
but the java.exe still pointing to my jre dir, which is
C:\Program Files\Java\jre6\bin
since when I run
java.exe -server
it complains
Error: no `server' JVM at `C:\Program Files\Java\jre6\bin\server\jvm.dll'.
can anyone tell me what else do I need to set?
since you are on windows, java doesn't work like that.
there is a java.exe in some windows directory (%windir% system32 for you)
This java.exe actually looks in the registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
PATH won't help ya! Since I tend to get lazy I delete the JRE and create a junction to the JDK instead.
Just remove java.exe from %windir%\system32
If you have a 64bit operating system, it will try to use the 64bit jre that is preinstalled on windows 7. You can try using add/remove programs to remove the 64bit jre. I've had this problem several times and I've always fixed it by removing the 64bit jre.
Right click MY Computer> properties > Advanced System Settings > Environment Variables >
Search for Path..
Remove the exisiting path and then add yours..
take care of the semi colon
make sure that your JRE/bin directory is not included in your path. the first instance of java.exe found while searching your path will be the one that is executed. if you've added your JDK to the path after the JRE then the JRE will always be picked.
you can also explicitly specify the full path to java.exe when invoking java. this will ensure that you always know what java jre/jdk you are invoking.

Resources