I am using JCIFS (http://jcifs.samba.org/). My code is simple and taken from the Login.java example:
import jcifs.*;
import jcifs.smb.*;
public class netp {
public static void main( String argv[] ) throws Exception {
System.out.println("START");
String ip = "10.0.0.1";
String domain = "domain";
String user = "user";
String pass = "pass";
UniAddress dc = UniAddress.getByName( ip );
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication( domain + ";" + user + ":" + pass );
SmbSession.logon( dc, auth );
System.out.println("END");
return;
}
}
Compiling this works if I do this:
javac -cp jcifs-krb5-1.3.17.jar netp.java
However, if I run it like this:
java -cp jcifs-1.3.17.jar netp
I get:
Error: Could not find or load main class netp
What am I doing wrong?
I’ve uploaded the complete source code here:
https://www.box.com/s/po4frdmy0obqiroy9anp
Note: I am doing this all in Windows.
It seems that your myJavaApp class is in some package and you have omitted the package name in addition to not setting class path at all.
My directory structure for testing:
I compiled it like this:
which gave myJavaApp.class in testapp folder as expected. I have run it on linux like this:
and on windows like this:
It throwed
which means that the myJavaApp had run succesfully.
If we remove the testapp directoy, e.g.
it compiles with:
and on linux runs with:
for windows
EDIT:
all java[c] commands were run from root(.) / testing directory
EDIT^2:
I have downloaded your code and placed myself in netp directory. Compiled the code like this:
and succesfully run it like this:
it outputs: