Results 1 to 8 of 8
Thread: java runas admin
-
-
Re: java runas admin
bump...
- 07-13-2012, 07:29 PM #3
Re: java runas admin
Um... I am a bit confused on what you are doing. My assumption though, is that you cannot use:
because the program was installed on your computer as administrator (you are using Windows, no?). Usually this is not a problem. Are you trying to run this on the Command-Line and running into a problem?Java Code:java MyClass
My other assumption is that you are trying to execute a program or command from your java application (hate the word app >:( ) that you want to run as admin. If that is the case, you would have to run your program as admin so it has the privilege and right to use admin level commands. I am not too sure if there is any other way to do this. I am using linux and it has been a while since I have used Windows, and running has another user might be a bit different or even a hack to get to work.My API:Java Code:cat > a.out || cat > main.class
-
Re: java runas admin
sorry i should've explained it better.
this is the code i'm trying to run:
this is the error message i'm getting:Java Code:String[] cmd = { "mmc.exe","diskmgmt.msc" }; Process exec = Runtime.getRuntime().exec(cmd);
Cannot run program "mmc.exe": CreateProcess error=740, The requested operation requires elevation
- 07-14-2012, 04:30 AM #5
Re: java runas admin
From what I researched, it cannot be done in Java, by it's self. I took a 2 minute Google search to find out this issue. Try using Google to figure out your problems when they arise, it could be very beneficial, and your answers could come much quicker than depending on the folk who roam these forums.
In linux, I would create a program shell, python etc program that would do this task for me, then return to the Java Program. It seems the same with Windows... except in your case, you will need to do some Visual C++ in order to achieve your goal.
UAC Prompt From Java: CreateProcess error=740, The requested operation requires elevation (ShellExecuteEx Runas Example) - Mark S. Kolich
This is a link to a guy who had the same problem as you. It will tell you everything he learned and why java will not do the job for you because of the UAC prompt in win-vista and win7...
So you have 2 options:
- run the java program in a user that has higher privilages then you (admin perhaps). doing "runas /user:admin java MyClass" or something like that should be what you are looking for.
- otherwise, you can write the Visual C++ program to help with getting the runas prompt up for you.
I hope this helps!
My API:Java Code:cat > a.out || cat > main.class
-
Re: java runas admin
@kammce.
i always do use google + most often, find a working answer. but not this time, so i took your advice + wrote a windowless c++ program...
thanks for the help.
- 07-15-2012, 04:48 PM #7
Re: java runas admin
@.paul.
Sweet! I am happy to have helped... if this is all solved for you, put [SOLVED] in the title of this forum thread. I think the actual solve button is still disabled, and that might be the only way to say that this thread is solved.My API:Java Code:cat > a.out || cat > main.class
-
Similar Threads
-
Admin Help Please
By Ciwan in forum Forum LobbyReplies: 0Last Post: 06-27-2011, 04:52 PM -
Client/Server/Admin, architecture discussion
By MatuX in forum JDBCReplies: 1Last Post: 12-20-2008, 09:28 PM -
Java SQL Admin Tool 2.4.2
By JavaBean in forum Java SoftwareReplies: 0Last Post: 11-12-2007, 06:05 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks