Androix x86 on Virtualbox, permanent net settings - java

I installed Android x86 on Virtualbox on my Win7 pc, to run the apps I create with eclipse in it.
I'm following a tutorial ( This one ) but I can't get the connecting part right.
When I boot my android virtual machine, i press ALT + F1 and type "netcfg", I see that the "eth0" port has no address and is DOWN.
If I type "dhcpcd" it dynamically gives it an IP so this is the configuration:
eth0 UP 192.168.10.74
and that fine, I can proceed to give an "adb connect 192.168.10.74" on Windows' cmd, and it works.
But, when I shut down or reboot the android virtual machine all settings are lost!!! How can I make it work?

There is a change in the step 5 of the process.
Select Installation - Install Android-X86 to hard disk
Hope this solves the problem.

Related

unable to display jstad monitoring in VisualVM tool

I have EC2 instance hosting Tomcat application. It has JVM installed within.
I am trying to monitor VisualGC from my workstation.
In all those application instances we are able to establish the JMX connections in the visual vm tool, but for the plugin - Visual gc, for all the instances it says "Not supported for this JVM"
we are able to connect to the instance by adding a JMX connection
when I try to add jstatd connection, it displays "not supported for this JVM".
I have also created a policy file as suggested by other other solutions in the internet- 'jstatd.all.policy' and tried starting jstatd like below.
Command used -
./jstatd -J-Djava.security.policy=jstatd.all.policy
I made sure at that time jstatd was running in the instance, and we were able to get the stats in the instance in the command line, but We are somehow unable to get those stats displayed in the tool, the instance and visual gc plugin of the visual vm tool aren't connecting each other. Interestingly, we can see other monitor graphs.
Any reason out there why I am unble to view it?
I have already tried this command as well and this was it - sudo ./jstatd -J-Djava.security.policy=/tmp/jstatd.all.policy -J-Djava.rmi.server.hostname=<host ip> -J-Djava.rmi.server.logCalls=true &
but it did not solved the issue
Hope your security policy file (tools.policy) missing permission for tools.jar
grant codebase “file:/usr/lib/jvm/java-8-openjdk-amd64/lib/tools.jar” {
permission java.security.AllPermission;
};
Once added the above permission run jstatd,
sudo jstatd -J-Djava.security.policy=/tmp/tools.policy -J-Djava.rmi.server.hostname=10.101.32.110 -p 7198
Replace the JDK folder, hostname & port based on your env.

Android Studio emulator on Mac not working [duplicate]

Couldn't use x86 emulators, AVD manager shows warning "/dev/kvm is not found" and telling me to edit BIOS security setting to enable VT-x.
Re-installing HAXM resolved my problem
Steps:
Make sure SDK Manager -> Extras -> Intel x86 Emulator Accelerator (HAXM installer) is installed
Navigate to <sdk>/extras/intel/Hardware_Accelerated_Execution_Manager/
Run ./HAXM\ installation -u
Run ./HAXM\ installation
For MacOS users running Android Studio, when you get this error then try these steps to open up your privacy settings.
You can also follow the answer from Divakar on this post here - /dev/kvm not found on mac
Thank you Apple for pushing me with your dumb*** app review rules from iOS to android development
You just need to "start" the HAXM. You can do this following this steps:
Open the cmd.
Type sc query intelhaxm, click enter and check the STATE.
If state is 1 STOPED, type sc start intelhaxm and click enter to start the HAXM.
Check the STATE again and it should be 4 RUNNING now.
Finally, you are now able to create and use your AVD using a x86 emulator.
Alternatively, when you want to stop the HAXM you should type sc stop intelhaxm.
Hope this helps y'all.
I had a similar message in the emulators area in Android Studio 2.1.
My emulator for a certain API (think 21) worked initially fine and was fully accelerated, then installed a couple of other images (Nougat x86/64 etc) and suddenly started seeing /dev/kvm not found and NO emulator would boot up.
In My Case, re-installing HAXM sadly did not help, but rebooting my MAC did (go figure).
But, I also noted that if you have installed an emulator image but not the related SDK for the API (which makes sense), then you get a similar pop-up when starting the emulator, which makes you think it may be a HAXM / KVM issue, which its not.
Hope this helps someone.
Update Bios Setting
Power on the system and press[delete] key to enter BIOS [EZ Mode]
Press [F7] key to enter BIOS [Advance Mode] as below picture:
(If press [delete] key to enter [Advanced Mode] directly and then no need to press [F7] key any more)
Select [Advanced] page and click [CPU Configuration] item
Select [Intel(VMX) Virtualization Technology] item and set to [Enabled]
Press [F10] key and click [OK] ,the system will auto reboot
On Mac OS, After installing make sure to allow Intel HAXM under "Security & Privacy".
This was the only way I was able to run the Android Emulator :)
Reinstalling and restarting did not work for me. Instead, I had to start my Mac in Recovery Mode (restart & press ⌘+R until Apple logo appears). Then open terminal from Utilities drop down menu. Type and run:
csrutil enable --without kext
You will get some warnings and instruction to restart for the changes to take effect. Restart and the emulator will run this time.
Reference:
https://blog.celogeek.com/201708/672/android-studio-emulator-haxm-on-mac-os-high-serria-10-13/
Just go to terminal and type
sudo chown 777 -R /dev/kvm,
then type
sudo chmod 777 -R /dev/kvm.
And restart android studio
And that's it..
In some case it may happened that for every start of android studio you need to type this commands First and then start android studio.
I couldn't install mine because I had HyperV enabled on my machine. Removed it and I was able to install the HAXM from the following link:
https://github.com/intel/haxm
Either your CPU does not support virtualization, or it is disabled in the bios. Go into your bios and see if you can find a setting to enable it.
I tried reinstalling HAXM a few times but kept getting the errors.
In my case I actually had to go into Bios Settings and enable Virtualization.
It worked for me. Just in case this helps anyone.

