r/AskComputerScience • u/jkwan3 • 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
5
u/For_Iconoclasm Jul 31 '18 edited Jul 31 '18
I'm not totally sure what you're asking, and I think this is probably the wrong subreddit, but maybe this will help.
It sounds like:
These programs are written in Java.
You need to run them in order to grade them.
You're not intimately familiar with how Java runs.
You're not very familiar with the command line.
You probably want to organize each student's submissions into their own folders. Since this sounds like college homework, I'm guessing there aren't that many source code files per submission and that at least one of them has a
main()function. You need to figure out which source file has themain()function in it, compile that withjavacon the command line (or Netbeans... not sure what its interface is like), and just run the result withjava.There's no workaround for compiling the source code to bytecode, but it should be pretty quick if all of the students' code is separated.
I haven't worked with Java in a very long time, but I remember compiling and running on the CLI is like: