Ask coding questions

← Back to all posts
Run Java program different a different name - other than
tkamal (5)

Right now it seems Java programs can only run if you have a file name - if you have other files in the folder with a different name etc these Java file cannot run?
Is there a way to get over this issue?

VictoriaMaria2 (0)

If I understand your problem well, the case is this: the other programs in java can be executed, but they need to be compiled, if you do it through a program called you need to type javac, when compiling type after java Exercise10

timmy_i_chen (1155)

There's no way to change which file is executed; however, you can instantiate other classes in the same directory. E.g. if I have in the same directory as I can just do:

Car c = new Car(args);
AideOropeza (0)

@timmy_i_chen that doesn't work for me :(

timmy_i_chen (1155)

@AideOropeza Can you link me to a repl where you are trying to do it?

tianyw (1)

hi, there is a repl example. @timmy_i_chen

how to run the directly?