Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,141 members, 7,814,997 topics. Date: Thursday, 02 May 2024 at 04:13 AM

Java Programmers Please Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Java Programmers Please Help (866 Views)

Java Programmers ,I Need Help Fixing This Code. / How Long Did It Take You Guys To Become Strong Java Programmers / Android Java Programmers, Please Help Me Look Into This (2) (3) (4)

(1) (Reply) (Go Down)

Java Programmers Please Help by klark3: 10:02am On Jun 21, 2015

I'm currently working on a java desktop application project and I'm using netbeans 8.0 IDE .. I'm trying to implement an Action Listener to open a web link on the user default web browser when a jbutton is clicked . i have tried so many online tutorials but nothing seems to be working . please how do i implement this on netbeans 8.0 IDE and make it work ..





Re: Java Programmers Please Help by GuiltySpark343(m): 12:42am On Jun 22, 2015
am an intermediate level java SE (i havent entered EE) programmer...Hhmm this requires an expert level programmer...Hhmm two independent programmes interacting with each other...normally what programmes do is to use hardware resources to accomplish tasks...try googling it and see if somebody has asked similar question especially on a "stackoverflow"
Re: Java Programmers Please Help by javadoctor(m): 6:20am On Jun 22, 2015
jButton1.addActionListener(new ActionListener(){

public void actionPerforned(){

// execute bash script

String command = "chrome http://www.google.com";

new ExecuteShellCommand.executeCommand(command);
}

}




);
Re: Java Programmers Please Help by GuiltySpark343(m): 7:36am On Jun 22, 2015
javadoctor:

jButton1.addActionListener(new ActionListener(){

public void actionPerforned(){

// execute bash script

String command = "chrome http://www.google.com";

new ExecuteShellCommand.executeCommand(command);
}

}




);

Bad

I declare this thread closed

but what does the chrome in the string declaration stand for
Re: Java Programmers Please Help by Knownpal(m): 9:07am On Jun 22, 2015
Use desktop integration. //googleOut
Re: Java Programmers Please Help by seunthomas: 9:13am On Jun 22, 2015
javadoctor:

jButton1.addActionListener(new ActionListener(){

public void actionPerforned(){

// execute bash script

String command = "chrome http://www.google.com";

new ExecuteShellCommand.executeCommand(command);
}

}




);
Good job this will fail if chrome is not installed on the system(Many new systems dont have chrome).

import java.awt.Desktop;
import java.net.URI;


jButton1.addActionListener(new ActionListener(){

public void actionPerforned(){

// execute bash script

//String command = "chrome http://www.google.com";

//new ExecuteShellCommand.executeCommand(command);
if(Desktop.isDesktopSupported())
{
Desktop.getDesktop().browse(new URI("http://www.example.com"));
}

}

}
//CREDIT GOES TO javadoctor:





);
Re: Java Programmers Please Help by Foxybone(m): 7:25pm On Jun 22, 2015
javadoctor:

jButton1.addActionListener(new ActionListener(){

public void actionPerforned(){

// execute bash script

String command = "chrome http://www.google.com";

new ExecuteShellCommand.executeCommand(command);
}

}




);

Uhm, had to poke my nose here... I think I will have to get comfortable in this section. please welcome me ohh cos this is where my future lie..
Re: Java Programmers Please Help by Nigara: 2:05pm On Jun 23, 2015
javadoctor:

jButton1.addActionListener(new ActionListener(){

public void actionPerfor n ed(){

// execute bash script

String command = "chrome http://www.google.com";

new ExecuteShellCommand.executeCommand(command);
}

}




);

bro debug you post... cheesy

(1) (Reply)

How Do I Learn Programming In Nigeria? / Need A Mobile App Developer / Should Everyone Learn To Code?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.