cannot resolve symbol

I can't figure out what is causing this?

C:\Temp>javac SSLTransportLayer.java
SSLTransportLayer.java:62: cannot resolve symbol
symbol  : method getEnabledProtocols  ()
location: class javax.net.ssl.SSLSocket
     String[] protocolArray = socket.getEnabledProtocols();
                                    ^


Code:

import javax.net.ssl.*;
import java.io.*;

public class SSLTransportLayer  {

 public static void main(String[] args) {
   String host = "edge.asic.gov.au";
   int    port = 5608;

   SSLSocketFactory factory;
   SSLSocket        socket;
   String           hostOutput;
   BufferedReader   br;
   String[] cipherSuite = { "SSL_RSA_WITH_RC4_128_MD5"
            ,"SSL_RSA_WITH_RC4_128_SHA"
         ,"TLS_RSA_WITH_AES_128_CBC_SHA"
         ,"TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
         ,"TLS_DHE_DSS_WITH_AES_128_CBC_SHA"
         ,"SSL_RSA_WITH_3DES_EDE_CBC_SHA"
         ,"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA"
         ,"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA"
         ,"SSL_RSA_WITH_DES_CBC_SHA"
         ,"SSL_DHE_RSA_WITH_DES_CBC_SHA"
         ,"SSL_DHE_DSS_WITH_DES_CBC_SHA"
         ,"SSL_RSA_EXPORT_WITH_RC4_40_MD5"
         ,"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA"
         ,"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA"
         ,"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
         ,"SSL_RSA_WITH_NULL_MD5"
         ,"SSL_RSA_WITH_NULL_SHA"
         ,"SSL_DH_anon_WITH_RC4_128_MD5"
         ,"TLS_DH_anon_WITH_AES_128_CBC_SHA"
         ,"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA"
         ,"SSL_DH_anon_WITH_DES_CBC_SHA"
         ,"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5"
         ,"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA" };
   
   /*{ "SSL_DH_anon_WITH_RC4_128_MD5"
                          , "SSL_DH_anon_WITH_RC4_128_MD5"
                          , "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA"
                          , "SSL_DH_anon_WITH_DES_CBC_SHA"
                          , "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5"
                          , "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA" };*/


   
   try {
     factory = ( SSLSocketFactory ) SSLSocketFactory.getDefault();
     socket  = ( SSLSocket ) factory.createSocket( host, port );
     // Lets see whats supported
     String[] suiteArray = socket.getSupportedCipherSuites();
     for ( int i = 0; i < suiteArray.length; i++ )
     {
           System.out.println( "Supported cipher suites " +  suiteArray[ i ] );
     }
     
     System.out.println( "Enabled session creation " +  socket.getEnableSessionCreation() );
     System.out.println( "Use client mode " +  socket.getUseClientMode() );
//     System.out.println( "Want client mode " +  socket.getWantClientAuth() );
     System.out.println( "Needs client authentication " +  socket.getNeedClientAuth() );
     
     String[] protocolArray = socket.getEnabledProtocols();
     for ( int i = 0; i < protocolArray.length; i++ )
     {
           System.out.println( "Enabled protocols " +  protocolArray[ i ] );
     }
         
     socket.setEnabledCipherSuites(cipherSuite);

     System.out.println("Secure socket made");
     br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
     hostOutput = br.readLine();
     System.out.println(host + " responds with: " + hostOutput);

   } catch (Exception e) {
     System.out.println("Error " + e.getMessage());
   };
 }
}
LVL 17
Tacobell777Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InteractiveMindCommented:
SSLSocket#getSupportedProtocols() does not exist, you need to replace that with:

String[] protocolArray = socket.getSupportedProtocols();
InteractiveMindCommented:
Sorry, this:

 "SSLSocket#getSupportedProtocols() does not exist"

should be:

 "SSLSocket#getEnabledProtocols() does not exist"
CEHJCommented:
Make sure you haven't got your own home-brewed SSLSocket in the classpath (as opposed to javax.net.ssl.SSLSocket, which is what you intend)
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tacobell777Author Commented:
InteractiveMind ??? Isn't that what I have got?

CEHJ I'm pretty sure no one replaced it as I installed it a couple of weeks ago.
CEHJCommented:
Try compiling thus and see if it makes any difference:


