• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
}
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jerry,
Thank you very much. I did the corrections basing on your suggestions.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic