Executing adb command on java program - java

i made a java tool which calls certain adb command to download an app from market. When i made it into a runnable JAR, its executing fine in the system where i made it, but when i try it on other system the adb commands just fail to execute
Any suggestions

AFAIK executable jar donot work on android. Sun Java and Android are not compatible

Have you included the Adb executable and the related dll in your solution?
You should include it for 2 main reasons:
if the system hasn't the android sdk, it doen't have adb
the path to adb can differ from one computer to another.

Related

Mac Os Catalina prevents jar app to folder

I have a .app on mac that launches a jar via a sh script. This means that the app itself is just lunching a jar then the app is no longer running as the jar starts.
The Jar requires access to the launching users Desktop, but in Catalina due to new security restrictions the desktop is blocked. Anyway to trigger in java a mac alert that allows the user to grant access? This is the best approach due to if you go to privacy and whitelist to full folder access the user can only add the app, not the jar/java jre which is what i believe the issue is.
So i was able to figure it out. My app launcher was a sh script that ran an exec java ... so basically bc i wanted to use my included framework i launched from java bin folder in the .app using an exec command in a shell script that.
I changed to just running the command line and setting the icon without exec, so in essence java launched like it would have if i executed out of terminal . By doing thus catalina recognized the folder access and prompted for access properly.

Sound capture. MacOS permissions. Java Audio API

I'm trying to capture sound from microphone via Java Sound API.
I'm using sample code from github and it works perfect on Windows system, but when it runs on MacOS - audio-line buffer returns zero-bytes.
Also if I compile project to jar and run it via administrator permission - appears a message to give access to microphone and after I grant it - all works.
So the question is how to make permission request from code and run app without sudo?
Thanks!
BTW, you have to use the default terminal that comes with mac to execute jar file. That will worked.
The third party terminal, such as iTerm, it's not ok.

JAR is executed with terminal but not with direct clicking

I have tried the following:
in terminal it works
In Intellij it works
I have tried to launch it with javaw.exe but nothing changes
Are there any other options?
This looks like an OS problem that an application building one -- because you said that it works in your IDE and terminal.
Make sure that you installed Java properly in your machine.
In Windows/MacOs, after installing Java, the *.jar files are automatically associated with the java -jar command and makes it runnable via double-click.
In linux, this varies on the flavour or DE you are using. But there's probably a utility in your OS to open *.jar files using java -jar command.

How to Run Commands through a already running Java?

I was wondering if it was possible to execute commands from PHP to a Java prompt which is already running?
I have tried the solution listed here:
How to run a shell command through PHP code?
and this provided no functionality
Let me explain
The java is running on one screen of the linux server
sudo apt-get install screen
and running the .jar file through the command line.
I am then running a webserver, which will have an admin accessibility to restricted areas, which will contain scrips to run specific commands through that already running .jar file?
You can implement some kind of IPC. The java file listens to a port and receives the commands. Or you can write the commands in a specific file which the java programm reads. I think under linux you can also use shared memory: http://www.php.net/manual/en/book.shmop.php
It is possible by sending the command to the screen session. I used this for a minecraft server once.
screen -S <sessionname> -X stuff "<command>\r"
This would (IIRC) provide the same output as if you where inside the screen, typed the command and pressed enter.
I hope this was what you wanted.

Running Android emulator from Jenkins to run Junit test with Robotium

How can I run Android emulator from Jenkins to run my tests?
When I write in Execiute Windows bath comand, command to run emulator:
emulator -avd Tester
and run my tests I have this errors:
..>emulator -avd Tester 'emulator' is not recognized as an internal
or external command, operable program or batch file.
..>exit 9009 Build step 'Execute Windows batch command' marked build
as failure
I set path for Android_SDK, java in Windows path and it works from cmd.
What should I do to run emulator?
You can automate the process with the Android Emulator Plugin for Jenkins.
You just need to find where the file "emulator.exe" is located, and then run the command in that location. For example, the most probably is that it is located in C:...android-sdk\tools
so, go to the command promt, type cd C:\android-sdk\tools. Then type the command, and it will work just fine. I hope this is the answer even though it´s late. So, accept the answer.

Categories

Resources