File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Difference in behaviour of a class from executable jar and main method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Difference in behaviour of a class from executable jar and main method" Watch "Difference in behaviour of a class from executable jar and main method" New topic
Author

Difference in behaviour of a class from executable jar and main method

anees ahamed
Ranch Hand

Joined: Feb 19, 2008
Posts: 31
Hi,
I am attaching a java source here. I have a single question in connection with this class.
As you can see in the main method of this class, I give a username and password as credentials. When I execute this program from the main method I get correct output. ie; 'usrname','pwd' combination gives its corresponding output and 'usrname1','pwd1' give its corresponding output.

But, when I access this class from the application(executable jar), 'usrname','pwd' gives its corresponding output and after that if I give 'usrname1','pwd1' combination, it give the output corresponding to 'usrname','pwd'
Here is my simple Java class.

I really wonder how it behaves differenly when used independently and when used from an executable jar.
Please provide some help in this regard.
Anees
[ November 11, 2008: Message edited by: anees ahamed ]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

Hi there,

Can you show us the output of the running program? (I see you have System.out statements there). Also I don't see you validating that the arguments you pass in are really what you expect, it looks like you pass the args[] directly to a PHP call?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Difference in behaviour of a class from executable jar and main method
 
Similar Threads
how to use HTTPUrlConncection with user and password
java.io.IOException: Server returned HTTP response code: 401 for URL:
NTLM url access through java: getPasswordAuthentication does not get called on Linux
Logging in to a site programmatically
NTLM url access through java: getPasswordAuthentication does not get called on Linux