Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print header;
print start_html("Environment");

foreach my $key (sort(keys(%ENV))) {
print "$key = $ENV{$key}
\n";
}

print end_html;






how can write same logic in java. its urgent for me please help me
Posted
Comments
Bernhard Hiller 23-May-13 2:38am    
First step: understand what the program does.
Second step: implement a program in Java which does the same...
And: it is not at all urgent for anyone giving answers on CodeProject.

1 solution

Something like
Java
import java.util.Map;

// ...

	Map<string,> env = System.getenv();
	System.out.format("Environment variables:%n");
	for (String envName : env.keySet()) {
	    System.out.format("\t%s=%s%n", envName, env.get(envName));
	}
 
Share this answer
 
Comments
User-10031173 23-May-13 7:04am    
its giving my system env varibales details. is there any way to get client ip address along with data about what client visited in my site
User-10031173 23-May-13 7:06am    
i have used one javscript file for creating cookies. but i dint how to apply in my project and its working environment
User-10031173 23-May-13 7:10am    
is there any way to create cookies using client ip address. further i need to store client's visited data in database for future purpose
Richard MacCutchan 23-May-13 7:45am    
Your tag and your question relate to Java. You are now talking about Javascript - they are not the same thing.
User-10031173 23-May-13 8:14am    
yes i know but. i tried with java script.. but its not suitable for my application. now i want to achieve this one using java

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900