How can I run a Java GUI application on a headless Linux that does not support GUI?

I have created a Java GUI application that is running in Windows. Now I want it to run it on a headless Linux instance that does not support GUI. I wanted to convert the GUI to TUI. Is there a way I can substitute some classes and make it run in Linux by TUI. Please help.
You can use PeterMmm's suggestion http://www.pitman.co.za/projects/charva/index.html
Or, you can run the GUI on your local machine by running an X server, then connecting to the Linux box using ssh -X. That will show the GUI on your local machine, but the program is actually running on the linux box.
Or, you can run XVFB to fake a GUI on the Linux box. You won't be able to see the GUI or interact with it in any way, but that might not matter to you.
For the sake of spreading a simple and effective solution, I copy the answer provided by #fossfreedom on SA "Ask Ubuntu":
sudo apt-get install xvfb
then:
xvfb :1 -screen 0 800x600x8 &
export DISPLAY=":1"
java application_name.jar
or
xvfb-run -a -e /tmp/some/log/file.log java -jar /home/user/somejava.jar
-> see: https://askubuntu.com/questions/50599/how-do-you-run-a-gui-application-without-gui-gui-application-as-daemon-on-headl
There are some ncurses implementations for Java available like this one: http://www.pitman.co.za/projects/charva/index.html
If you are connecting from another X running Linux machine put following to your user ssh config (~/.ssh/config):
Compression yes
CompressionLevel 9
ForwardX11 yes
ForwardX11Trusted yes
Then when you login to remote Linux machine your GUI going to be forwarded to local screen. Note that it could be slow... notably some AWT applications are really slow even on LAN.
If on Windows, intall CygWin and its Xserver components. Also OpenSSH can be helpful. When you going to connect through CygWin's ssh, use the same config as above. Of course run Xserver prior connecting to remote machine. You also can use Putty to connect to remote, but don't forget to enable X11 forwarding and compression in session config.
Remote machine must have xauth installed + sshd must have X11Forwarding enabled. If OK echo $DISPLAY will show localhost:10.

unix - x windows/X11 question

I have a java GUI jar file that i need to launch at my unix terminal. My system admin says "X is already enabled via ssh". But when i type xterm it says
xterm Xt error: Can't open display: xterm: DISPLAY is not set
I did some reading and it says i have to login using
$ssh -X mylogin#xyz
So my question is:
1) What should i do next...i typed xterm again but the window does not launch
2) Suppose i get it working somehow. How can i launch my java GUI. (do i simply type the jar file name)?
Thank you all for your help.
I am assuming you are connecting from your own computer to some server running SSH. First off, you need to install an X11 server on your own machine if you don't have one already. The terminology here is confusing - if you're connecting to another machine by SSH, you're probably used to thinking of your own machine as the client and the remote one as the server. But in the case of X11, those roles are reversed.
Then, you'll need to start X11 on your own machine and within that, launch an xterm. Then from that xterm, you can run ssh -X myserver.example.com and once logged into that remote server, run java -jar myapplication.jar and it ought to work.
The specific mechanism for launching an X Server on your own machine varies by operating system. On Linux/FreeBSD/etc, you're probably running one already. On a Mac, X11 is available under Applications if you've installed the developer tools. On Windows you'll need something like Xming
Go to your unix terminal and do:
export DISPLAY=<ip_addr>:0
For e.g. I would do export DISPLAY=10.18.192.89:0.
The ip-address is of the machine where you want to see the GUI and that machine should have an Xterm client running.

visualvm cannot see a java process launched from cygwin

If I start a java process in a cygwin console, and then launch visualVm, the later cannot see the former.
If I start the same process in a Dos console visualvm sees it fine. I am in jdk1.6.0_25. This happens both in win7 32b, and in win7 64b with a 64b jvm.
Anyone can think of an explanation/workaround?
I fixed the problem by running VisualVM from within Cygwin. If you prefer not to profile using a remote JMX connection, you can run both VisualVM and your Java program using Cygwin:
Open the Cygwin Console window, navigate to visual_vm.exe and run that file from within the Cygwin environment.
I had the same problem. The vm was not shown automatically but I was able to connect via "Add JMX Connection", using hostname and jmx.remote.port...
On VisualVM go to File -> Add JMX Connection
localhost:3333
Add vm parameter at startup e.g.:
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
VisualVM can automatically detect local applications running under the same user. So one explanation can be that cygwin process is running under the different user. Make sure that both VisualVM and monitored application is running under JDK 6 update 25. JDK 6 update 25 has a fix for the following JDK bug #6938627, which can affect your case.
The opposite approach to #seanhodges answer is to launch the application to debug with a modified environment, pointing it back to your Windows User Temp directory
For example if you normally do:
./gradlew run
And say your TEMP directory on Windows (according to your User environment variables) is:
T:\Temp
You can do one of these instead:
TMP=T:\\Temp ./gradlew run
TMP=/cygdrive/t/Temp ./gradlew run
(they both seem to work)

Categories

Resources