Closing cd tray using java application
sir,
i want to close the cd tray using java program.i opened it using a vbs file which can be called through Runtime.getRuntime().exec("WScript <filename.vbs> ");
But i want to know how can close this cd tray using java programming...
the vbs file cotains the code for opening as
CreateObject(\"Shell.Application\").NameSpace(17).ParseName(\"g\" & \":\\\").InvokeVerb(\"e&ject\")");
Now i want to close the cd tray using a vbscript or through any other method which can be implemented in java..plz help me...........
You can not do it directly, it would have to be via Runtime.exec, or JNI.
As to how to do it via VBScript, this would not be the best forum to ask on. I'm sure Google will tell you if you ask it nicely.
Similar Messages
-
How to send attachments using java application and outlook
Hi ,
I created an application in java which is as
on the Conference Tab i can schedule a conference and with the send command on page it map all the scheduled data to outlook(with all conference details) and using outlook send option the mails are send to appropriate user.
but now i want to modify this application such as when i use the send command from my jsp page it should attach the file that is in .vcs or .ics format for auto updation of user calender.
can any one know how to send attachment using java application .Last time I checked, SMS was a service between carriers and doing SMS yourself was really tricky. Some services existed to let you do it but as I recall they wanted non-trivial money.
However, most phone carriers provide an email-to-SMS bridge of some kind.
So the easiest thing is just to send an email.
That's sending from a non-phone to a phone. There's a J2ME library to send/receive SMS from/to a phone.
However, this is from memory, and a little out of date, so I could be entirely wrong. Hope it helps anyway. -
We have a requirement to print the w2 forms for employees using java application, how can i implement this. Please give some suggestion.
Anyone any ideas to help please?
-
How to import the image by using java application
1.how to import the image by using java APPLICATION and display it on the textarea that you have been created.
2.how to store the image into the file.
3. what class should i used?
4. how to create an object to keep track the image in java application.
* important : not java applet.
plzzzzzzz.
regards fennyfollow the link:
http://java.sun.com/docs/books/tutorial/2d/images/index.html -
How to invoke Default printer of my system by using java application
I need to invoke default printer of my system by using java application ? could u plz help me out with sample code?
VoodooMagic.getDefaultPrinter().print();
http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html
Look for more at Google. -
Manage Windows Using Java Application
Hi,
I am now developing a project, where we need to track the total time working.
Eg. If i am working with outlook in my machine in various times, at the end, it should give me the total time of working with outlook.
For this, i need to get the Windows ID (this case outlook). How can i access OS windows using java applications.
Any idea how to do this???Hello,
Syntax for Running report as JSP is as follow. The parameters can be passed by using "+" or "&".
http://server.com/Employee.jsp?server=sac&destype=cache&desformat=html&userid=scott/tiger@database
Use can pass reference parameters(user parameters)while ruuning the report.
User can use User Parameters in his reports:
"select * from emp where hiredate = :P_1"
User can pass this parameter to Reports(while running it as JSP)as a parameter.
http://server.com/Employee.jsp?server=sac&destype=cache&desformat=html&userid=scott/tiger@database&P_1=17-09-2000
With Regards
Sachin -
Error in sending mail Using java application using SMTP.
Hi,
I have created a java application of self user registration which also sends email to the user.
I have also added two JAR files ie mail.jar and activation.jar under the PORTAL_INF/lib.
The code works well in other servers but its showing the error-
java.lang.NoSuchMethodError: com.sun.activation.registries.MailcapFile.getMailcapList(Ljava/lang/String;)Ljava/util/Map;
Thanks & Regards,
Amarys.Hi Amarys,
Please check if you have configure the mail server in SAP protal.
Refer to below documents:
[Send email, using SMTP on remote host|Send email, using SMTP on remote host]
[Mailing throw webdynpro for java|Mailing throw webdynpro for java]
Best Regards
Arun Jaiswal -
Hardware identification using Java-application
Hi,
please help me! I would like to get some hardware-specific information using a Java-application? Is it possible?
Thanks everybody,
dzsitterProbably not, in pure Java. Depends on what the "hardware" is that you had in mind.
-
Unable load jasperreports using java application
I have created a report using jasperassistant.
But i could'nt run the report using my java
application.below given is the code sgment to call the
report.
try{
String rFile="/root/Production.jasper";
HashMap rptHash=null;
FileInputStream fs=new FileInputStream(rFile);
System.out.println("loading report file , read " +fs.available());
JasperReport template=(JasperReport)JRLoader.loadObject(fs);
System.out.println("Successfully created the report");
JasperPrint report=JasperFillManager.fillReport(template,rptHash,conn);
System.out.println("Report filled with data");
}catch(JRException jex)
System.out.println("Jasper Exception :"+jex.getMessage());
System.out.println("Jasper Exception :"+jex.fillnStackTrace());
System.out.println("Jasper Exception :"+jex.getStackTrace());
System.out.println("Jasper Exception :"+jex.getLocalizedMessage());
While running this application ,it throws into the
exception section.
Out put of the program is
Loading report file ,read 15275
Jasper Exception : Error loading object from InputStream
Jasper Exception :net.sf.jasperreports.engine.JRException :Error loading object from InputStream Jasper Exception :[Ljava.lang.StackTraceElement;@e7b241
Jasper Exception :Error loading object from InputStream
I request you to go through my code and give me some help to solve this asap.
thanking youDo you actually mean you want to make sure that only one instance of a GIVEN Java program is running at one time? If so then search this forum becuse this question comes up frequently.
-
Unable to run jasperreport using java application
I have created a report using jasperassistant.
But i could'nt run the report using my java
application.below given is the code sgment to call the
report.
try{
String rFile="/root/Production.jasper";
HashMap rptHash=null;
FileInputStream fs=new FileInputStream(rFile);
System.out.println("loading report file , read " +
fs.available());
JasperReport
template=(JasperReport)JRLoader.loadObject(fs);
System.out.println("Successfully created the report");
JasperPrint
report=JasperFillManager.fillReport(template,rptHash,conn);
System.out.println("Report filled with data");
}catch(JRException jex)
{System.out.println("Jasper Exception
:"+jex.getMessage());
System.out.println("Jasper Exception
:"+jex.fillnStackTrace());
System.out.println("Jasper Exception
:"+jex.getStackTrace());
System.out.println("Jasper Exception
:"+jex.getLocalizedMessage());
While running this application ,it throws into the
exception section.
Out put of the program is
Loading report file ,read 15275
Jasper Exception : Error loading object from
InputStream
Jasper Exception
:net.sf.jasperreports.engine.JRException :Error
loading object from InputStream
Jasper Exception
:[Ljava.lang.StackTraceElement;@e7b241
Jasper Exception :Error loading object from
InputStream
I request you to go through my code and give me some help to solve this asap.
thanking youHi Again Monty.
I may have given up too soon.
Click once on the downloaded TheGame.zip file to highlight it.
Press the Command⌘ + I keys, to Get Info.
Change Open With to Stuffit Expander.
Double-Click on TheGame.zip.
A folder titled TheGame will be created. Open that.
In there will be:
decks An Empty Folder
Game.jar
game.xml
images Folder This one has many sub entries.
preferences.properties
readme.txt
release_notes.txt
runme.bat
When I Get Info on Game.jar, Open With is set to Jar Launcher.
That's as far as I am going though. does that help any?
ali b -
Want to shutdown solaris 10 using java application
Greetings all!
I have been unsuccessful at creating my application to shut down a Solaris 10 server with a java application. I am hoping someone might be able to point me in a good direction here.
I want to log on as a regular user and run a java application that monitors remote information (UPS battery voltage) and will gracefully shutdown the server if there is a problem. If I run my application as root all is well, except that I am running as root :)
I can write code to access the shell:
Process proc = Runtime.getRuntime().exec("ls");
BufferedReader Input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
while ((s = Input.readLine()) != null) {out.println(s);}
But I can't do a "su"?
I've tried multiple examples out there of code that allows shell communication, and good examples of using Runtime.getRuntime()
I think the conclusion is that you can't issue a su command via java application.
I've also tried to telnet from a console to localhost and log in as root - no joy there either.
Would someone have information that might point me in the right direction to solve this problem? Even better, if there is a sample snippet to go along with any help.
Thank You very much!
RayWow,
Thank you for the very detailed response! I read the referenced web page last night, I'll read it again today too. RBAC sounds like a pretty complicated administrative tool. Coming from the Win32 domain, most of this security stuff is sadly uncharted territory for me (except for my mac).
Let me see if I understand your method:
Create a role, javarole, this role needs Primary Administrator priviliges (in order to invoke "shutdown -y -i5 -g0") only available to root
Create a powerdown profile, essentially a script:
this line creates the file:
# echo "powerdown:::profile to powerdown server:help=powerdown.html" >> /etc/security/prof_attr
I think this is the actual added script: (instead of the shutdown command just use init 5)
# chmod 755 /usr/sbin/powerdown
# cat > /usr/sbin/powerdown <<EOF
#!/bin/sh
/usr/sbin/init 5
EOF
This line is a bit confusing to me, is it also part of the script?
# echo "powerdown:suser:cmd:::/usr/sbin/powerdown:uid=0" >> /etc/security/exec_attr
I see the uid=0 (root)
It seems obvious to me that I log in a root to create this script, which is the reason it has permission to shutdown...right?
Also, I tried the su command using runTime.exec("su poweroff"); // a user I created to try poweroff scripts
It seems that su is generally not available, I will create the role and try to telnet to it.
What about creating a generic user script that includes the javarole name and password, and then run the script "/usr/sbin/powerdown"
Yes, it leaves a role password exposed, however it is a very limited role, that is not accessible by a user login, but the turn off script is available to every user?
Regards,
Ray -
X high CPU when using Java applications
Only recently, my Freemind program has become extremely sluggish and unresponsive (big lag) when moving my mind map around. Freemind is made with Java. If I move the mind map around, the X process shoots to 20% CPU, doesn't seem a lot but something between X and Java programs are really bringing their performance down.
I can barely use Freemind now. Freeplane is also affected.
I noticed if I keep the Freemind window really small, it's responsive. If I maximise it, everything slows down within the application. Adding new notes, or move the map around, shoots X to a high CPU and there is a 5+ second lag in anything I do in the app.
Is there anything I can do to improve performance? It's only started recently, everything is up-to-date.
Last edited by nLinked (2013-06-08 13:57:31)Hi
Try to use -Xloggc parameter with the jvm in order to see if problem comes on garbage colector. May be the mem usage is little and the gc thread is in active state. Try, also modify the mem usage with -Xms and -Xmx parameters and see the gc efects.
You can use the -Xprof to output cpu profiling data.
Also, find if there is a bug on servlet container / hard /SO you are using.
Hope this helps -
How to minimize ie to system tray using java
click ie minimize button and show an icon in system tray area not in task bar
and then click the icon to restore the ie window.
help me about this,thank you very much!Use JNI.
I have seen the code posted on this forum before on how to do this, I think by me. Also the example on using JNI ("99% Java" article) does this.
So STFF. -
Opening/closing cd tray using terminal...
So I guess “drutil tray open/close” only works on G4s & G5s.
I had some fun with it at work today but when I got home
realized it doesn't work for my B&W G3.
Is there another command that'll open/close the tray or
am I outta luck on my G3?
Thanks in advance!
MikeYou might need to use the command, disktool, instead.
-
How to run a jar file using Java application.
Hi all,
I know that jar file can run using the following command, using the command prompt.
java -jar jar-fileBut I don't know how to run that command through a Java code. Hope it's clear to you.
So can you please explain how can I do it.
Thanks,
itsjavarayon.m wrote:
The solution given by ropp appears to have nothing to do with what you asked about.Ok sir, I got the point.
I've try a test as follows. But it doesn't give any output. Even not an exception.
try {
String[] temp = new String[]{"java", " -jar", " MainApp.jar"};
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(temp);
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
System.out.println("Temp_Values");
catch(InterruptedException ex) {
System.out.println(ex.getMessage());
catch (IOException ex) {
System.out.println(ex.getMessage());
}I've debug and see, but the exitValue is even not exist at run time. Can you tell me where I'm going wrong.
Maybe you are looking for
-
IPad version of the app store on my iPhone?
Anyone else see this on their App Stores in iOS6? I seem to be getting the iPad version of the App Store on the iPhone
-
Why does it take 4 to 5 minutes for my itunes program to open? it also frequently freezes while i am trying to work with it. it won't open when i connect my iphone? this is on my desk top with Windows 7.
-
asking for an address and not mine and I am the owner of this device and I can not pave if there is a possibility of me to help me open it with my address as I opened before
-
Declaring a channel as a variable
Hello Experts! I am very new to this DIAdem. Currently I´m helping my friend with his thesis. After running a test we got values for x-axis and y-axis that perform a waveform-curve , repeating itself like a sinus-graph (in graphic below). We tried to
-
TS2446 what do i do if i forgot my security answers?
I recently got an Ipod touch 5th generation and now every time i go to download music or an app it tell me i have to put in the answers for my security questions, and i put in the correct answers and it says they are wrong. What do I do?