Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


distributed firewall using java code

Posted on 2010-01-01
Medium Priority
Last Modified: 2012-05-08
I need java code using firewall.
Question by:sunda2010
  • 2

Accepted Solution

Ravi Kalla earned 252 total points
ID: 26161002
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26161060
Correct me if i am wrong, but firewall cannot be implemented in Java.

So, not sure what you requirement is, but if you want to connect to an web-application behind a proxy firewall, then try the attached code

URL url = null;

	url = new URL(anyURL);
	Properties props = System.getProperties();
	//fetch the value of http.proxyHost
	//from Client.properties file   
	props.put ( http.proxyHost, "" ) ; \\ipaddress of your proxy server
	//fetch the value of http.proxyPort
	//from Client.properties file   
	props.put ( http.proxyPort, "" ) ; \\port number of the proxy sever
	//OPen the connection
	URLConnection connection = url.openConnection();

	//Setting the PROXYAUTHENTICATION property to the connection
	connection.setRequestProperty ( "Proxy-Authorization", usernamepassword ) ;
	connection.connect () ;

	inputStream = connection.getInputStream () ;
catch (ConnectException e) 

Open in new window

LVL 86

Assisted Solution

CEHJ earned 248 total points
ID: 26161115
You can't implement a firewall in Java - it requires kernel level code and therefore native system calls. You might be able to use JNI or JNA, but there'd be no point
LVL 86

Expert Comment

ID: 26291357

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question