0

I cannot run my java using cmd

enter image description here

Please help.

Thank you

8
  • 1
    java -cp build Subset maybe? Commented Sep 4, 2012 at 3:53
  • 1
    Do you see Subset.class in the directory? Commented Sep 4, 2012 at 3:54
  • he'll probably have to compile all the files, so javac *? Commented Sep 4, 2012 at 3:54
  • do you have a static void main entry point declared in your class? Commented Sep 4, 2012 at 3:55
  • @soynerdito - that would cause a different exception. Commented Sep 4, 2012 at 4:01

4 Answers 4

2

Well, you've to compile it before you try java Subset. This tutorial on creation, compilation and execution of Java source files in command prompt might be of help to you. As a quick update, here's what you can consider doing:

  • Compiling your code using javac
  • Once compilation is successful, executing using java command
Sign up to request clarification or add additional context in comments.

1 Comment

To the down-voter: Can you please explain the reason behind down-voting this? I would love to update/edit the answer based on your comment, but please, when you down-vote , an explanation would be useful!
0

There is no Subset class in the classpath. Netbeans places the compiled classes in the build directory, so try (as I stated in my comment)...

java -cp build Subset

Make sure you've built via Netbeans. If you haven't, you can also do...

javac -d build src/Subset.java

Comments

0

Try compiling the Subset.java.. For this you will need to go to the directory where your Subset.java is located using Command Prompt, then execute the below commands.

Eg:

javac Subset.java

then,

java Subset

Comments

0

Just cheking, But in the IMG says that the file is in Queue/src, But you're trying to Run it from Queue.. Hay you tried to change the path?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.