My Question is:
I have a test.java class which is the main class. There is one more class(non-main class) which is present in JAR file. Now i want to compile and execute demo class present in JAR from the main class present outside the JAR. Please explain why.
public class test
{
public static void main(String args[])
{
demo d1 = new demo();
demo d2 = new demo("message passed from main class");
}
}
public class demo
{
demo()}
System.out.println("message in demo class");
}
demo(String str)
{
System.out.println(str);
}}
I guess the proper answer us ‘use ant’, but:
and then,
If you intend to expand on this, and continue not to use ant, you’ll likely want your build system to stop on an error, and will notice that ‘javac’ doesn’t return non-zero on error. Pipe its stderr to a temporary file and then quit depending on grep’s non-zero return of that file. e.g., from an on-device build script that cannot use ant: