Reputation: 1037
It gives an error "Could not find the main class: filename.java" How do I set the filename to be independent of the class names?
Upvotes: 0
Views: 461
Reputation: 9018
Sure you can. Just put version numbers in your classnames, as well.
Or keep the newest as the classname.java, with older versions getting version numbers.
Or drop the version numbers and use source code control.
Upvotes: 0
Reputation: 38300
Short Answer: You can't. One class per file is the java way. Accept that or find another language.
Longer Answer: You can but you probably don't want to.
If you have one public class and x number of non-public classes, you can put the all in the same file by nesting the non-public classes inside the public class. For example (in BlowFish.java):
public class BlowFish
{
class Hooty
{
}
class Sushi
{
}
}
Upvotes: 4
Reputation: 109
maybe is into the manifesto file where you are defining this class as your main class
Upvotes: 0
Reputation: 6941
You can't ... In Java the file name has to match the name of the public class in the file
See Why are filenames in Java the same as the class name? for an explanation
Upvotes: 12