Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
How would i play a specific song in iTunes through java?
I assume I need to somehow connect to iTunes and use the play function with a certain parameter....Can anyone point me in the right direction to learning how to do this?
According to that answer, there is no API. There is only an SDK (via COM) for Windows.
In Mac OS, iTunes is controlled via AppleScript(example).
Ik it's too late, but u can use apple script editor. for instance,
Runtime runtime = Runtime.getRuntime();
String[] args = {"osascript" , "-e" , "tell application \"iTunes\" to play"};
try{
Process process = runtime.exec(args);
}catch (Exception ex) {
}
this will play a song in itunes
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm working on a java project and I want to attach a calculator from the operating system. But I haven't any idea to do that. If there any idea it would be a great help.
You can use
java.lang.Runtime.getRuntime().exec("[path]\calc.exe");
To open the calculator. But beware: The only way that you can communicate with applications you open this way is through the Process streams: in/out/err (assuming calc is set up to communicate as such)
in cmd you can type calc.exe and run it, to run calculator through the java use the java.lang.Runtime class to run commands:
try {
Runtime.getRuntime().exec("calc.exe");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
more details about Shell Commands in java read this...
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So, i have problem. I'm making script on Java with sending logs to my discord server. And i using JDA Api. That script should send message when it will be opened. So without any events. Anyone can help me?
Thanks
Some edit: Sorry for my bad english, ima from Russia btw
You have to first get the bot instance you are working with, then get the text channel. After you made sure the bot can talk there, you can send a message (or multiple).
It would look something like this:
TextChannel textChannel = YourBotInstance.getJda().getTextChannelById("386242731875368960");
if(textChannel.canTalk()) {
textChannel.sendMessage("Your message here.").queue();
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on an android application in which during the registration of the user i will get his location and i had a starting point.
I am thinking of sending an intent to Google maps and getting back required result from it. How can i extract the distance, duration and directions from the result of intent?
Is there any other way better than this?
You can user Google Direction API. It has many options like direction, distance (walking, driving etc). See example here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Hi I am new to Java and I wanted to learn how to make one program that will create accounts that will be stored in a file in the file of the code and then later you can access it to enter and go to a main program to do something else, I passed all day looking for but everyone using GUI so I do not see the code and it doesn't work well so I wanted to ask to people from here thank you in advance
You can use the Scanner library, which will download text from the console.
Sample part of the program
Scanner download = new Scanner (System.in);
String login = download .nextLine ();
In the login variable, you store the String entered in the input;)
More information :
https://docs.oracle.com/javase/tutorial/essential/io/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
My question is this that i want to make an invice or we can say bill for our customer , so that now i want to make an invice that has a special style it mean customer logos,address
like this and then i want to print it directly by printer devices so plz can anyone help me .
I use netbeas 8 IDE .
You could create a report, using iReport, and send data to fill it. All data can be organized in a model report, like images, grid (sub-report) with monetary values, bar-codes, etc...
http://community.jaspersoft.com/wiki/ireport-designer-tutorials-help