System.getProperty("user.name") not working without /etc/passwd, CentOS 4.3
Dear all,
I'm having trouble getting the system property user.name (which we need in our ant scripts) on our CentOS box. :(
When running the program below thru
java dumpproperties2
it prints "user.name='?'" on our CentOS 4.3. On win32 it works. It turns out that if you add the account corresponding to the EUID to /etc/passwd it works correctly. However, we don't use passwd authentication but an enterprise wide LDAP-system. Our /etc/nsswitch.conf says:
passwd: files ldap
One work around is to replace the java executable with a script that does
/path/to/jdk/bin/java -Duser.name=$USER -Duser.home=$HOME $@
Used jdk is j2se 1.5.0_13 Linux 32-bit.
Some questions for the experts:
1) Is there any other way?
2) Is it a known issue that Linux versions of the jdk just looks in /etc/passwd to map uid to user name (and home dir) instead of doing what the rest of the system, like whoami, does? I haven't found anything in either the readme or installation instructions, nor in the bug db.
Br, Jesper Tr�g�rdh
public class dumpproperties2 {
public static void main(String[] args) {
String s = System.getProperty("user.name");
System.out.println("user.name='" + s + "'");
}
Does this work?
//public final class System
public static String getenv(String name)Then you can access the USER environment from inside Java.
Similar Messages
-
Hello,
Based on the user's requirements, I implemented authentication based on the results of the System.getProperty(user.name) feature. The audit group has some concerns on where the user.name value is coming from.
Does anyone have any idea where this property is coming from, and if it is coming from a file, whether it is stored as text.Environment variable that is read internally by the JRE. If you go to dos (in windows) and type "set" and hit return, you'll see Username=whatever your login name is. If course, someone with the right credentials can change this.
Unix has a similar feature. -
File System Repository - User Mapping not Working
Hi,
I tried to integrate a file system into KM. For doing so, I followed the guide located at [http://help.sap.com/saphelp_nw04/helpdata/en/ed/b334ea02a2704388d1d2fc3e4298ad/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/ed/b334ea02a2704388d1d2fc3e4298ad/frameset.htm].
The only problem is, tht the user mapping doesn't seem to work...
The portal is running on a UNIX system, whereas the file share to be integrated is running on a Windows 2003 Server.
Here are the single steps that I performed:
- Creation of a KM Windows System in the system landscape directory with the ID "MySystem". User Mapping is set to "User,Admin"
- Creation of a Windows System in the system landscpe of the KM with the ID "MySystem"
- Creation of a Network Path in KM with following settings:
jCIFS Protocol is activated; Network Path = "
My Server\My Share"; User = "My Windows Domain\My User" and the according password. The specified user has administration permissions on the server.
- Creation of a readonly File System Repository Manager with following settings:
Root-Directory = "
My Server\My Share", SecurityManager = W2kSecurityManager, ACL Manager Cache = ca_rsrc_acl, Windows Landscape System = "MySystem"
- Configuration of the W2KSecurityManager: I specified the DomainFile-setting as "/etc/companydomaincontrollers.txt"
and placed such a file in the KM with following setting: "My.Server.Domain=According IP Adress"
- In UME I carried out user mapping for index_service user and placed the above mentioned admin user into the user mapping.
Result: The indexing works fine, all fles are indexed. When I however try to carry out a user mapping for a "normal" portal user in the UME it doesn't work: The portal user has no access to the file system. (I used the same admin user for mapping... so it should work).
Any help is appreciated...
P.S. With portal super admin users I can however access the fle system repository, even without user mapping. But I think this is ok, because I read in one forum message that admin users have always access in general....>
Frank Friedrich wrote:
> Hi Clemens,
>
> so the good think is that indexing is working and you can navigate with your admin portal user through the file system repository. In this case the most configuration settings must be correct.
>
> I am not quite sure regarding your System objects with the ID "MySystem". Do you have as well define an Alias Name for this System Object with the same name "MySystem" ? As well upper and lower letters are important.
>
> Because the reference is all the time the Alias name and not the ID or Name of your System object.
>
> Best regards
> Frank
Hi Frank,
thanks for your reply.
I have as well definied an Alias Name with exactly the same id. So this gives us following:
System landscape directory: KM Windows System with id="MySystem" and Alias="MySystem"
KM System Landscape: Windows System with id="MySystem"
In the created file system repository manager I also set "MySystem" for the Windows Landscape System parameter.
So I think that this should be correct (I also considered upper- and lowercase letters).
Maybe the probem lies in specifying the domain names? When I applied user mapping I always additionally specified the Windows domain name of the users, which is correct I think.
In the security manager configuration for the domain controllers (-> [http://help.sap.com/saphelp_nw04s/helpdata/en/a9/c54e9e09448d46b73d154e93d5e995/content.htm]) I however mapped the network domain of the file share server to the according IP adress. Maybe this is wrong? -
System.getProperty("pc.name") ???
As the title of this post implies, I would like to get the PC name from within a client-side java app. Unfortunately "pc.name" is not a valid system property key. Nor are there any, as far as I can tell, that give me what I want.
Can anybody tell me how a client-side app can get the name of the PC on which it is running?
To be completely clear, I want the name that shows up when I click Start > Settings > Control Panel > System > Network Identification. (Yes, I'm running Win2K...)
Thanks!
BillHi,
:. Try this one. Comments in Portuguese.
class ... whatever you want, a library for instance.
public static final String OS_WINDOWS = "Windows";
public static final String OS_LINUX = "Linux";
public static final int CMD_SUCCESS = 0;
// = = = = = = = = = = = = = = = = = = = = = = =
// Carrega as variaveis de ambiente (#014)
public static boolean loadEnvironmentVariables()
{ boolean bRet = false;
String cmd = "";
String opsys = System.getProperty("os.name","");
try
{ if (opsys.startsWith(OS_LINUX)) cmd = "sh -c set";
if (opsys.startsWith(OS_WINDOWS)) cmd = "command.com /c set";
if (!cmd.equals(""))
{ Process p = Runtime.getRuntime().exec(cmd);
if (p.waitFor() == CMD_SUCCESS)
{ InputStream is = p.getInputStream();
Properties pr = new Properties(System.getProperties());
pr.load(is);
System.setProperties(pr);
bRet = true;
catch(Exception e) {}
finally
return bRet;
// = = = = = = = = = = = = = = = = = = = = = = =
// Hostname (#016)
public static String getHostname()
{ String sRet = "";
String opsys = System.getProperty("os.name","");
if (opsys.startsWith(OS_LINUX))
{ sRet = System.getProperty("HOSTNAME","");
else if (opsys.startsWith(OS_WINDOWS))
{ sRet = System.getProperty("COMPUTERNAME","");
return sRet;
// = = = = = = = = = = = = = = = = = = = = = = =
// Username (#017)
public static String getUsername()
{ String sRet = "";
String opsys = System.getProperty("os.name","");
if (opsys.startsWith(OS_LINUX))
{ sRet = System.getProperty("USER","");
else if (opsys.startsWith(OS_WINDOWS))
{ sRet = System.getProperty("USERNAME","");
return sRet;
:. First, call loadEnvironmentVariables method then getUsername, getHostname, etc. Hope it helps and it was what you meant.
Regards.
Roque. -
My viber is not working without wi fi
viber is not working without wifi
Hello!
Please answer the following questions to help me better assist you:
1. Is this a recurring issue? Does it occur with specific users?
2. When did the issue first begin? After upgrading Viber? After upgrading the operating system?
3. Have you made any changes to your phone’s operating system settings?
4. Where are you from?
5. Who is your provider? Please contact them and make sure you have full access to VoIP.
Awaiting your reply. Thanks for your help! -
System Identity User does not have privileges in ACS
Hello Everyone!!
We have CiscoWorks integrated with ACS, the authentication works but the authorization does not. I check and we have the role System Administration for this user in ACS for every applications like; Common Services, RME, DFM, IPM, Campus Manager, etc.
However in the Common Services < Home < Security< ACS appears the integration in red color and means that the System Identity User does not have all the privileges in ACS.
Any idea??
KathyLogin as the same user, use the same responsibility and then try to do the exact same update (item/field/value) using the screen.
Then use the api.
Make sure you add a line to set the context properly before calling ego_item_pub.
I did not see that in your code.
something like
fnd_client_info.setup_client_info(&appl_id, &resp_id, &user_id) -- replace the variables with the appropriate value
Hope this helps,
Sandeep Gandhi -
System.getProperty("user.dir") different in Ubuntu?
HI. I have this application which when the user presses the Help button an HTML user guide is shown.
this is done using:
String userDir = System.getProperty("user.dir");
System.out.println(userDir);
Desktop d = Desktop.getDesktop();
File f = new File(userDir);
URI u = new URI(f.toURI().toString()+"User_Guide/index.htm");
System.out.println(u.toString());
d.browse(u);This works on Windows machines, but when tested on Unix Ubuntu the user guide does now show.
The System.getProperty("user.dir") returns users/j/john/ which is not the complete directory. How can I fix this so that the Help button works on both platforms?Thanks!
Edited by: player123 on Jun 9, 2009 10:54 AM++
Make sure its Sun's Java no OpenJDK or others.
$ java --version
also echo $JAVA_HOME
it depends how its linked on yours.
Even if you install the Sun's JDK you must properly link it and/or set and export its home ;) -
Is there a System.getProperty("user.desktop")
I am trying to get the path of a user's desktop, regardless of OS.
I know that I can use
System.getProperty("user.home")to get the current user's directory, but what about the current user's desktop? is there a call for that?
if not, i know where the windows desktop folder is located, but I am unfamiliar with Mac, Linux, other Unix OSs...could anyone please share where their desktops are from the root dir?
thanks.Two suggestions so far for Linux:
* /usr/local/foo
* user.home
The first will probably only be writable if your installer* is being run by root / superuser. I'd say that the expected behaviour would be to extract to pwd - i.e. user.dir. However, as already stated I'd quite like to be given the choice first if it's a GUI installer. A console installer which extracts to pwd would seem quite reasonable.
Of course, you could take the view that most Linux users are used to getting a .tgz which they then extract whereever they want, so if your jar contains the file it extracts it's probably sufficient to put a README.txt in it and prompt the Linux user to read it.
Under OS X people will probably expect you to use the built-in installer. You might be able to build a suitable package without an OS X box - check Apple's website for documentation. The desktop is ~/Desktop (where ~ is user.home).
* If it's not an installer, although you seem implicitly to have agreed it is, I'd extract to /tmp/fooRND, making sure that it didn't exist and generating a new RND if it did. -
Why app store is not working without card details
My app store is not working without entering card details , I lost my olf apple id .
i MADE a new one .What do you mean by 'not working' ? Unless the instructions on this page are followed when creating an account : http://support.apple.com/kb/HT2534
then credit card details will need to be entered before the account can be used to download any item from the store.
If you mean that you are being prompted to review your account then you could see if this post by mountaingoatgirl lets you do so without needing to enter credit card details : https://discussions.apple.com/message/24303054#24303054
If not then you will either need to enter credit card details (you should be able to delete the card after entering it) or create a new account, and use the instructions on that HT2534 page when creating it.
How did you lose your old account ? If you can't remember its details then try the following :
Recovering a forgotten iTunes Store account name
Apple ID: How to find your Apple ID -
Do I have to buy Lion or snow lepoard or is there a way to updated from OS X 10.4.11?? I have a new ipod that will not work without the ne itunes, but the new itunes will not install without a newer vesion of Max OS X. Help please
Need to know your Mac model. If it's a PowerPC, the max OS is Leopard 10.5.x. If it's an Intel procesor, you can upgrade to Snow Leopard (for $29) & later to Lion.
*Mac OS X 10.5 Leopard installation system requirements*
http://support.apple.com/kb/TA24950
Leopard is no longer available at the Apple Store *but may be available by calling Apple Phone Sales @ 1-800-MY-APPLE (1-800-692-7753)*.
Installing Mac OS X 10.5 Leopard
http://support.apple.com/kb/HT1544
Mac OS X 10.5 Leopard Installation and Setup Guide
http://manuals.info.apple.com/en/leopard_install-setup.pdf
After you install the base 10.5, download & install the 10.5.8 combo update at http://support.apple.com/downloads/Mac_OS_X_10_5_8_Combo_Update
Cheers, Tom -
System.getProperty("user.dir") returns "/home/user" on Linux
Has anyone else had the error when launching a jar from Linux (just by clicking it), System.getProperty("user.dir") returns the "/home/user" (or "~") value instead of the folder that the jar is in? Essentially, it returns "user.home" instead of "user.dir".
This does not happen when I start the application from command line.
(I know its not swing, but I wasn't sure where to post it)
Is this just a simple Linux setting that isn't enabled by default? Ubuntu already made the file association after using apt-get to install Java 6.
Cheers.
-FBLBecause, semmingly, the command is being set off as
java -jar relative/pat/to/file.jarwhen you double click it, rather than
cd relative/path/to
java -jar file.jarIf you don't like this, I would say to find a Linux, preferably Ubuntu, forum and ask there if it is possible to change that handling, and if not, request that a cahnge be made to the code to change that handling. But, in any case, I doubt you are going to get an answer here about it. -
Cannot sign in to trial account (user name not recognized)
Hi all,
I registered for a trial account of Windows Intune yesterday, but after submitting the registration request, the website told me something went wrong during account creation and threw an error (1004). I tried registering again but it tells me the account
is already registered.
Now, when I try to sign in to Windows Intune with my credentials, I get the following message:
User Name Not Recognized
This user account is not authorized to use Windows Intune. Contact your system administrator if you think you have received this message in error.
I am unsure what went wrong, but as I would really like to start trying out the platform, any help is very much appreciated!
Thank you and kind regards!Hi,
I would either create a new trial account as it seems that something went wrong with your registration of your first account or contact Microsoft Support and see if they can assist you with the account you have created.
regards,
Jörgen
-- My System Center blog ccmexec.com -- Twitter
@ccmexec -
Applet reading System Propertery user.name
i got an applet which read the system property user.name .
i signed the applet. but still got accessdenied exception.
then i changed the java.policy file and the applet works fine.
but how can i do this for other users? is the java.policy file the only way? how can i make it easy for other users to run the applet?What I did for my applet was I create a certificate for the applet file using the command 'keytool' with some extra options such as -genkey and then I used 'jarsigner' to sign my JAR file.
You might want to google on how to use the keytool function.
I used to post a question regarding the applet policy file as well
http://forum.java.sun.com/thread.jspa?threadID=5206927&tstart=90
because what I wanted to do last time was to open up a file and also getting user name which is log on to the current computer.
Hopefully you can get your applet to work. Cheers. -
SLD connection user/password not working.
Hello friends,
I am new bee in SAP Netweaver.
I installed SAP Netweaver for java.
Now I want to connect it with BAPI from SAP.
so, some where i am sucked with SLD. I opened Visula Administrator and nothing there to connect.
I also tried http://localhost:50000/sld but my user/password not working.
1. What to do to see/get username/password for SLD?
2. How to connect netweaver to access SAP ZBAPI?
Regards,
RHHello friends,
I am new bee in SAP Netweaver.
I installed SAP Netweaver for java.
Now I want to connect it with BAPI from SAP.
so, some where i am sucked with SLD. I opened Visula Administrator and nothing there to connect.
I also tried http://localhost:50000/sld but my user/password not working.
1. What to do to see/get username/password for SLD?
2. How to connect netweaver to access SAP ZBAPI?
Regards,
RH
Hi Ronny.
Where is your UME running? On the java engine, on an ABAP system or at a LDAP?
What i want to say is that your user has to gain the rights to connect to the SLD. Easiest way is to give you admin rights - to do that you have to know where your userstore is running....
I am not sure if this is correct http://localhost:50000/sld
Normally it should look like http://my.sap.com/56600/sld where my.sap.com is a fqdn and 56600 is the port of the java engine. 66 ist the system number of the as java.
ZBAPI? I do not really know but i think you have to use a jco to connect...
regards,
Martin -
System.getProperty("user.dir") cannot rerturn the package directory.
i have a class belong to package suyuan
the class file is located at
D:\Profiles\cyc025\Desktop\suyuan\test.class
i try to execute System.getProperty("user.dir") inside test.class.
i get D:\Profiles\cyc025\Desktop
but i wish there is a java api which can return
D:\Profiles\cyc025\Desktop\suyuan
how can i do so?
thank you.
regards
yan chengThe system property "user.dir" returns the current working directory. The "suyuan" is a part of the java package of test.class - it has nothing to do with each other. If you want your string you need to create it via
String pn = getClass().getName();
int i = pn.lastIndexOf('.');
pn = pn.substring(0, i);
String mine = System.getProperty("user.dir") + File.separatorChar + pn;
Maybe you are looking for
-
Key flexfield - protecting one of the segment as NON-UPDATABLE/ READ-ONLY
Key Flexfield setup for "People Group Flexfield" consists of seeg1,seg2,seg3,seg4. We would like to make Seg1 of this flexfield "READ ONLY" / "DISPLAY ONLY" / "Non-Updatable". Please advise possible way of making this functionality. I have tried, fol
-
Fedora core 6 sun app server won't start
Sun app server 8.2 bundled with creator 2u1 doesn't start. This install was running fine under fc5. Among other things I get the following with pe-start -reset which I think might be the crust of the problem: "Unable to read system environment. No sy
-
As a newcomer to the iPad, can you please tell me how to return the font size to standard. Somehow I've enlarged the font size until it's unreadable and it applies to the icons as well! Many thanks in anticipation.
-
Funtion Module IDOC_INPUT_INVOIC_FI help
I am trying to post an inbound 810 using FM IDOC_INPUT_INVOIC_FI and I keep getting the follwoing error message F5 566 - Specify a Tax Jurisdiction Key. I am using IDOC Type INVOIC01 and I am populating the E1EDK04 and E1EDP04 records. I have ent
-
JAXB object creation for common XML
Hi, Does JAXB let us create common Java Objects for common XMLs. Consider the following scenirio: XML1.xml <xsd:schema> <xsd:import namespace="Commons" schemaLocation="Commons.xsd"/> <xsd:complexType name="ComplexElementType"> <xsd:sequence> <xsd:ele