• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can you compile "if ( url == null )"  RSS feed

 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tells me why I can not compile "if ( url == null )" 18th line below. Thanks.

package ExternalPerformer;
import java.lang.*;
import java.io.*;
import java.util.*;
import java.net.*;
import com.Informatica.Server.*;
import java.rmi.*;
public class EP_Informatica_to_Savvion {
String Informatica_File_Location = "Informatica File Location";
Properties prop = new Properties ();
String Informatica_Server = null;
URL url = ClassLoader.getSystemResource ( Informatica_File_Location );
if ( url == null )
{
System.out.println("Location of the Informatica File is unknown");
System.exit(-1);
}
try
{
prop.load(url.openStream());
}
catch(Exception e)
{
System.out.println("Could not load Informatica File");
System.out.println(e.getMessage());
System.exit(-1);
InformaticaServer = prop.getProperty ("InformaticaServerObject";
System.out.println ("The Informatica Server is: " + Informatica_Server);
try
{
pak = (PAKinterface) Naming.lookup(Informatica_Server);
session = pak.connect("WebAPI");
}
catch (Exception e)
{
System.out.println("Could not lookup Informatica_Server or could not get session");
System.out.println(e.getMessage());
System.exit(-1);
}
}
 
Jerry Pulley
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
Because it's not in a method body, constructor body, or initializer block. Looks like that statement and the remaining lines of the class belong in a constructor.
Jerry

[This message has been edited by Jerry Pulley (edited February 06, 2001).]
 
Michael.H.Sun
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jerry,
Thank you very much. I did the corrections basing on your suggestions.
 
praveen ankireddy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
Whats is this code is it a constructor or a method.U better check out the code agian.
Regards
PRaveen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!