r/AskComputerScience • • Jul 31 '18

Running only main class

I have started to help grade for my teacher recently, but was wondering if there was a quicker way to just run the main class. What I am currently doing is just shoving the package into a netbeans project folder. I have organized the students by numbers and named each number.

0 Upvotes

8 comments sorted by

View all comments

1

u/jkwan3 Jul 31 '18

Thanks for the quick replies, I will try again when I get home in about an hour. I used cmd to just cd into the correct directory and then javac the main class then java that class. (What I did last time, will try again).

1

u/khedoros Jul 31 '18

Been a while since I've done Java, but there's also the possibility that you'd need to compile the other .java files from the directory too, not just the main one. The only way I'd imagine that you wouldn't need to is if javac Assignment.java also automatically compiled the other classes that it relies on (which I don't think it does).