|
Hi All!
Me again, still struggling and grappling with my java applet.
My problemetic code is as follows:
try{ LoginInputStream = new BufferedReader(new FileReader("Login.txt"));
UserNameString = LoginInputStream.readLine().toString();
PassWordString = LoginInputStream.readLine().toString();
LoginInputStream.close(); }
catch(Exception ex) {}
All variables shown here have been correctly declared earlier, and the problem is that as the 'LoginInputStream' BufferedReader reads a file called 'Login.txt' the two string variables that it assigns the results to are not assigned a value at all, despite my toString() conversion!
I have tried it with and without the toString() conversion but the UserNameString and PassWordString values remain firmly as they were declared. (which was null)
Any help would be greatly appreciated!
Thanks!
MrWolfy
|
|
|
|
|
Does the readLine() code execute or does the try statement fail and go onto the catch() branch?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi!
The 'try' code definatly executes, I tried this code with and without the toString() part:
try{ LoginInputStream = new BufferedReader(new FileReader("Login.txt"));
UserNameString = LoginInputStream.readLine().toString();
PassWordString = LoginInputStream.readLine().toString();
LoginInputStream.close(); }
catch(Exception ex) { UserNameEntryField.setText("Error"); }
And the UserNameEntryField TextBox remains empty.
Thanks
MrWolfy
|
|
|
|
|
Try:
try {
FileInputStream file = new FileInputStream("Login.txt");
DataInputStream data = new DataInputStream(file);
BufferedReader LoginInputStream = new BufferedReader(new InputStreamReader(data));
UserNameString = LoginInputStream.readLine();
PassWordString = LoginInputStream.readLine();
LoginInputStream.close();
}
catch(Exception ex)
{
UserNameEntryField.setText("Error");
}
The code above was based from this snippet
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi!
Thanks but the code isn't working, even though it's perfectly valid. The error description says it all:
java.security.AccessControlException: access denied (java.io.FilePermission Login.txt read)
That is soooooooo annoying I could just scream! But I won't.
Is there any way i can get round the 'Access denied' problem?
Thanks!
MrWolfy
|
|
|
|
|
I think you may need to change the Java IO file permissions; take a look at this.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi!
Thanks for the link Perspx, problem solved!
Thanks Again!
MrWolfy
|
|
|
|
|
|
Hi!
Wow Thanks! I Didn't know CodeProject had a Java Forum!
Thanks Again!
MrWolfy
|
|
|
|
|
In my application, I have to send mail to mail address.
But when i send, it doesn't delivered.Its staying in queue itself.(C:\Inetpub\mailroot\Queue)
My coding is
<%
dim iMsg
set iMsg = Server.CreateObject("CDO.Message")
iMsg.To = "xxxxx@yahoo.com"
iMsg.Subject = "Test Mail"
iMsg.From = "xxxxx@yahoo.com"
iMsg.TextBody = "This is a Test Mail" & " " & date() & " " & time()
iMsg.Fields("urn:schemas:httpmail:importance").Value = 2
iMsg.Fields.Update
iMsg.Send
%>
Im using Windows XP.
What can i do?pls help me.
|
|
|
|
|
Background:
These days, I want to make a setup program using Visual Studio 2005 for our customers . Our customers don't know web,and don't know deploy a website. So I need using web setup project to do it. It enable customers to automatically install and deploy the web on servers via an easy setup program. Now I have completed the setup program,but I encounter some questions.
Question:
1. When user click the setup program, framework 2.0 will firstly automatically installed,and it will check windows installer 3.1 need to installed.then the user need to windows installer 3.1. So I hope windows installer 3.1 firstly is installed,then the framework 2.0 begin. How can I
control the sequence?
2. When the same name of Virtual Directory have been existed,how can I estimate,and warn the user?
MSN:
pengyou8696@hotmail.com
E_mail:
pengyou8696@163.com
Thank you !!!
john
|
|
|
|
|
Hi All!
I'm having a problem with java if-else conditional statements, here's the code that's just not working for me:
public void actionPerformed(ActionEvent act) {
if (userName.getText() == MyString) {
try {
userUrl = new URL("http://www.mywebsite.co.uk");
getAppletContext().showDocument(userUrl,"_blank");
}
catch(Exception e) {}
}
}
Where MyString is a string variable that has been declared earlier and userName is a TextField that is also declared earlier.
The actionPerformed code is being executed when I click the button in my applet but for some reason the code inside the if statement is never executed.
Do I have to use some kind of method on the MyString variable? Like MyString.value or something? (I've tried that by the way, no such luck )
Thanks!
MrWolfy
|
|
|
|
|
Try:
if(userName.getText().equals(MyString))
I believe that using == compares the two addresses of the strings as opposed to the actual value of the strings.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Right. Like C#, Java has a distinction between "value types" and "reference types". Unlike C#, the == operator is not redefined for the String type, so it's an address comparison.
|
|
|
|
|
Hi and Thanks!
Problem Solved, you guys are really helpful!
I'd never have figured that out by myself.
Thanks Again!
MrWolfy
|
|
|
|
|
Hello,
I need help with my sharepoint project...How can I customize the help menu of sharepoint?....How can I customize the errors pages and the login and logout pages of my sharepoint???....
If any person knows how to do or know any place in the web that could help me please send me a mail to fersango@gmail.com.
Thanks
|
|
|
|
|
Please any body tell me how to do the functionality as it is there
at the following link
http://www.makaan.com/property/create-ad.php?type=agent
create ad banner dynamically based on user inputs using javascript and
AJAX or are the any controls in AJAX for this functionality
|
|
|
|
|
You would need to use a server-side language like PHP to render the banner based on custom input.
And AJAX is merely a set of technologies used together to dynamically receive content from a server - there are no "controls" in AJAX.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi All!
In JavaScript, changing the browser location is simple:
window.location = "myurl.html"
How would I accomplish this same effect from an embedded java Applet?
Thanks!
MrWolfy
|
|
|
|
|
Use the Servlet Response sendRedirect() function, ie:
respose.sendRedirect(url);
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi and Thanks!
Thanks for your help, however response.sendRedirect() is not working, my compiler complains and tells me that it cannot find symbol variable 'response'. Do I need to import something or use any other code in order for this to work? (I'm just learning Java)
Thanks!
MrWolfy
|
|
|
|
|
Oh sorry I didnt realise you were new to Java. Yes, response is a HTTPServletResponse. See this article - it may be of help.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
This article may also be of help.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Wow Thanks!
Both articles were extremely helpful, Thanks! Problem Solved!
Thanks Again!
MrWolfy
|
|
|
|
|
No problem
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|