command line - Unable to launch java file from CMD using Fully Qualified Name -
as per title, able compile class fine unable run (despite using qualified name)
boss@desktop-f8o3v2q /cygdrive/c/eclipse/workspace/mvn/3cx-driver/src $ java com.software._3cx.main.pbxconnection error: not find or load main class com.software._3cx.main.pbxconnection pbxconnection.java
package com.software._3cx.main; public class pbxconnection extends proxy { public pbxconnection(serversettings settings) { super(settings); } public static void main(string args[]) { .... would because of package name containing _underscore?
tree output
c:\eclipse\workspace\mvn\3cx-driver\src>tree folder path listing volume os volume serial number 00000074 d019:c44d c:. └───com └───software └───_3cx └───main dir:
c:\eclipse\workspace\mvn\3cx-driver\src\com\software\_3cx\main>dir volume in drive c os volume serial number d019-c44d directory of c:\eclipse\workspace\mvn\3cx-driver\src\com\software\_3cx\main 06/04/2017 16:31 <dir> . 06/04/2017 16:31 <dir> .. 06/04/2017 16:22 115 eventprocessor.java 06/04/2017 16:31 1,434 pbxconnection.class 06/04/2017 16:21 1,994 pbxconnection.java 3 file(s) 3,543 bytes 2 dir(s) 355,750,649,856 bytes free edit:
boss@desktop-f8o3v2q /cygdrive/c/eclipse/workspace/mvn/3cx-driver/src $ javac -cp c:/apache/apache-tomcat-7.0.56/lib/orderlycalls.jar com/software/_3cx/main/pbxconnection.java boss@desktop-f8o3v2q /cygdrive/c/eclipse/workspace/mvn/3cx-driver/src $ java -cp c:/apache/apache-tomcat-7.0.56/lib/orderlycalls.jar com.software._3cx.main.pbxconnection error: not find or load main class com.software._3cx.main.pbxconnection edit: java 7 using (i though java 8 running) not
boss@desktop-f8o3v2q ~ $ java -version java version "1.7.0_79" java(tm) se runtime environment (build 1.7.0_79-b15) java hotspot(tm) 64-bit server vm (build 24.79-b02, mixed mode) boss@desktop-f8o3v2q ~ $ javac -version javac 1.7.0_79 boss@desktop-f8o3v2q ~ $ java /cygdrive/c/program files/java/jdk1.7.0_79/bin/java boss@desktop-f8o3v2q ~ $ javac /cygdrive/c/program files/java/jdk1.7.0_79/bin/javac
usually on linux-like systems set classpath follows colon:
java -cp "somelibrary.jar:." mymainclass ^ if use windows java error desribed, indicating java not able find class specified.
if ensure have semicolon in classpath, should run main class fine:
java -cp "somelibrary.jar;." mymainclass ^ note if use unix-flavored java, opposite case. may need use : instead of ;.
note also: while javac doesn't require . find file want compile (as gave parameter), java doesn't know find pbxconnection.class-file. told java classpath search contains orderlycalls.jar. need explicitly java can find actual main-class. . necessary when want run program, isn't necessary in specific case compiler.
Comments
Post a Comment