Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NetBeans with SSL

807600Oct 14 2007 — edited Oct 21 2007
Hi,

My environment:
NB 5.5.1 with JDK 1.6 istalled from the same package
Linux
The problem is that when i try to RUN program:
-------------------------------------------------------------
package echo;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSocket;

public class EchoServer
{

/**
* Creates a new instance of EchoServer
*/
public EchoServer ()
{
}

/**
* @param args the command line arguments
*/
public static void main (String[] args)
{
try {
SSLServerSocketFactory sslserversocketfactory =
(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
SSLServerSocket sslserversocket =
(SSLServerSocket) sslserversocketfactory.createServerSocket(9999);
SSLSocket sslsocket = (SSLSocket) sslserversocket.accept();

InputStream inputstream = sslsocket.getInputStream();
InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);

String string = null;
while ((string = bufferedreader.readLine()) != null) {
System.out.println(string);
System.out.flush();
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
-------------------------------------------------------------
With options in RClick Project EchoServer -> Properties | Run | VM Options like:

-Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=123456 EchoServer

with the certificate created like this:

<Path/to/jdk installed/with/nb_package>/jdk1.6.0_01/bin/keytool -genkey -keystore mySrvKeystore -keyalg RSA

I have created this certificate from console and then copied it to the EchoServer/src/echo (where the EchoServer.java is located)
then RClick EchoServer Project -> Clean and Build goes ok BUT....
the RClick EchoServer Project ->Run Project comes with an error:

Exception in thread "main" java.lang.NoClassDefFoundError: EchoServer
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

The java file seems to be ok as it is from the site: http://tvilda.stilius.net/java/java_ssl.php BUT why this error come from and how can I solve this problem?

Thank You in advance for Your response :)

Edited by: DefTower on Oct 14, 2007 3:54 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2007
Added on Oct 14 2007
17 comments
554 views