2

I want to add a .java file into my project. But this .java has "Main". and this is a big .java file. I just want to call and run this .java file somewhere in my project. How can I deal with this? Wish I made this clear. Thanks you all.

P.s. I m using netbeans.

With IDE, Netbeans

1
  • How do you build your project (with ant/maven/IDE) ? Commented Nov 24, 2010 at 8:54

2 Answers 2

4

Just add the file to your project like any other Java source file. After Netbeans has compiled it successfully, you can call the code with:

String[] args = { "arg1", "arg2" };
Main.main(args); // Call of static method main()

(where "Main" is the name of the class which is contained in your .java file).

Sign up to request clarification or add additional context in comments.

Comments

1

you should check a simple helloworld tutorial such as this one:

http://download.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html

jason

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.