Reputation: 53
How would I run an eclipse project with specific methods in the command line? Like, how could I rename a method with a longer name to something shorter so that I don't have to type the whole thing in the command line? basically abbreviations
I've done this in Python, but I'm not sure how to do it in java
Upvotes: 0
Views: 44
Reputation: 53
My question may not have been clear enough. Here is the solution I found though
public static void main(String[] args) {
if (args.length == 1) {
//do a thing
} else if (args.length == 2){
if(args[1].toUpperCase().equals("string i'm looking for"))
//do a thing
} else if (args.length == 3) {
if(args[1].equals("string1")&& args[2].equals("string2") || args[2].equals("string1")&& args[1].equals("string2"))
//do a thing
}
}
where I'm calling it on the args[]
Upvotes: 0
Reputation: 201409
Java entry point is main
and is not mutable like python. There is nothing like __init__
to check in Java. When you package a Java program as a jar, you can specify the Main-Class
in the MANIFEST. See also Lesson: Packaging Programs in JAR Files
Upvotes: 1