- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi There,
While working on an IoT application I found a java code which reboot Arduino Uno. But I want to reboot Galileo Gen 2 board from java.
Is there any class or method written which I can utilize in my application to reboot Galileo.
Please find attached java file and refer "reboot()" method which reboots Arduino Uno.
Regards
Rahul Modi
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I think it would be easier to directly listen to a specific HTTP GET request to reboot the card.
HTH,
Fernando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi rahulmodi8812,
Do you still need assistance with this thread? We'll be waiting for your response.
-Sergio A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Yes, I need assistance on this.
I just want a piece of java code which can reboot the Galileo.
If I don't find, I will have to move to some alternative solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
rahulmodi8812 wrote:
Yes, I need assistance on this.
I just want a piece of java code which can reboot the Galileo.
Connect your Intel Galileo to the LAN where you have your computer running (the one in which the java code is going to run and use
/*********************************************************************/
import java.io.*;
public class javassh
{
public static void main(String args[])
{
try
{
Process p=Runtime.getRuntime().exec("ssh root@ reboot");
p.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while (line!=null)
{
System.out.println(line);
line=reader.readLine();
}
}
catch(IOException e1) {}
catch(InterruptedException e2) {}
System.out.println("Done");
}
}
/*********************************************************************/
Replace by your Intel Galileo Ethernet port IP
If I don't find, I will have to move to some alternative solution.
Did you think any?
HTH,
Fernando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi rahulmodi8812,
The simplest way I can think of to reboot your board with a Java code is using a system call. This method is practically the same as the one @FGT suggested. I found a few guides on how to do this, you can check this one for example: http://alvinalexander.com/java/edu/pj/pj010016 http://alvinalexander.com/java/edu/pj/pj010016 . In this guide, it is shown how to make a system call to the command "ps -ef". The command in Linux to reboot is simply "reboot", so the material on the guide can be easily replicated.
Hopefully this will give you an idea on how to implement system calls in your code.
Regards
-Sergio A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
An even simpler one...
/*********************************************************************/
import java.io.*;
public class javassh2
{
public static void main(String args[])
{
try
{
Process p=Runtime.getRuntime().exec("ssh root@ reboot");
p.waitFor();
}
catch(Exception e) {}
System.out.println("Done");
}
}
/*********************************************************************/
Replace by your Intel Galileo Ethernet port IP
HTH,
Fernando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Thanks Sergio and Fernando.
I will try the solution provided by you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page