I am having a bit of trouble with a class project. The code works fine in NetBeans but I cant get it working if i compile and run it from the command window. I have two files: hw3.java and ojdbc14.jar (oracle JDBC driver).
The first thing I did to compile was:
javac -classpath ojdbc14.jar hw3.java
and to run:
java -classpath ojdbc.jar hw3
this is the error i get:
Caused by: java.lang.ClassNotFoundException: hw3
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: hw3. Program will exit.
I think its looking in the ojdbc14.jar file for the 'hw3' class. Netbeans wraps it inot a nice jar file (im looking to into doing that) which i can execute just fine with "java -jar Homework3.jar". I wish netbeans would show the compile instructions in the output window. I just need help on getting the "javac" compile and "java" to work.
Stop reporting AR glasses as an X inch screen, Y distance away. That is a horseshit meaningless spec. Report on the actual FOV angle. That's all that matters.
And for the record, this FOV is ~49degrees. So we're talking about HoloLens level FOV... i.e. it's like looking through a piece of paper at arm's length.
Question
Doli
I am having a bit of trouble with a class project. The code works fine in NetBeans but I cant get it working if i compile and run it from the command window. I have two files: hw3.java and ojdbc14.jar (oracle JDBC driver).
The first thing I did to compile was:
javac -classpath ojdbc14.jar hw3.java
and to run:
java -classpath ojdbc.jar hw3
this is the error i get:
I think its looking in the ojdbc14.jar file for the 'hw3' class. Netbeans wraps it inot a nice jar file (im looking to into doing that) which i can execute just fine with "java -jar Homework3.jar". I wish netbeans would show the compile instructions in the output window. I just need help on getting the "javac" compile and "java" to work.
Link to comment
https://www.neowin.net/forum/topic/705004-java-command-line-compile-and-run/Share on other sites
5 answers to this question
Recommended Posts