In this page, I assume there is the next file which contains main method.
topdir/package/name/prog.javaThe package name is topdir.package.name .
jar cmf mainClass prog.jar topdir/Here, the character order of the option ``cmf'' is not changeable. `m' and `f' tells order of argments. Then, it means
cmf:
create, m = mainClass, f = prog.jar
. The contain of the
file mainClass is:
Main-Class: topdir/package/name/prog
NOTICE: This file seems needing a newline of this line. In such case, you find next message: ``Failed to load Main-Class manifest attribute from prog.jar''
java -jar prog.jar
javadoc -verbose -version -author topdir/package/name (javadoc -verbose -encoding EUCJIS -version -author topdir/package/name ... in case you want to use Japanese with encoding EUCJIS)
java.awt.Toolkit.getDefaultToolkit().beep();
There is a good utility class which is called
com.sun.j3d.utils.applet.MainFrame
in java3d. You can just
new an applet and put it to the MainFrame for making an
application. This code also works as an applet. Next is a sample
code.
I found this information at Maeda Atusi's Java(tm)Tips. (In Japanese)
When you want to process both of a file name or an URL name transparently, the URL context helps you.
URL context = new URL("file:" + new File(".").getAbsolutePath()); URL url = new URL(context, fileOrUrl);
In this case, the fileOrUrl is interpreted under the context. Then, you do not need to care a fileOrUrl is a filename or an URL.
% java URLFile index.html url = file:/an/absolute/path/index.html protocol = file % java URLFile http://www/index.html url = http://www/index.html protocol = http