javac -classpath . SSLTransportLayer.java
Tacobell777Author Commented:
C:\Temp>javac -classpath C:\j2sdk1.4.2_05\bin SSLTransportLayer.java
SSLTransportLayer.java:1: package javax.net.ssl does not exist
import javax.net.ssl.*;
^
SSLTransportLayer.java:10: cannot resolve symbol
symbol  : class SSLSocketFactory
location: class SSLTransportLayer
   SSLSocketFactory factory;
   ^
CEHJCommented:
>>package javax.net.ssl does not exist

What JDK version are you using?

Tacobell777Author Commented:
j2sdk1.4.2_05
CEHJCommented:
There's something wrong. javax.net.ssl *does* exist in 1.4. What do you get from


java -version

?
CEHJCommented:
Sorry that should have been

javac -version
Tacobell777Author Commented:
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)

javac -version is not a valid command line..

I now get the same error with other classes as well, but they compile well on
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
CEHJCommented:
>>javac -version is not a valid command line..

No - it isn't on some versions. Javac will run against the first javac.exe in %PATH%. What would that be?

echo %PATH%
Tacobell777Author Commented:
do you still need that version, does the verion number I gave above not give you enough info?
CEHJCommented:
>>does the verion number I gave above not give you enough info?

It gives me the version of java, not javac, and the latter is needed here (they can be different)
Tacobell777Author Commented:
Here is the output, sorry it took so long.

C:\CFusionMX7\verity\k2\_nti40\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys
tem32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\
Microsoft SQL Server\80\Tools\BINN;C:\Sun\AppServer\jdk\bin;c:\Program Files\Mic
rosoft SQL Server\90\Tools\binn\;C:\PROGRA~1\AMPC\bin;C:\PROGRA~1\AMPC\cygwin\bi
n;C:\Sun\AppServer\bin
CEHJCommented:
This is almost certainly the version of javac you're compiling with

C:\Sun\AppServer\jdk\bin\javac.exe

and i would not be suprised if it is < 1.4. Failure to compile the following will prove that it is:


class LessThanFour {
      void acidTest() {
            "x".replaceAll("", "");
      }
}
Tacobell777Author Commented:
this is what I get
C:\Temp>javac LessThanFour.java
LessThanFour.java:3: cannot resolve symbol
symbol  : method replaceAll  (java.lang.String,java.lang.String)
location: class java.lang.String
          "x".replaceAll("", "");
          ^
1 error

So can you tell me what you think is wrong and how to fix it?
CEHJCommented:
That's exactly what i expected. It means that your JDK is < 1.4, which is why you can't resolve the SSL class symbol. You need to update to >= 1.4

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tacobell777Author Commented:
I must be confused I thought I did that, isn't the JDK included in Java(TM) 2 Runtime Environment

Or the two different if so can you give me a little run down?
I'm still a newbie to this all.
InteractiveMindCommented:
> "isn't the JDK included in Java(TM) 2 Runtime Environment"
No; the Java Runtime Environment (JRE) is included in the JDK.

To download the latest version, go here:

   http://java.sun.com/j2se/1.5.0/download.jsp

And click on the "Download JDK 5.0 Update 4" link.

Once downloaded, install it, (best to use the default path that the installer suggests). Then, you need to reconfigure your PATH variable... I haven't previously read what OS you're on, but I'm going to assume Windows 2K/XP/NT.. Right-click "My Computer" -> select "Properties" -> click on the "Advanced" tab -> click on the "Environment Variables" button -> Now, under the "System Variables" section, you need to find and then double-click on the "Path" variable in the list -> Here, try using the following Path variable instead:

.;C:\Program Files\Java\jdk1.5.4_00\bin;C:\Program Files\Java\jre1.5.0_01\bin;C:\CFusionMX7\verity\k2\_nti40\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\PROGRA~1\AMPC\bin;C:\PROGRA~1\AMPC\cygwin\bin;C:\Sun\AppServer\bin

Now, before you save those changes, you need to make sure that the first to directories in that variable:

   C:\Program Files\Java\jdk1.5.4_00\bin   ;   C:\Program Files\Java\jre1.5.0_01\bin

exist.. They will be where ever you installed this latest JDK..

Another thing: It would probably be wise to uninstall any older versions of the JRE/JDK that you have first .... but you could probably get away without doing that.

Good luck ... and please don't give me any points for this; CEHJ is the one who solved it.
CEHJCommented:
Please *do* give IM some points for that info ;-)
Tacobell777Author Commented:
thanks guys
CEHJCommented:
:-)
InteractiveMindCommented:
hehe - thank you both ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.